X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dc84437ea2289b601129e218e6b51dc80253c3db..cba5a276e4821a0ae7d1e7a435d6aab38baa0a9f:/include/wx/datetime.h?ds=inline diff --git a/include/wx/datetime.h b/include/wx/datetime.h index 017c226b89..35a164dd3a 100644 --- a/include/wx/datetime.h +++ b/include/wx/datetime.h @@ -13,10 +13,12 @@ #ifndef _WX_DATETIME_H #define _WX_DATETIME_H -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(__APPLE__) #pragma interface "datetime.h" #endif +#include "wx/defs.h" + #if wxUSE_DATETIME #include @@ -657,8 +659,10 @@ public: // ------------------------------------------------------------------------ // set to the given week day in the same week as this one - wxDateTime& SetToWeekDayInSameWeek(WeekDay weekday); - inline wxDateTime GetWeekDayInSameWeek(WeekDay weekday) const; + wxDateTime& SetToWeekDayInSameWeek(WeekDay weekday, + WeekFlags flags = Monday_First); + inline wxDateTime GetWeekDayInSameWeek(WeekDay weekday, + WeekFlags flags = Monday_First) const; // set to the next week day following this one wxDateTime& SetToNextWeekDay(WeekDay weekday); @@ -692,8 +696,12 @@ public: // sets the date to the given day of the given week in the year, // returns TRUE on success and FALSE if given date doesn't exist (e.g. // numWeek is > 53) - bool SetToTheWeek(wxDateTime_t numWeek, WeekDay weekday = Mon); - inline wxDateTime GetWeek(wxDateTime_t numWeek, WeekDay weekday = Mon) const; + bool SetToTheWeek(wxDateTime_t numWeek, + WeekDay weekday = Mon, + WeekFlags flags = Monday_First); + inline wxDateTime GetWeek(wxDateTime_t numWeek, + WeekDay weekday = Mon, + WeekFlags flags = Monday_First) const; // sets the date to the last day of the given (or current) month or the // given (or current) year @@ -843,6 +851,15 @@ public: // adoption of the Gregorian calendar is simply unknown. bool IsGregorianDate(GregorianAdoption country = Gr_Standard) const; + // dos date and time format + // ------------------------------------------------------------------------ + + // set from the DOS packed format + wxDateTime& SetFromDOS(unsigned long ddt); + + // pack the date in DOS format + unsigned long GetAsDOS() const; + // comparison (see also functions below for operator versions) // ------------------------------------------------------------------------ @@ -1161,6 +1178,12 @@ private: // Beware about weeks: if you specify both weeks and days, the total number of // days added will be 7*weeks + days! See also GetTotalDays() function. // +// Equality operators are defined for wxDateSpans. Two datespans are equal if +// they both give the same target date when added to *every* source date. +// Thus wxDateSpan::Months(1) is not equal to wxDateSpan::Days(30), because +// they not give the same date when added to 1 Feb. But wxDateSpan::Days(14) is +// equal to wxDateSpan::Weeks(2) +// // Finally, notice that for adding hours, minutes &c you don't need this // class: wxTimeSpan will do the job because there are no subtleties // associated with those. @@ -1507,6 +1530,24 @@ inline bool WXDLLEXPORT operator!=(const wxTimeSpan &t1, const wxTimeSpan &t2) // wxDateSpan // ---------------------------------------------------------------------------- +// comparison +// ---------- + +// ds1 == d2 if and only if for every wxDateTime t t + ds1 == t + ds2 +inline WXDLLEXPORT bool operator==(const wxDateSpan& ds1, + const wxDateSpan& ds2) +{ + return ds1.GetYears() == ds2.GetYears() && + ds1.GetMonths() == ds2.GetMonths() && + ds1.GetTotalDays() == ds2.GetTotalDays(); +} + +inline WXDLLEXPORT bool operator!=(const wxDateSpan& ds1, + const wxDateSpan& ds2) +{ + return !(ds1 == ds2); +} + // arithmetics // -----------