#include <Date.h>
Inheritance diagram for Date:
Public Types | |
enum | CALENDAR { GREGORIAN, BUDDHIST_GREGORIAN, HIJRI } |
Public Member Functions | |
Date () | |
Date (const char *d) | |
Date (const std::string &d) | |
Date (const Date *d) | |
bool | isMissing (void) const |
void | setMissing (void) |
void | set (const char *dateString) |
void | set (const std::string &dateString) |
const std::string | get (void) const |
Date & | operator++ () |
Date | operator++ (int) |
Date & | operator-- () |
Date | operator-- (int) |
Date & | operator+= (const Number &b) |
Date & | operator-= (const Number &b) |
Date | operator+ (const Number &b) const |
Date | operator- (const Number &b) const |
Number | operator- (const Date &b) const |
bool | operator< (const Data &b) const |
bool | operator== (const Data &b) const |
bool | isApproximate (void) const |
const DATATYPE | getDataType (void) const |
virtual Date * | clone () const |
Static Public Member Functions | |
static void | addDateMissingValue (std::string value) |
static bool | isMissingValue (std::string value) |
static bool | isA (const std::string &s) |
static double | getDaysInYear (void) |
static void | displayRangeMeans (bool displayThem) |
static void | displayDelimiters (bool displayThem) |
Static Public Attributes | |
static const Date | MISSING |
Private Member Functions | |
long | _yearMonthDayToJulian (int yyyy, int mm, int dd) |
bool | _isLeapYear (int year) |
int | _getLastDayOfMonth (int year, int month) |
void | _getYearMonthDay (const long julian, int *yyyy, int *mm, int *dd) const |
long | _islamicYearMonthDayToJulian (int yyyy, int mm, int dd) const |
bool | _isIslamicLeapYear (int year) const |
int | _lastDayOfIslamicMonth (int year, int month) const |
void | _getIslamicYearMonthDay (const long julian, int *yyyy, int *mm, int *dd) const |
bool | _intersectionIsNotNull (const Date &b) const |
bool | _hasASCIIDateDelimiter (const char **position) |
bool | _hasApproximationIndicator (const char **position) |
bool | _hasCJKCharacterForYear (const char **position) |
bool | _hasCJKCharacterForMonth (const char **position) |
bool | _hasCJKCharacterForDay (const char **position) |
bool | _hasCJKCharacterForArrive (const char **position) |
bool | _hasCJKCharacterForFullStop (const char **position) |
bool | _hasCJKCharacterForForwardSlash (const char **position) |
bool | _hasCJKCharacterForDash (const char **position) |
bool | _hasCJKCharacterForOpeningSquareBracket (const char **position) |
bool | _hasCJKCharacterForClosingSquareBracket (const char **position) |
bool | _hasUnicodeRightArrow (const char **position) |
bool | _hasKoreanHangulForYear (const char **position) |
bool | _hasKoreanHangulForMonth (const char **position) |
bool | _hasKoreanHangulForDay (const char **position) |
bool | _hasUTF8Character (const char **position, const char *UTF8Character) |
bool | _hasRangeDelimiter (const char **position, bool startBracketFound) |
bool | _hasCJKVersionOfGenericDateDelimiter (const char **position) |
bool | _hasYearDelimiter (const char **position, bool *isProperCJKDate) |
bool | _hasMonthDelimiter (const char **position) |
bool | _hasDayDelimiter (const char **position) |
bool | _hasOpeningBracket (const char **position) |
bool | _hasClosingBracket (const char **position) |
int | _getValue (const char **position) |
void | _skipWhiteSpace (const char **position) |
void | _readDateString (const char *s) |
bool | _yearIsValid (int year, const char *dateString) |
bool | _monthIsValid (int month, const char *dateString) |
bool | _dayIsValid (int year, int month, int day, const char *dateString) |
Private Attributes | |
bool | _isMissing |
bool | _isApproximate |
bool | _isRange |
long | _julian |
long | _highEndJulian |
Static Private Attributes | |
static const int | _daysInMonth [12] = {31,28,31,30,31,30,31,31,30,31,30,31} |
static bool | _displayRangeMeans = false |
static bool | _displayDelimiters = false |
static const long | _IGREG = (15+31L*(10+12L*1582)) |
static const long | _IGREGJULIAN = 2299161 |
static const long | _IHIJRIJULIAN = 1948438 |
static const unsigned int | _DATESTRINGLENGTH = 72 |
static const double | _DAYSINYEAR = 365.2425 |
static std::set< std::string > | _dateMissingValue |
static CALENDAR | _calendarDisplayType = Date::GREGORIAN |
Dates are stored internally as Julian day numbers. Dates are expected to be input in ISO "YYYY-MM-DD" format. Note however that the constructor handles non-ASCII digits seamlessly: See the DigitConverter class for details.
For dates prior to the establishment of the Gregorian calendar in 1582, a proleptic calendar is used.
2005.09.19 TO-DO: ED, DECIDE WHAT TO DO ABOUT NON-GREGORIAN (BUDDHIST,HIJRI) INPUT AND OUTPUT IN THE DATE CLASS.
|
|
|
|
|
|
|
|
|
Copy construct a date from a const pointer to a date: |
|
|
|
_getIslamicYearMonthDay(): --> Only use if date is > _IHIJRIJULIAN (start of Islamic calendar) |
|
_getLastDayOfMonth(): Returns the last day of the month of the given year. |
|
Converts a string of digits, optionally prefixed by a '+' or '-', into an integer value: |
|
_getYearMonthDay(): Obtain the year, month, and day integers from a julian day number. |
|
If the string pointed to by "*position" starts with "~", then the string pointer is incremented to point to the next character and true is returned. Otherwise, the pointer is not incremented and false is returned. |
|
If the string pointed to by "*position" starts with ".", "/", or "-", then the string pointer is incremented to point to the next character and true is returned. Otherwise, the pointer is not incremented and false is returned. |
|
|
|
|
|
|
|
_hasCJKCharacterForDay(const char **position): If the string pointed to by "*position" starts with the CJKCharacter for day (日 in UTF8 format), then the string pointer is incremented to point to the next character and true is returned. Otherwise, the pointer is not incremented and false is returned. : e6 97 a5 |
|
|
|
|
|
_hasCJKCharacterForMonth(const char **position): If the string pointed to by "*position" starts with the CJKCharacter for month (月 in UTF8 format), then the string pointer is incremented to point to the next character and true is returned. Otherwise, the pointer is not incremented and false is returned. : e5 b9 b4 |
|
|
|
_hasCJKCharacterForYear(const char **position): If the string pointed to by "*position" starts with the CJKCharacter for year (年 in UTF8 format), then the string pointer is incremented to point to the next character and true is returned. Otherwise, the pointer is not incremented and false is returned. : e5 b9 b4 |
|
|
|
|
|
|
|
_hasKoreanHangulForDay(const char **position): If the string pointed to by "*position" starts with the CJKCharacter for year (일 in UTF8 format), then the string pointer is incremented to point to the next character and true is returned. Otherwise, the pointer is not incremented and false is returned. : ec 9d bc |
|
_hasKoreanHangulForMonth(const char **position): If the string pointed to by "*position" starts with the CJKCharacter for year (월 in UTF8 format), then the string pointer is incremented to point to the next character and true is returned. Otherwise, the pointer is not incremented and false is returned. : ec 9b 94 |
|
|
|
|
|
|
|
_hasRangeDelimiter(const char **position,bool startBracketFound): If the string pointed to by "*position" starts with a valid range delimiter (" - ","r", "R", "", or "", then the string pointer is incremented to point to the next character and true is returned. Otherwise, the pointer is not incremented and false is returned. |
|
|
|
_hasUTF8Character: If the string pointed to by "*position" starts with the character in UTF8Character, then the string pointer is incremented to point to the next character and true is returned. Otherwise, the pointer is not incremented and false is returned. |
|
|
|
|
|
_isIslamicLeapYear(): Returns true if it is an Islamic Hijri leap year: |
|
_islamicYearMonthDayToJulian(): Obtain the Julian day number from an Islamic Hijri date: |
|
_isLeapYear(): Determines if a Gregorian calendar year is a leap year. |
|
_lastDayOfIslamicMonth(): Returns the number of days in the Islamic month. |
|
|
|
|
|
|
|
Checks for errors in year yyyy, month mm, day dd for Gregorian civil calendar: |
|
_yearMonthDayToJulian(): Converts Gregorian civil year yyyy, month mm, day dd to Julian day number: |
|
|
|
clone method: Implements Data. |
|
|
|
|
|
Get string representation of the date: UNFINISHED: ostringstream may be SLOW : test and change Implements Data. |
|
Implements Data. |
|
|
|
This is a static method: Determines if the presented string is a valid Date. |
|
|
|
bool isMissing(): Required by virtual base class: Implements Data. |
|
isMissingValue determines whether a string represents one of the missing values in the missing value lookup table. |
|
|
Postfix ++ |
|
Prefix ++ |
|
operator+= |
|
|
|
Postfix -- |
|
Prefix -- |
|
operator -= |
|
operator < NOTA BENE: This is used for SORTING only Implements Data. |
|
operator == Implements Data. |
|
Set date from std::string: Implements Data. |
|
Set a date from a "yyyy.mm.dd" string or a date range string. Implements Data. |
|
setMissing: Implements Data. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|