Public Member Functions | |
OFDate () | |
default constructor. | |
OFDate (const OFDate &dateVal) | |
copy constructor | |
OFDate (const unsigned int year, const unsigned int month, const unsigned int day) | |
constructor with init values | |
virtual | ~OFDate () |
destructor | |
virtual OFDate & | operator= (const OFDate &dateVal) |
assignment operator | |
virtual OFBool | operator== (const OFDate &dateVal) const |
comparison operator (equal) | |
virtual OFBool | operator!= (const OFDate &dateVal) const |
comparison operator (unequal) | |
virtual OFBool | operator< (const OFDate &dateVal) const |
comparison operator (less than) | |
virtual OFBool | operator<= (const OFDate &dateVal) const |
comparison operator (less than or equal) | |
virtual OFBool | operator>= (const OFDate &dateVal) const |
comparison operator (greater than or equal) | |
virtual OFBool | operator> (const OFDate &dateVal) const |
comparison operator (greater than) | |
virtual void | clear () |
reset the date value. | |
virtual OFBool | isValid () const |
check whether the currently stored date value is valid. | |
OFBool | setDate (const unsigned int year, const unsigned int month, const unsigned int day) |
set the date value to the specified date. | |
OFBool | setYear (const unsigned int year) |
set the date value to the specified year. | |
OFBool | setMonth (const unsigned int month) |
set the date value to the specified month. | |
OFBool | setDay (const unsigned int day) |
set the date value to the specified day. | |
OFBool | setCurrentDate () |
set the date value to the current system date. | |
OFBool | setISOFormattedDate (const OFString &formattedDate) |
set the date value to the given ISO formatted date string. | |
unsigned int | getYear () const |
get the currently stored year value | |
unsigned int | getMonth () const |
get the currently stored month value | |
unsigned int | getDay () const |
get the currently stored day value | |
OFBool | getISOFormattedDate (OFString &formattedDate, const OFBool showDelimiter=OFTrue) const |
get the current date value in ISO format. | |
Static Public Member Functions | |
static OFDate | getCurrentDate () |
get the current system date | |
Protected Member Functions | |
OFBool | setCurrentDate (const time_t &tt) |
set the date value to the current system date. | |
Static Protected Member Functions | |
static OFBool | isDateValid (const unsigned int year, const unsigned int month, const unsigned int day) |
check whether the given date is valid. | |
Private Attributes | |
unsigned int | Year |
currently stored year value | |
unsigned int | Month |
currently stored month value | |
unsigned int | Day |
currently stored day value | |
Friends | |
class | OFDateTime |
Definition at line 51 of file ofdate.h.
OFDate::OFDate | ( | ) |
default constructor.
Initializes Year, Month and Day to 0.
OFDate::OFDate | ( | const OFDate & | dateVal | ) |
copy constructor
dateVal | date object to be copied |
OFDate::OFDate | ( | const unsigned int | year, | |
const unsigned int | month, | |||
const unsigned int | day | |||
) |
constructor with init values
year | year value to be set | |
month | month value to be set | |
day | day value to be set |
assignment operator
dateVal | date value to be set |
virtual OFBool OFDate::operator== | ( | const OFDate & | dateVal | ) | const [virtual] |
comparison operator (equal)
dateVal | date value compared with the current value |
virtual OFBool OFDate::operator!= | ( | const OFDate & | dateVal | ) | const [virtual] |
comparison operator (unequal)
dateVal | date value compared with the current value |
virtual OFBool OFDate::operator< | ( | const OFDate & | dateVal | ) | const [virtual] |
comparison operator (less than)
dateVal | date value compared with the current value |
virtual OFBool OFDate::operator<= | ( | const OFDate & | dateVal | ) | const [virtual] |
comparison operator (less than or equal)
dateVal | date value compared with the current value |
virtual OFBool OFDate::operator>= | ( | const OFDate & | dateVal | ) | const [virtual] |
comparison operator (greater than or equal)
dateVal | date value compared with the current value |
virtual OFBool OFDate::operator> | ( | const OFDate & | dateVal | ) | const [virtual] |
comparison operator (greater than)
dateVal | date value compared with the current value |
virtual void OFDate::clear | ( | ) | [virtual] |
reset the date value.
Sets the year, month and day to "0". NB: Date becomes invalid.
virtual OFBool OFDate::isValid | ( | ) | const [virtual] |
check whether the currently stored date value is valid.
Currently, this method only checks whether the month is within the range of 1 to 12 and the day is within the range of 1 to 31. In the future this routine might be enhanced.
OFBool OFDate::setDate | ( | const unsigned int | year, | |
const unsigned int | month, | |||
const unsigned int | day | |||
) |
set the date value to the specified date.
Before the new value is set it is checked using the "isValid()" routine.
year | new year value to be set | |
month | new month value to be set | |
day | new day value to be set |
OFBool OFDate::setYear | ( | const unsigned int | year | ) |
set the date value to the specified year.
Before the new value is set it is checked using the "isValid()" routine.
year | new year value to be set |
OFBool OFDate::setMonth | ( | const unsigned int | month | ) |
set the date value to the specified month.
Before the new value is set it is checked using the "isValid()" routine.
month | new month value to be set |
OFBool OFDate::setDay | ( | const unsigned int | day | ) |
set the date value to the specified day.
Before the new value is set it is checked using the "isValid()" routine.
day | new day value to be set |
OFBool OFDate::setCurrentDate | ( | ) |
set the date value to the current system date.
This function uses operating system dependent routines. If they are unavailable for some reason the current value is not modified.
OFBool OFDate::setISOFormattedDate | ( | const OFString & | formattedDate | ) |
set the date value to the given ISO formatted date string.
The two ISO date formats supported by this function are "YYYY-MM-DD" (with arbitrary delimiters) and "YYYYMMDD" (without delimiters, useful for DICOM date type).
formattedDate | ISO formatted date value to be set |
unsigned int OFDate::getYear | ( | ) | const |
get the currently stored year value
unsigned int OFDate::getMonth | ( | ) | const |
get the currently stored month value
unsigned int OFDate::getDay | ( | ) | const |
get the currently stored day value
OFBool OFDate::getISOFormattedDate | ( | OFString & | formattedDate, | |
const OFBool | showDelimiter = OFTrue | |||
) | const |
get the current date value in ISO format.
The two ISO date formats supported by this function are "YYYY-MM-DD" (with delimiters) and "YYYYMMDD" (without delimiters, useful for DICOM date type).
formattedDate | reference to string variable where the result is stored | |
showDelimiter | flag, indicating whether to use delimiters ("-") or not |
static OFDate OFDate::getCurrentDate | ( | ) | [static] |
get the current system date
OFBool OFDate::setCurrentDate | ( | const time_t & | tt | ) | [protected] |
set the date value to the current system date.
This function uses operating system dependent routines. If they are unavailable for some reason the current value is not modified.
tt | current system time (as returned by the time() function ) |
static OFBool OFDate::isDateValid | ( | const unsigned int | year, | |
const unsigned int | month, | |||
const unsigned int | day | |||
) | [static, protected] |
check whether the given date is valid.
Currently, this method only checks whether the month is within the range of 1 to 12 and the day is within the range of 1 to 31. In the future this routine might be enhanced.
year | year value to be checked | |
month | month value to be checked | |
day | day value to be checked |