X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/57b486583d6809c9f4cf58286bb5b150a6415449..222ed1d678dff2f5c3c4164321dd05e8f47de487:/include/wx/datetime.h diff --git a/include/wx/datetime.h b/include/wx/datetime.h index 9ea0f924b6..21e98adb72 100644 --- a/include/wx/datetime.h +++ b/include/wx/datetime.h @@ -7,7 +7,7 @@ // Created: 10.02.99 // RCS-ID: $Id$ // Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_DATETIME_H @@ -26,39 +26,21 @@ #include "wx/longlong.h" -class WXDLLEXPORT wxDateTime; -class WXDLLEXPORT wxTimeSpan; -class WXDLLEXPORT wxDateSpan; +class WXDLLIMPEXP_BASE wxDateTime; +class WXDLLIMPEXP_BASE wxTimeSpan; +class WXDLLIMPEXP_BASE wxDateSpan; -// a hack: don't use inline functions in debug builds - we don't care about -// performances and this only leads to increased rebuild time (because every -// time an inline method is changed, all files including the header must be -// rebuilt) - -// For Mingw32, causes a link error. (VZ: why?) -#if defined( __WXDEBUG__) && !defined(__MINGW32__) && !defined(_MSC_VER) - #define wxDATETIME_DONT_INLINE - - #undef inline - #define inline -#else - // just in case - #undef wxDATETIME_DONT_INLINE -#endif // Debug +#include "wx/dynarray.h" // not all c-runtimes are based on 1/1/1970 being (time_t) 0 // set this to the corresponding value in seconds 1/1/1970 has on your // systems c-runtime -#ifdef __WXMAC__ -#if __MSL__ < 0x6000 +#if defined(__WXMAC__) && !defined(__DARWIN__) && __MSL__ < 0x6000 #define WX_TIME_BASE_OFFSET ( 2082844800L + 126144000L ) #else #define WX_TIME_BASE_OFFSET 0 #endif -#else - #define WX_TIME_BASE_OFFSET 0 -#endif /* * TODO * @@ -121,16 +103,16 @@ class WXDLLEXPORT wxDateSpan; // argument for arguments of type wxDateTime; it is also returned by all // functions returning wxDateTime on failure (this is why it is also called // wxInvalidDateTime) -class WXDLLEXPORT wxDateTime; +class WXDLLIMPEXP_BASE wxDateTime; -WXDLLEXPORT_DATA(extern const wxDateTime) wxDefaultDateTime; +extern WXDLLIMPEXP_DATA_BASE(const wxDateTime) wxDefaultDateTime; #define wxInvalidDateTime wxDefaultDateTime // ---------------------------------------------------------------------------- // wxDateTime represents an absolute moment in the time // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxDateTime +class WXDLLIMPEXP_BASE wxDateTime { public: // types @@ -402,7 +384,7 @@ public: // a class representing a time zone: basicly, this is just an offset // (in seconds) from GMT - class WXDLLEXPORT TimeZone + class WXDLLIMPEXP_BASE TimeZone { public: TimeZone(TZ tz); @@ -422,7 +404,7 @@ public: // NB: this struct should always be kept normalized (i.e. mon should // be < 12, 1 <= day <= 31 &c), so use AddMonths(), AddDays() // instead of modifying the member fields directly! - struct WXDLLEXPORT Tm + struct WXDLLIMPEXP_BASE Tm { wxDateTime_t msec, sec, min, hour, mday; Month mon; @@ -1009,7 +991,7 @@ private: // objects of that class. See also wxDateSpan. // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxTimeSpan +class WXDLLIMPEXP_BASE wxTimeSpan { public: // constructors @@ -1189,7 +1171,7 @@ private: // associated with those. // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxDateSpan +class WXDLLIMPEXP_BASE wxDateSpan { public: // constructors @@ -1289,9 +1271,7 @@ private: // wxDateTimeArray: array of dates. // ---------------------------------------------------------------------------- -#include "wx/dynarray.h" - -WX_DECLARE_EXPORTED_OBJARRAY(wxDateTime, wxDateTimeArray); +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxDateTime, wxDateTimeArray, WXDLLIMPEXP_BASE); // ---------------------------------------------------------------------------- // wxDateTimeHolidayAuthority: an object of this class will decide whether a @@ -1302,11 +1282,13 @@ WX_DECLARE_EXPORTED_OBJARRAY(wxDateTime, wxDateTimeArray); // virtual methods to work with the holidays they correspond to. // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxDateTimeHolidayAuthority; -WX_DEFINE_EXPORTED_ARRAY(wxDateTimeHolidayAuthority *, wxHolidayAuthoritiesArray); +class WXDLLIMPEXP_BASE wxDateTimeHolidayAuthority; +WX_DEFINE_USER_EXPORTED_ARRAY(wxDateTimeHolidayAuthority *, + wxHolidayAuthoritiesArray, + class WXDLLIMPEXP_BASE); class wxDateTimeHolidaysModule; -class WXDLLEXPORT wxDateTimeHolidayAuthority +class WXDLLIMPEXP_BASE wxDateTimeHolidayAuthority { friend class wxDateTimeHolidaysModule; public: @@ -1326,6 +1308,9 @@ public: // wxDateTimeHolidayAuthority) static void AddAuthority(wxDateTimeHolidayAuthority *auth); + // the base class must have a virtual dtor + virtual ~wxDateTimeHolidayAuthority(); + protected: // this function is called to determine whether a given day is a holiday virtual bool DoIsHoliday(const wxDateTime& dt) const = 0; @@ -1348,7 +1333,7 @@ private: }; // the holidays for this class are all Saturdays and Sundays -class WXDLLEXPORT wxDateTimeWorkDays : public wxDateTimeHolidayAuthority +class WXDLLIMPEXP_BASE wxDateTimeWorkDays : public wxDateTimeHolidayAuthority { protected: virtual bool DoIsHoliday(const wxDateTime& dt) const; @@ -1361,21 +1346,536 @@ protected: // inline functions implementation // ============================================================================ -// don't include inline functions definitions when we're included from anything -// else than datetime.cpp in debug builds: this minimizes rebuilds if we change -// some inline function and the performance doesn't matter in the debug builds. +// ---------------------------------------------------------------------------- +// private macros +// ---------------------------------------------------------------------------- -#if !defined(wxDATETIME_DONT_INLINE) || defined(wxDEFINE_TIME_CONSTANTS) - #define INCLUDED_FROM_WX_DATETIME_H - #include "wx/datetime.inl" - #undef INCLUDED_FROM_WX_DATETIME_H +#define MILLISECONDS_PER_DAY 86400000l + +// some broken compilers (HP-UX CC) refuse to compile the "normal" version, but +// using a temp variable always might prevent other compilers from optimising +// it away - hence use of this ugly macro +#ifndef __HPUX__ + #define MODIFY_AND_RETURN(op) return wxDateTime(*this).op +#else + #define MODIFY_AND_RETURN(op) wxDateTime dt(*this); dt.op; return dt #endif -// if we defined it to be empty above, restore it now -#ifdef wxDATETIME_DONT_INLINE - #undef inline +// ---------------------------------------------------------------------------- +// wxDateTime construction +// ---------------------------------------------------------------------------- + +inline bool wxDateTime::IsInStdRange() const +{ + return m_time >= 0l && (m_time / TIME_T_FACTOR) < LONG_MAX; +} + +/* static */ +inline wxDateTime wxDateTime::Now() +{ + return wxDateTime(*GetTmNow()); +} + +/* static */ +inline wxDateTime wxDateTime::Today() +{ + struct tm *time = GetTmNow(); + time->tm_hour = 0; + time->tm_min = 0; + time->tm_sec = 0; + + return wxDateTime(*time); +} + +#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) +inline wxDateTime& wxDateTime::Set(time_t timet) +{ + // assign first to avoid long multiplication overflow! + m_time = timet - WX_TIME_BASE_OFFSET ; + m_time *= TIME_T_FACTOR; + + return *this; +} #endif +inline wxDateTime& wxDateTime::SetToCurrent() +{ + *this = Now(); + return *this; +} + +#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400)) +inline wxDateTime::wxDateTime(time_t timet) +{ + Set(timet); +} +#endif + +inline wxDateTime::wxDateTime(const struct tm& tm) +{ + Set(tm); +} + +inline wxDateTime::wxDateTime(const Tm& tm) +{ + Set(tm); +} + +inline wxDateTime::wxDateTime(double jdn) +{ + Set(jdn); +} + +inline wxDateTime& wxDateTime::Set(const Tm& tm) +{ + wxASSERT_MSG( tm.IsValid(), _T("invalid broken down date/time") ); + + return Set(tm.mday, (Month)tm.mon, tm.year, tm.hour, tm.min, tm.sec); +} + +inline wxDateTime::wxDateTime(wxDateTime_t hour, + wxDateTime_t minute, + wxDateTime_t second, + wxDateTime_t millisec) +{ + Set(hour, minute, second, millisec); +} + +inline wxDateTime::wxDateTime(wxDateTime_t day, + Month month, + int year, + wxDateTime_t hour, + wxDateTime_t minute, + wxDateTime_t second, + wxDateTime_t millisec) +{ + Set(day, month, year, hour, minute, second, millisec); +} + +// ---------------------------------------------------------------------------- +// wxDateTime accessors +// ---------------------------------------------------------------------------- + +inline wxLongLong wxDateTime::GetValue() const +{ + wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); + + return m_time; +} + +inline time_t wxDateTime::GetTicks() const +{ + wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); + if ( !IsInStdRange() ) + { + return (time_t)-1; + } + + return (time_t)((m_time / (long)TIME_T_FACTOR).GetLo())+WX_TIME_BASE_OFFSET ; +} + +inline bool wxDateTime::SetToLastWeekDay(WeekDay weekday, + Month month, + int year) +{ + return SetToWeekDay(weekday, -1, month, year); +} + +inline wxDateTime wxDateTime::GetWeekDayInSameWeek(WeekDay weekday, + WeekFlags flags) const +{ + MODIFY_AND_RETURN( SetToWeekDayInSameWeek(weekday) ); +} + +inline wxDateTime wxDateTime::GetNextWeekDay(WeekDay weekday) const +{ + MODIFY_AND_RETURN( SetToNextWeekDay(weekday) ); +} + +inline wxDateTime wxDateTime::GetPrevWeekDay(WeekDay weekday) const +{ + MODIFY_AND_RETURN( SetToPrevWeekDay(weekday) ); +} + +inline wxDateTime wxDateTime::GetWeekDay(WeekDay weekday, + int n, + Month month, + int year) const +{ + wxDateTime dt(*this); + + return dt.SetToWeekDay(weekday, n, month, year) ? dt : wxInvalidDateTime; +} + +inline wxDateTime wxDateTime::GetLastWeekDay(WeekDay weekday, + Month month, + int year) +{ + wxDateTime dt(*this); + + return dt.SetToLastWeekDay(weekday, month, year) ? dt : wxInvalidDateTime; +} + +inline wxDateTime wxDateTime::GetWeek(wxDateTime_t numWeek, + WeekDay weekday, + WeekFlags flags) const +{ + wxDateTime dt(*this); + + return dt.SetToTheWeek(numWeek, weekday, flags) ? dt : wxInvalidDateTime; +} + +inline wxDateTime wxDateTime::GetLastMonthDay(Month month, int year) const +{ + MODIFY_AND_RETURN( SetToLastMonthDay(month, year) ); +} + +inline wxDateTime wxDateTime::GetYearDay(wxDateTime_t yday) const +{ + MODIFY_AND_RETURN( SetToYearDay(yday) ); +} + +// ---------------------------------------------------------------------------- +// wxDateTime comparison +// ---------------------------------------------------------------------------- + +inline bool wxDateTime::IsEqualTo(const wxDateTime& datetime) const +{ + wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime")); + + return m_time == datetime.m_time; +} + +inline bool wxDateTime::IsEarlierThan(const wxDateTime& datetime) const +{ + wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime")); + + return m_time < datetime.m_time; +} + +inline bool wxDateTime::IsLaterThan(const wxDateTime& datetime) const +{ + wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime")); + + return m_time > datetime.m_time; +} + +inline bool wxDateTime::IsStrictlyBetween(const wxDateTime& t1, + const wxDateTime& t2) const +{ + // no need for assert, will be checked by the functions we call + return IsLaterThan(t1) && IsEarlierThan(t2); +} + +inline bool wxDateTime::IsBetween(const wxDateTime& t1, + const wxDateTime& t2) const +{ + // no need for assert, will be checked by the functions we call + return IsEqualTo(t1) || IsEqualTo(t2) || IsStrictlyBetween(t1, t2); +} + +inline bool wxDateTime::IsSameDate(const wxDateTime& dt) const +{ + Tm tm1 = GetTm(), + tm2 = dt.GetTm(); + + return tm1.year == tm2.year && + tm1.mon == tm2.mon && + tm1.mday == tm2.mday; +} + +inline bool wxDateTime::IsSameTime(const wxDateTime& dt) const +{ + // notice that we can't do something like this: + // + // m_time % MILLISECONDS_PER_DAY == dt.m_time % MILLISECONDS_PER_DAY + // + // because we have also to deal with (possibly) different DST settings! + Tm tm1 = GetTm(), + tm2 = dt.GetTm(); + + return tm1.hour == tm2.hour && + tm1.min == tm2.min && + tm1.sec == tm2.sec && + tm1.msec == tm2.msec; +} + +inline bool wxDateTime::IsEqualUpTo(const wxDateTime& dt, + const wxTimeSpan& ts) const +{ + return IsBetween(dt.Subtract(ts), dt.Add(ts)); +} + +// ---------------------------------------------------------------------------- +// wxDateTime arithmetics +// ---------------------------------------------------------------------------- + +inline wxDateTime wxDateTime::Add(const wxTimeSpan& diff) const +{ + wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); + + return wxDateTime(m_time + diff.GetValue()); +} + +inline wxDateTime& wxDateTime::Add(const wxTimeSpan& diff) +{ + wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); + + m_time += diff.GetValue(); + + return *this; +} + +inline wxDateTime& wxDateTime::operator+=(const wxTimeSpan& diff) +{ + return Add(diff); +} + +inline wxDateTime wxDateTime::Subtract(const wxTimeSpan& diff) const +{ + wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); + + return wxDateTime(m_time - diff.GetValue()); +} + +inline wxDateTime& wxDateTime::Subtract(const wxTimeSpan& diff) +{ + wxASSERT_MSG( IsValid(), _T("invalid wxDateTime")); + + m_time -= diff.GetValue(); + + return *this; +} + +inline wxDateTime& wxDateTime::operator-=(const wxTimeSpan& diff) +{ + return Subtract(diff); +} + +inline wxTimeSpan wxDateTime::Subtract(const wxDateTime& datetime) const +{ + wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime")); + + return wxTimeSpan(GetValue() - datetime.GetValue()); +} + +inline wxDateTime wxDateTime::Add(const wxDateSpan& diff) const +{ + return wxDateTime(*this).Add(diff); +} + +inline wxDateTime& wxDateTime::Subtract(const wxDateSpan& diff) +{ + return Add(diff.Negate()); +} + +inline wxDateTime wxDateTime::Subtract(const wxDateSpan& diff) const +{ + return wxDateTime(*this).Subtract(diff); +} + +inline wxDateTime& wxDateTime::operator-=(const wxDateSpan& diff) +{ + return Subtract(diff); +} + +inline wxDateTime& wxDateTime::operator+=(const wxDateSpan& diff) +{ + return Add(diff); +} + +// ---------------------------------------------------------------------------- +// wxDateTime and timezones +// ---------------------------------------------------------------------------- + +inline wxDateTime wxDateTime::ToTimezone(const wxDateTime::TimeZone& tz, + bool noDST) const +{ + MODIFY_AND_RETURN( MakeTimezone(tz, noDST) ); +} + +// ---------------------------------------------------------------------------- +// wxTimeSpan construction +// ---------------------------------------------------------------------------- + +inline wxTimeSpan::wxTimeSpan(long hours, + long minutes, + long seconds, + long milliseconds) +{ + // assign first to avoid precision loss + m_diff = hours; + m_diff *= 60l; + m_diff += minutes; + m_diff *= 60l; + m_diff += seconds; + m_diff *= 1000l; + m_diff += milliseconds; +} + +// ---------------------------------------------------------------------------- +// wxTimeSpan accessors +// ---------------------------------------------------------------------------- + +inline wxLongLong wxTimeSpan::GetSeconds() const +{ + return m_diff / 1000l; +} + +inline int wxTimeSpan::GetMinutes() const +{ + return (GetSeconds() / 60l).GetLo(); +} + +inline int wxTimeSpan::GetHours() const +{ + return GetMinutes() / 60; +} + +inline int wxTimeSpan::GetDays() const +{ + return GetHours() / 24; +} + +inline int wxTimeSpan::GetWeeks() const +{ + return GetDays() / 7; +} + +// ---------------------------------------------------------------------------- +// wxTimeSpan arithmetics +// ---------------------------------------------------------------------------- + +inline wxTimeSpan wxTimeSpan::Add(const wxTimeSpan& diff) const +{ + return wxTimeSpan(m_diff + diff.GetValue()); +} + +inline wxTimeSpan& wxTimeSpan::Add(const wxTimeSpan& diff) +{ + m_diff += diff.GetValue(); + + return *this; +} + +inline wxTimeSpan wxTimeSpan::Subtract(const wxTimeSpan& diff) const +{ + return wxTimeSpan(m_diff - diff.GetValue()); +} + +inline wxTimeSpan& wxTimeSpan::Subtract(const wxTimeSpan& diff) +{ + m_diff -= diff.GetValue(); + + return *this; +} + +inline wxTimeSpan& wxTimeSpan::Multiply(int n) +{ + m_diff *= (long)n; + + return *this; +} + +inline wxTimeSpan wxTimeSpan::Multiply(int n) const +{ + return wxTimeSpan(m_diff * (long)n); +} + +inline wxTimeSpan wxTimeSpan::Abs() const +{ + return wxTimeSpan(GetValue().Abs()); +} + +inline bool wxTimeSpan::IsEqualTo(const wxTimeSpan& ts) const +{ + return GetValue() == ts.GetValue(); +} + +inline bool wxTimeSpan::IsLongerThan(const wxTimeSpan& ts) const +{ + return GetValue().Abs() > ts.GetValue().Abs(); +} + +// ---------------------------------------------------------------------------- +// wxDateSpan +// ---------------------------------------------------------------------------- + +inline wxDateSpan& wxDateSpan::operator+=(const wxDateSpan& other) +{ + m_years += other.m_years; + m_months += other.m_months; + m_weeks += other.m_weeks; + m_days += other.m_days; + + return *this; +} + +inline wxDateSpan& wxDateSpan::Add(const wxDateSpan& other) +{ + return *this += other; +} + +inline wxDateSpan wxDateSpan::Add(const wxDateSpan& other) const +{ + wxDateSpan ds(*this); + ds.Add(other); + return ds; +} + +inline wxDateSpan& wxDateSpan::Multiply(int factor) +{ + m_years *= factor; + m_months *= factor; + m_weeks *= factor; + m_days *= factor; + + return *this; +} + +inline wxDateSpan wxDateSpan::Multiply(int factor) const +{ + wxDateSpan ds(*this); + ds.Multiply(factor); + return ds; +} + +inline wxDateSpan wxDateSpan::Negate() const +{ + return wxDateSpan(-m_years, -m_months, -m_weeks, -m_days); +} + +inline wxDateSpan& wxDateSpan::Neg() +{ + m_years = -m_years; + m_months = -m_months; + m_weeks = -m_weeks; + m_days = -m_days; + + return *this; +} + +inline wxDateSpan& wxDateSpan::operator-=(const wxDateSpan& other) +{ + return *this += other.Negate(); +} + +inline wxDateSpan& wxDateSpan::Subtract(const wxDateSpan& other) +{ + return *this -= other; +} + +inline wxDateSpan wxDateSpan::Subtract(const wxDateSpan& other) const +{ + wxDateSpan ds(*this); + ds.Subtract(other); + return ds; +} + +#undef MILLISECONDS_PER_DAY + +#undef MODIFY_AND_RETURN + // ============================================================================ // binary operators // ============================================================================ @@ -1389,31 +1889,31 @@ protected: // no need to check for validity - the member functions we call will do it -inline wxDateTime WXDLLEXPORT operator+(const wxDateTime& dt, +inline wxDateTime WXDLLIMPEXP_BASE operator+(const wxDateTime& dt, const wxTimeSpan& ts) { return dt.Add(ts); } -inline wxDateTime WXDLLEXPORT operator-(const wxDateTime& dt, +inline wxDateTime WXDLLIMPEXP_BASE operator-(const wxDateTime& dt, const wxTimeSpan& ts) { return dt.Subtract(ts); } -inline wxDateTime WXDLLEXPORT operator+(const wxDateTime& dt, +inline wxDateTime WXDLLIMPEXP_BASE operator+(const wxDateTime& dt, const wxDateSpan& ds) { return dt.Add(ds); } -inline wxDateTime WXDLLEXPORT operator-(const wxDateTime& dt, +inline wxDateTime WXDLLIMPEXP_BASE operator-(const wxDateTime& dt, const wxDateSpan& ds) { return dt.Subtract(ds); } -inline wxTimeSpan WXDLLEXPORT operator-(const wxDateTime& dt1, +inline wxTimeSpan WXDLLIMPEXP_BASE operator-(const wxDateTime& dt1, const wxDateTime& dt2) { return dt1.Subtract(dt2); @@ -1422,42 +1922,42 @@ inline wxTimeSpan WXDLLEXPORT operator-(const wxDateTime& dt1, // comparison // ---------- -inline bool WXDLLEXPORT operator<(const wxDateTime& t1, const wxDateTime& t2) +inline bool WXDLLIMPEXP_BASE operator<(const wxDateTime& t1, const wxDateTime& t2) { wxASSERT_MSG( t1.IsValid() && t2.IsValid(), _T("invalid wxDateTime") ); return t1.GetValue() < t2.GetValue(); } -inline bool WXDLLEXPORT operator<=(const wxDateTime& t1, const wxDateTime& t2) +inline bool WXDLLIMPEXP_BASE operator<=(const wxDateTime& t1, const wxDateTime& t2) { wxASSERT_MSG( t1.IsValid() && t2.IsValid(), _T("invalid wxDateTime") ); return t1.GetValue() <= t2.GetValue(); } -inline bool WXDLLEXPORT operator>(const wxDateTime& t1, const wxDateTime& t2) +inline bool WXDLLIMPEXP_BASE operator>(const wxDateTime& t1, const wxDateTime& t2) { wxASSERT_MSG( t1.IsValid() && t2.IsValid(), _T("invalid wxDateTime") ); return t1.GetValue() > t2.GetValue(); } -inline bool WXDLLEXPORT operator>=(const wxDateTime& t1, const wxDateTime& t2) +inline bool WXDLLIMPEXP_BASE operator>=(const wxDateTime& t1, const wxDateTime& t2) { wxASSERT_MSG( t1.IsValid() && t2.IsValid(), _T("invalid wxDateTime") ); return t1.GetValue() >= t2.GetValue(); } -inline bool WXDLLEXPORT operator==(const wxDateTime& t1, const wxDateTime& t2) +inline bool WXDLLIMPEXP_BASE operator==(const wxDateTime& t1, const wxDateTime& t2) { wxASSERT_MSG( t1.IsValid() && t2.IsValid(), _T("invalid wxDateTime") ); return t1.GetValue() == t2.GetValue(); } -inline bool WXDLLEXPORT operator!=(const wxDateTime& t1, const wxDateTime& t2) +inline bool WXDLLIMPEXP_BASE operator!=(const wxDateTime& t1, const wxDateTime& t2) { wxASSERT_MSG( t1.IsValid() && t2.IsValid(), _T("invalid wxDateTime") ); @@ -1471,24 +1971,24 @@ inline bool WXDLLEXPORT operator!=(const wxDateTime& t1, const wxDateTime& t2) // arithmetics // ----------- -inline wxTimeSpan WXDLLEXPORT operator+(const wxTimeSpan& ts1, +inline wxTimeSpan WXDLLIMPEXP_BASE operator+(const wxTimeSpan& ts1, const wxTimeSpan& ts2) { return wxTimeSpan(ts1.GetValue() + ts2.GetValue()); } -inline wxTimeSpan WXDLLEXPORT operator-(const wxTimeSpan& ts1, +inline wxTimeSpan WXDLLIMPEXP_BASE operator-(const wxTimeSpan& ts1, const wxTimeSpan& ts2) { return wxTimeSpan(ts1.GetValue() - ts2.GetValue()); } -inline wxTimeSpan WXDLLEXPORT operator*(const wxTimeSpan& ts, int n) +inline wxTimeSpan WXDLLIMPEXP_BASE operator*(const wxTimeSpan& ts, int n) { return wxTimeSpan(ts).Multiply(n); } -inline wxTimeSpan WXDLLEXPORT operator*(int n, const wxTimeSpan& ts) +inline wxTimeSpan WXDLLIMPEXP_BASE operator*(int n, const wxTimeSpan& ts) { return wxTimeSpan(ts).Multiply(n); } @@ -1496,32 +1996,32 @@ inline wxTimeSpan WXDLLEXPORT operator*(int n, const wxTimeSpan& ts) // comparison // ---------- -inline bool WXDLLEXPORT operator<(const wxTimeSpan &t1, const wxTimeSpan &t2) +inline bool WXDLLIMPEXP_BASE operator<(const wxTimeSpan &t1, const wxTimeSpan &t2) { return t1.GetValue() < t2.GetValue(); } -inline bool WXDLLEXPORT operator<=(const wxTimeSpan &t1, const wxTimeSpan &t2) +inline bool WXDLLIMPEXP_BASE operator<=(const wxTimeSpan &t1, const wxTimeSpan &t2) { return t1.GetValue() <= t2.GetValue(); } -inline bool WXDLLEXPORT operator>(const wxTimeSpan &t1, const wxTimeSpan &t2) +inline bool WXDLLIMPEXP_BASE operator>(const wxTimeSpan &t1, const wxTimeSpan &t2) { return t1.GetValue() > t2.GetValue(); } -inline bool WXDLLEXPORT operator>=(const wxTimeSpan &t1, const wxTimeSpan &t2) +inline bool WXDLLIMPEXP_BASE operator>=(const wxTimeSpan &t1, const wxTimeSpan &t2) { return t1.GetValue() >= t2.GetValue(); } -inline bool WXDLLEXPORT operator==(const wxTimeSpan &t1, const wxTimeSpan &t2) +inline bool WXDLLIMPEXP_BASE operator==(const wxTimeSpan &t1, const wxTimeSpan &t2) { return t1.GetValue() == t2.GetValue(); } -inline bool WXDLLEXPORT operator!=(const wxTimeSpan &t1, const wxTimeSpan &t2) +inline bool WXDLLIMPEXP_BASE operator!=(const wxTimeSpan &t1, const wxTimeSpan &t2) { return t1.GetValue() != t2.GetValue(); } @@ -1534,7 +2034,7 @@ inline bool WXDLLEXPORT operator!=(const wxTimeSpan &t1, const wxTimeSpan &t2) // ---------- // ds1 == d2 if and only if for every wxDateTime t t + ds1 == t + ds2 -inline WXDLLEXPORT bool operator==(const wxDateSpan& ds1, +inline WXDLLIMPEXP_BASE bool operator==(const wxDateSpan& ds1, const wxDateSpan& ds2) { return ds1.GetYears() == ds2.GetYears() && @@ -1542,7 +2042,7 @@ inline WXDLLEXPORT bool operator==(const wxDateSpan& ds1, ds1.GetTotalDays() == ds2.GetTotalDays(); } -inline WXDLLEXPORT bool operator!=(const wxDateSpan& ds1, +inline WXDLLIMPEXP_BASE bool operator!=(const wxDateSpan& ds1, const wxDateSpan& ds2) { return !(ds1 == ds2); @@ -1551,7 +2051,7 @@ inline WXDLLEXPORT bool operator!=(const wxDateSpan& ds1, // arithmetics // ----------- -inline WXDLLEXPORT wxDateSpan operator+(const wxDateSpan& ds1, +inline WXDLLIMPEXP_BASE wxDateSpan operator+(const wxDateSpan& ds1, const wxDateSpan& ds2) { return wxDateSpan(ds1.GetYears() + ds2.GetYears(), @@ -1560,7 +2060,7 @@ inline WXDLLEXPORT wxDateSpan operator+(const wxDateSpan& ds1, ds1.GetDays() + ds2.GetDays()); } -inline WXDLLEXPORT wxDateSpan operator-(const wxDateSpan& ds1, +inline WXDLLIMPEXP_BASE wxDateSpan operator-(const wxDateSpan& ds1, const wxDateSpan& ds2) { return wxDateSpan(ds1.GetYears() - ds2.GetYears(), @@ -1569,12 +2069,12 @@ inline WXDLLEXPORT wxDateSpan operator-(const wxDateSpan& ds1, ds1.GetDays() - ds2.GetDays()); } -inline WXDLLEXPORT wxDateSpan operator*(const wxDateSpan& ds, int n) +inline WXDLLIMPEXP_BASE wxDateSpan operator*(const wxDateSpan& ds, int n) { return wxDateSpan(ds).Multiply(n); } -inline WXDLLEXPORT wxDateSpan operator*(int n, const wxDateSpan& ds) +inline WXDLLIMPEXP_BASE wxDateSpan operator*(int n, const wxDateSpan& ds) { return wxDateSpan(ds).Multiply(n); } @@ -1589,7 +2089,7 @@ inline WXDLLEXPORT wxDateSpan operator*(int n, const wxDateSpan& ds) // for ( m = wxDateTime::Jan; m < wxDateTime::Inv_Month; wxNextMonth(m) ) // ---------------------------------------------------------------------------- -inline WXDLLEXPORT void wxNextMonth(wxDateTime::Month& m) +inline WXDLLIMPEXP_BASE void wxNextMonth(wxDateTime::Month& m) { wxASSERT_MSG( m < wxDateTime::Inv_Month, _T("invalid month") ); @@ -1597,7 +2097,7 @@ inline WXDLLEXPORT void wxNextMonth(wxDateTime::Month& m) m = (wxDateTime::Month)(m + 1); } -inline WXDLLEXPORT void wxPrevMonth(wxDateTime::Month& m) +inline WXDLLIMPEXP_BASE void wxPrevMonth(wxDateTime::Month& m) { wxASSERT_MSG( m < wxDateTime::Inv_Month, _T("invalid month") ); @@ -1605,7 +2105,7 @@ inline WXDLLEXPORT void wxPrevMonth(wxDateTime::Month& m) : (wxDateTime::Month)(m - 1); } -inline WXDLLEXPORT void wxNextWDay(wxDateTime::WeekDay& wd) +inline WXDLLIMPEXP_BASE void wxNextWDay(wxDateTime::WeekDay& wd) { wxASSERT_MSG( wd < wxDateTime::Inv_WeekDay, _T("invalid week day") ); @@ -1613,7 +2113,7 @@ inline WXDLLEXPORT void wxNextWDay(wxDateTime::WeekDay& wd) wd = (wxDateTime::WeekDay)(wd + 1); } -inline WXDLLEXPORT void wxPrevWDay(wxDateTime::WeekDay& wd) +inline WXDLLIMPEXP_BASE void wxPrevWDay(wxDateTime::WeekDay& wd) { wxASSERT_MSG( wd < wxDateTime::Inv_WeekDay, _T("invalid week day") );