From 9aa2e298aefd0c37719127a7078d313c488cf849 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 14 Oct 2009 17:00:28 +0000 Subject: [PATCH] Fixes to comparison operators for wxDVC classes. Comparison operators for wxDataViewItem and wxDataViewIconText were not inline and not exported, resulting in linking errors for any code using them in shared wx build. Fix this by making them inline. Also correct wxDataViewIconText operator==() implementation to compare icons as well and to return true when comparing the object with itself. Finally add operator!=() matching existing operator==() as a class having one of these operators is supposed to have the other one as well and it costs nothing to define it. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62401 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/dataview.h | 25 +++++++++++++++++++++++-- src/common/datavcmn.cpp | 13 ------------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/include/wx/dataview.h b/include/wx/dataview.h index 29c1f55d00..9c6205d95e 100644 --- a/include/wx/dataview.h +++ b/include/wx/dataview.h @@ -85,7 +85,17 @@ private: void* m_id; }; -bool operator == (const wxDataViewItem &left, const wxDataViewItem &right); +inline +bool operator==(const wxDataViewItem& left, const wxDataViewItem& right) +{ + return left.GetID() == right.GetID(); +} + +inline +bool operator!=(const wxDataViewItem& left, const wxDataViewItem& right) +{ + return !(left == right); +} WX_DEFINE_ARRAY(wxDataViewItem, wxDataViewItemArray); @@ -482,7 +492,18 @@ private: DECLARE_DYNAMIC_CLASS(wxDataViewIconText) }; -bool operator == (const wxDataViewIconText &one, const wxDataViewIconText &two); +inline +bool operator==(const wxDataViewIconText& left, const wxDataViewIconText& right) +{ + return left.GetText() == right.GetText() && + left.GetIcon().IsSameAs(right.GetIcon()); +} + +inline +bool operator!=(const wxDataViewIconText& left, const wxDataViewIconText& right) +{ + return !(left == right); +} DECLARE_VARIANT_OBJECT_EXPORTED(wxDataViewIconText, WXDLLIMPEXP_ADV) diff --git a/src/common/datavcmn.cpp b/src/common/datavcmn.cpp index 66982abf7a..fd3ccde0b8 100644 --- a/src/common/datavcmn.cpp +++ b/src/common/datavcmn.cpp @@ -32,12 +32,6 @@ const char wxDataViewCtrlNameStr[] = "dataviewCtrl"; - -bool operator == (const wxDataViewItem &left, const wxDataViewItem &right) -{ - return (left.GetID() == right.GetID() ); -} - // --------------------------------------------------------- // wxDataViewModelNotifier // --------------------------------------------------------- @@ -642,13 +636,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxDataViewIconText,wxObject) IMPLEMENT_VARIANT_OBJECT_EXPORTED(wxDataViewIconText, WXDLLIMPEXP_ADV) -bool operator == (const wxDataViewIconText &one, const wxDataViewIconText &two) -{ - if (one.GetText() != two.GetText()) return false; - if (one.IsSameAs(two)) return false; - return true; -} - // --------------------------------------------------------- // wxDataViewRendererBase // --------------------------------------------------------- -- 2.45.2