merged 2.2 branch
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7748 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -40,19 +40,19 @@
|
||||
const long wxDateTime::TIME_T_FACTOR = 1000l;
|
||||
#endif // wxDEFINE_TIME_CONSTANTS
|
||||
|
||||
WXDLLEXPORT bool wxDateTime::IsInStdRange() const
|
||||
inline bool wxDateTime::IsInStdRange() const
|
||||
{
|
||||
return m_time >= 0l && (m_time / TIME_T_FACTOR) < LONG_MAX;
|
||||
}
|
||||
|
||||
/* static */
|
||||
WXDLLEXPORT wxDateTime wxDateTime::Now()
|
||||
inline wxDateTime wxDateTime::Now()
|
||||
{
|
||||
return wxDateTime(*GetTmNow());
|
||||
}
|
||||
|
||||
/* static */
|
||||
WXDLLEXPORT wxDateTime wxDateTime::Today()
|
||||
inline wxDateTime wxDateTime::Today()
|
||||
{
|
||||
struct tm *tm = GetTmNow();
|
||||
tm->tm_hour =
|
||||
@@ -63,7 +63,7 @@ WXDLLEXPORT wxDateTime wxDateTime::Today()
|
||||
}
|
||||
|
||||
#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
|
||||
WXDLLEXPORT wxDateTime& wxDateTime::Set(time_t timet)
|
||||
inline wxDateTime& wxDateTime::Set(time_t timet)
|
||||
{
|
||||
// assign first to avoid long multiplication overflow!
|
||||
m_time = timet;
|
||||
@@ -73,56 +73,56 @@ WXDLLEXPORT wxDateTime& wxDateTime::Set(time_t timet)
|
||||
}
|
||||
#endif
|
||||
|
||||
WXDLLEXPORT wxDateTime& wxDateTime::SetToCurrent()
|
||||
inline wxDateTime& wxDateTime::SetToCurrent()
|
||||
{
|
||||
*this = Now();
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
|
||||
WXDLLEXPORT wxDateTime::wxDateTime(time_t timet)
|
||||
inline wxDateTime::wxDateTime(time_t timet)
|
||||
{
|
||||
Set(timet);
|
||||
}
|
||||
#endif
|
||||
|
||||
WXDLLEXPORT wxDateTime::wxDateTime(const struct tm& tm)
|
||||
inline wxDateTime::wxDateTime(const struct tm& tm)
|
||||
{
|
||||
Set(tm);
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateTime::wxDateTime(const Tm& tm)
|
||||
inline wxDateTime::wxDateTime(const Tm& tm)
|
||||
{
|
||||
Set(tm);
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateTime::wxDateTime(double jdn)
|
||||
inline wxDateTime::wxDateTime(double jdn)
|
||||
{
|
||||
Set(jdn);
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateTime& wxDateTime::Set(const Tm& tm)
|
||||
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);
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateTime::wxDateTime(wxDateTime_t hour,
|
||||
wxDateTime_t minute,
|
||||
wxDateTime_t second,
|
||||
wxDateTime_t millisec)
|
||||
inline wxDateTime::wxDateTime(wxDateTime_t hour,
|
||||
wxDateTime_t minute,
|
||||
wxDateTime_t second,
|
||||
wxDateTime_t millisec)
|
||||
{
|
||||
Set(hour, minute, second, millisec);
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateTime::wxDateTime(wxDateTime_t day,
|
||||
Month month,
|
||||
int year,
|
||||
wxDateTime_t hour,
|
||||
wxDateTime_t minute,
|
||||
wxDateTime_t second,
|
||||
wxDateTime_t 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);
|
||||
}
|
||||
@@ -131,14 +131,14 @@ WXDLLEXPORT wxDateTime::wxDateTime(wxDateTime_t day,
|
||||
// wxDateTime accessors
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT wxLongLong wxDateTime::GetValue() const
|
||||
inline wxLongLong wxDateTime::GetValue() const
|
||||
{
|
||||
wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
|
||||
|
||||
return m_time;
|
||||
}
|
||||
|
||||
WXDLLEXPORT time_t wxDateTime::GetTicks() const
|
||||
inline time_t wxDateTime::GetTicks() const
|
||||
{
|
||||
wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
|
||||
if ( !IsInStdRange() )
|
||||
@@ -149,60 +149,61 @@ WXDLLEXPORT time_t wxDateTime::GetTicks() const
|
||||
return (time_t)((m_time / (long)TIME_T_FACTOR).GetLo());
|
||||
}
|
||||
|
||||
WXDLLEXPORT bool wxDateTime::SetToLastWeekDay(WeekDay weekday,
|
||||
Month month,
|
||||
int year)
|
||||
inline bool wxDateTime::SetToLastWeekDay(WeekDay weekday,
|
||||
Month month,
|
||||
int year)
|
||||
{
|
||||
return SetToWeekDay(weekday, -1, month, year);
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateTime wxDateTime::GetWeekDayInSameWeek(WeekDay weekday) const
|
||||
inline wxDateTime wxDateTime::GetWeekDayInSameWeek(WeekDay weekday) const
|
||||
{
|
||||
MODIFY_AND_RETURN( SetToWeekDayInSameWeek(weekday) );
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateTime wxDateTime::GetNextWeekDay(WeekDay weekday) const
|
||||
inline wxDateTime wxDateTime::GetNextWeekDay(WeekDay weekday) const
|
||||
{
|
||||
MODIFY_AND_RETURN( SetToNextWeekDay(weekday) );
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateTime wxDateTime::GetPrevWeekDay(WeekDay weekday) const
|
||||
inline wxDateTime wxDateTime::GetPrevWeekDay(WeekDay weekday) const
|
||||
{
|
||||
MODIFY_AND_RETURN( SetToPrevWeekDay(weekday) );
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateTime wxDateTime::GetWeekDay(WeekDay weekday,
|
||||
int n,
|
||||
Month month,
|
||||
int year) const
|
||||
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;
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateTime wxDateTime::GetLastWeekDay(WeekDay weekday,
|
||||
Month month,
|
||||
int year)
|
||||
inline wxDateTime wxDateTime::GetLastWeekDay(WeekDay weekday,
|
||||
Month month,
|
||||
int year)
|
||||
{
|
||||
wxDateTime dt(*this);
|
||||
|
||||
return dt.SetToLastWeekDay(weekday, month, year) ? dt : wxInvalidDateTime;
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateTime wxDateTime::GetWeek(wxDateTime_t numWeek, WeekDay weekday) const
|
||||
inline wxDateTime wxDateTime::GetWeek(wxDateTime_t numWeek,
|
||||
WeekDay weekday) const
|
||||
{
|
||||
wxDateTime dt(*this);
|
||||
|
||||
return dt.SetToTheWeek(numWeek, weekday) ? dt : wxInvalidDateTime;
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateTime wxDateTime::GetLastMonthDay(Month month, int year) const
|
||||
inline wxDateTime wxDateTime::GetLastMonthDay(Month month, int year) const
|
||||
{
|
||||
MODIFY_AND_RETURN( SetToLastMonthDay(month, year) );
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateTime wxDateTime::GetYearDay(wxDateTime_t yday) const
|
||||
inline wxDateTime wxDateTime::GetYearDay(wxDateTime_t yday) const
|
||||
{
|
||||
MODIFY_AND_RETURN( SetToYearDay(yday) );
|
||||
}
|
||||
@@ -211,46 +212,47 @@ WXDLLEXPORT wxDateTime wxDateTime::GetYearDay(wxDateTime_t yday) const
|
||||
// wxDateTime comparison
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT bool wxDateTime::IsEqualTo(const wxDateTime& datetime) const
|
||||
inline bool wxDateTime::IsEqualTo(const wxDateTime& datetime) const
|
||||
{
|
||||
wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime"));
|
||||
|
||||
return m_time == datetime.m_time;
|
||||
}
|
||||
|
||||
WXDLLEXPORT bool wxDateTime::IsEarlierThan(const wxDateTime& datetime) const
|
||||
inline bool wxDateTime::IsEarlierThan(const wxDateTime& datetime) const
|
||||
{
|
||||
wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime"));
|
||||
|
||||
return m_time < datetime.m_time;
|
||||
}
|
||||
|
||||
WXDLLEXPORT bool wxDateTime::IsLaterThan(const wxDateTime& datetime) const
|
||||
inline bool wxDateTime::IsLaterThan(const wxDateTime& datetime) const
|
||||
{
|
||||
wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime"));
|
||||
|
||||
return m_time > datetime.m_time;
|
||||
}
|
||||
|
||||
WXDLLEXPORT bool wxDateTime::IsStrictlyBetween(const wxDateTime& t1,
|
||||
const wxDateTime& t2) const
|
||||
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);
|
||||
}
|
||||
|
||||
WXDLLEXPORT bool wxDateTime::IsBetween(const wxDateTime& t1, const wxDateTime& t2) const
|
||||
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);
|
||||
}
|
||||
|
||||
WXDLLEXPORT bool wxDateTime::IsSameDate(const wxDateTime& dt) const
|
||||
inline bool wxDateTime::IsSameDate(const wxDateTime& dt) const
|
||||
{
|
||||
return (m_time - dt.m_time).Abs() < MILLISECONDS_PER_DAY;
|
||||
}
|
||||
|
||||
WXDLLEXPORT bool wxDateTime::IsSameTime(const wxDateTime& dt) const
|
||||
inline bool wxDateTime::IsSameTime(const wxDateTime& dt) const
|
||||
{
|
||||
// notice that we can't do something like this:
|
||||
//
|
||||
@@ -266,23 +268,24 @@ WXDLLEXPORT bool wxDateTime::IsSameTime(const wxDateTime& dt) const
|
||||
tm1.msec == tm2.msec;
|
||||
}
|
||||
|
||||
WXDLLEXPORT bool wxDateTime::IsEqualUpTo(const wxDateTime& dt, const wxTimeSpan& ts) const
|
||||
inline bool wxDateTime::IsEqualUpTo(const wxDateTime& dt,
|
||||
const wxTimeSpan& ts) const
|
||||
{
|
||||
return IsBetween(dt.Substract(ts), dt.Add(ts));
|
||||
return IsBetween(dt.Subtract(ts), dt.Add(ts));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDateTime arithmetics
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT wxDateTime wxDateTime::Add(const wxTimeSpan& diff) const
|
||||
inline wxDateTime wxDateTime::Add(const wxTimeSpan& diff) const
|
||||
{
|
||||
wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
|
||||
|
||||
return wxDateTime(m_time + diff.GetValue());
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateTime& wxDateTime::Add(const wxTimeSpan& diff)
|
||||
inline wxDateTime& wxDateTime::Add(const wxTimeSpan& diff)
|
||||
{
|
||||
wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
|
||||
|
||||
@@ -291,19 +294,19 @@ WXDLLEXPORT wxDateTime& wxDateTime::Add(const wxTimeSpan& diff)
|
||||
return *this;
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateTime& wxDateTime::operator+=(const wxTimeSpan& diff)
|
||||
inline wxDateTime& wxDateTime::operator+=(const wxTimeSpan& diff)
|
||||
{
|
||||
return Add(diff);
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateTime wxDateTime::Substract(const wxTimeSpan& diff) const
|
||||
inline wxDateTime wxDateTime::Subtract(const wxTimeSpan& diff) const
|
||||
{
|
||||
wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
|
||||
|
||||
return wxDateTime(m_time - diff.GetValue());
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateTime& wxDateTime::Substract(const wxTimeSpan& diff)
|
||||
inline wxDateTime& wxDateTime::Subtract(const wxTimeSpan& diff)
|
||||
{
|
||||
wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
|
||||
|
||||
@@ -312,39 +315,39 @@ WXDLLEXPORT wxDateTime& wxDateTime::Substract(const wxTimeSpan& diff)
|
||||
return *this;
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateTime& wxDateTime::operator-=(const wxTimeSpan& diff)
|
||||
inline wxDateTime& wxDateTime::operator-=(const wxTimeSpan& diff)
|
||||
{
|
||||
return Substract(diff);
|
||||
return Subtract(diff);
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxTimeSpan wxDateTime::Substract(const wxDateTime& datetime) const
|
||||
inline wxTimeSpan wxDateTime::Subtract(const wxDateTime& datetime) const
|
||||
{
|
||||
wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime"));
|
||||
|
||||
return wxTimeSpan(datetime.GetValue() - GetValue());
|
||||
return wxTimeSpan(GetValue() - datetime.GetValue());
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateTime wxDateTime::Add(const wxDateSpan& diff) const
|
||||
inline wxDateTime wxDateTime::Add(const wxDateSpan& diff) const
|
||||
{
|
||||
return wxDateTime(*this).Add(diff);
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateTime& wxDateTime::Substract(const wxDateSpan& diff)
|
||||
inline wxDateTime& wxDateTime::Subtract(const wxDateSpan& diff)
|
||||
{
|
||||
return Add(diff.Negate());
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateTime wxDateTime::Substract(const wxDateSpan& diff) const
|
||||
inline wxDateTime wxDateTime::Subtract(const wxDateSpan& diff) const
|
||||
{
|
||||
return wxDateTime(*this).Substract(diff);
|
||||
return wxDateTime(*this).Subtract(diff);
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateTime& wxDateTime::operator-=(const wxDateSpan& diff)
|
||||
inline wxDateTime& wxDateTime::operator-=(const wxDateSpan& diff)
|
||||
{
|
||||
return Substract(diff);
|
||||
return Subtract(diff);
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateTime& wxDateTime::operator+=(const wxDateSpan& diff)
|
||||
inline wxDateTime& wxDateTime::operator+=(const wxDateSpan& diff)
|
||||
{
|
||||
return Add(diff);
|
||||
}
|
||||
@@ -353,8 +356,8 @@ WXDLLEXPORT wxDateTime& wxDateTime::operator+=(const wxDateSpan& diff)
|
||||
// wxDateTime and timezones
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT wxDateTime wxDateTime::ToTimezone(const wxDateTime::TimeZone& tz,
|
||||
bool noDST) const
|
||||
inline wxDateTime wxDateTime::ToTimezone(const wxDateTime::TimeZone& tz,
|
||||
bool noDST) const
|
||||
{
|
||||
MODIFY_AND_RETURN( MakeTimezone(tz, noDST) );
|
||||
}
|
||||
@@ -363,7 +366,10 @@ WXDLLEXPORT wxDateTime wxDateTime::ToTimezone(const wxDateTime::TimeZone& tz,
|
||||
// wxTimeSpan construction
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT wxTimeSpan::wxTimeSpan(long hours, long minutes, long seconds, long milliseconds)
|
||||
inline wxTimeSpan::wxTimeSpan(long hours,
|
||||
long minutes,
|
||||
long seconds,
|
||||
long milliseconds)
|
||||
{
|
||||
// assign first to avoid precision loss
|
||||
m_diff = hours;
|
||||
@@ -379,27 +385,27 @@ WXDLLEXPORT wxTimeSpan::wxTimeSpan(long hours, long minutes, long seconds, long
|
||||
// wxTimeSpan accessors
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT wxLongLong wxTimeSpan::GetSeconds() const
|
||||
inline wxLongLong wxTimeSpan::GetSeconds() const
|
||||
{
|
||||
return m_diff / 1000l;
|
||||
}
|
||||
|
||||
WXDLLEXPORT int wxTimeSpan::GetMinutes() const
|
||||
inline int wxTimeSpan::GetMinutes() const
|
||||
{
|
||||
return (GetSeconds() / 60l).GetLo();
|
||||
}
|
||||
|
||||
WXDLLEXPORT int wxTimeSpan::GetHours() const
|
||||
inline int wxTimeSpan::GetHours() const
|
||||
{
|
||||
return GetMinutes() / 60;
|
||||
}
|
||||
|
||||
WXDLLEXPORT int wxTimeSpan::GetDays() const
|
||||
inline int wxTimeSpan::GetDays() const
|
||||
{
|
||||
return GetHours() / 24;
|
||||
}
|
||||
|
||||
WXDLLEXPORT int wxTimeSpan::GetWeeks() const
|
||||
inline int wxTimeSpan::GetWeeks() const
|
||||
{
|
||||
return GetDays() / 7;
|
||||
}
|
||||
@@ -408,53 +414,53 @@ WXDLLEXPORT int wxTimeSpan::GetWeeks() const
|
||||
// wxTimeSpan arithmetics
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT wxTimeSpan wxTimeSpan::Add(const wxTimeSpan& diff) const
|
||||
inline wxTimeSpan wxTimeSpan::Add(const wxTimeSpan& diff) const
|
||||
{
|
||||
return wxTimeSpan(m_diff + diff.GetValue());
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxTimeSpan& wxTimeSpan::Add(const wxTimeSpan& diff)
|
||||
inline wxTimeSpan& wxTimeSpan::Add(const wxTimeSpan& diff)
|
||||
{
|
||||
m_diff += diff.GetValue();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxTimeSpan wxTimeSpan::Substract(const wxTimeSpan& diff) const
|
||||
inline wxTimeSpan wxTimeSpan::Subtract(const wxTimeSpan& diff) const
|
||||
{
|
||||
return wxTimeSpan(m_diff - diff.GetValue());
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxTimeSpan& wxTimeSpan::Substract(const wxTimeSpan& diff)
|
||||
inline wxTimeSpan& wxTimeSpan::Subtract(const wxTimeSpan& diff)
|
||||
{
|
||||
m_diff -= diff.GetValue();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxTimeSpan& wxTimeSpan::Multiply(int n)
|
||||
inline wxTimeSpan& wxTimeSpan::Multiply(int n)
|
||||
{
|
||||
m_diff *= (long)n;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxTimeSpan wxTimeSpan::Multiply(int n) const
|
||||
inline wxTimeSpan wxTimeSpan::Multiply(int n) const
|
||||
{
|
||||
return wxTimeSpan(m_diff * (long)n);
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxTimeSpan wxTimeSpan::Abs() const
|
||||
inline wxTimeSpan wxTimeSpan::Abs() const
|
||||
{
|
||||
return wxTimeSpan(GetValue().Abs());
|
||||
}
|
||||
|
||||
WXDLLEXPORT bool wxTimeSpan::IsEqualTo(const wxTimeSpan& ts) const
|
||||
inline bool wxTimeSpan::IsEqualTo(const wxTimeSpan& ts) const
|
||||
{
|
||||
return GetValue() == ts.GetValue();
|
||||
}
|
||||
|
||||
WXDLLEXPORT bool wxTimeSpan::IsLongerThan(const wxTimeSpan& ts) const
|
||||
inline bool wxTimeSpan::IsLongerThan(const wxTimeSpan& ts) const
|
||||
{
|
||||
return GetValue().Abs() > ts.GetValue().Abs();
|
||||
}
|
||||
@@ -463,8 +469,7 @@ WXDLLEXPORT bool wxTimeSpan::IsLongerThan(const wxTimeSpan& ts) const
|
||||
// wxDateSpan
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT wxDateSpan&
|
||||
wxDateSpan::operator+=(const wxDateSpan& other)
|
||||
inline wxDateSpan& wxDateSpan::operator+=(const wxDateSpan& other)
|
||||
{
|
||||
m_years += other.m_years;
|
||||
m_months += other.m_months;
|
||||
@@ -474,7 +479,19 @@ wxDateSpan::operator+=(const wxDateSpan& other)
|
||||
return *this;
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateSpan& wxDateSpan::Multiply(int factor)
|
||||
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;
|
||||
@@ -484,17 +501,19 @@ WXDLLEXPORT wxDateSpan& wxDateSpan::Multiply(int factor)
|
||||
return *this;
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateSpan wxDateSpan::Multiply(int factor) const
|
||||
inline wxDateSpan wxDateSpan::Multiply(int factor) const
|
||||
{
|
||||
return wxDateSpan(*this).Multiply(factor);
|
||||
wxDateSpan ds(*this);
|
||||
ds.Multiply(factor);
|
||||
return ds;
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateSpan wxDateSpan::Negate() const
|
||||
inline wxDateSpan wxDateSpan::Negate() const
|
||||
{
|
||||
return wxDateSpan(-m_years, -m_months, -m_weeks, -m_days);
|
||||
}
|
||||
|
||||
WXDLLEXPORT wxDateSpan& wxDateSpan::Neg()
|
||||
inline wxDateSpan& wxDateSpan::Neg()
|
||||
{
|
||||
m_years = -m_years;
|
||||
m_months = -m_months;
|
||||
@@ -504,6 +523,23 @@ WXDLLEXPORT wxDateSpan& wxDateSpan::Neg()
|
||||
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
|
||||
|
Reference in New Issue
Block a user