]> git.saurik.com Git - wxWidgets.git/commitdiff
added operator==() and !=() for wxDateSpan
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 2 Jan 2003 22:07:51 +0000 (22:07 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 2 Jan 2003 22:07:51 +0000 (22:07 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18515 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
include/wx/datetime.h

index 0219ad21acda902e1b6c9ab96c3571f20a5f9c0c..d28dee8508cbfca7098d90b7f5e5e87e6dbbae92 100644 (file)
@@ -11,6 +11,15 @@ OTHER CHANGES
 2.5.0
 -----
 
+All:
+
+- Implemented GetEditControl for wxGenericTreeCtrl (Peter Stieber)
+- Improved contrib/utils/convertrc parsing (David J. Cooke)
+- Fixed handling of URLs and filenames in wxFileSystem
+- Implemented alignment for wxGrid bool editor and renderer
+- Support wxListCtrl columns alignment for all platforms and not just MSW
+- Added wxDateSpan::operator==() and !=() (Lukasz Michalski)
+
 Unix:
 
 - fixed compilation on systems with zlib installed but < 1.1.3 version
@@ -28,14 +37,6 @@ wxMSW:
 - wxCheckListBox::Check() doesn't send CHECKLISTBOX_TOGGLE event any more
 - fixed bug with wxTR_EDIT_LABELS not workign with wxTR_MULTIPLE
 
-All:
-
-- Implemented GetEditControl for wxGenericTreeCtrl (Peter Stieber)
-- Improved contrib/utils/convertrc parsing (David J. Cooke)
-- Fixed handling of URLs and filenames in wxFileSystem
-- Implemented alignment for wxGrid bool editor and renderer
-- Support wxListCtrl columns alignment for all platforms and not just MSW
-
 OLD CHANGES
 ===========
 
index c546534b8152471624e9954a6c3e6ad37de43fc6..35a164dd3a5bed502e6999d38d1eea1262574663 100644 (file)
@@ -1178,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.
@@ -1524,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
 // -----------