]> git.saurik.com Git - wxWidgets.git/commitdiff
Change return type of wxList::Member() to bool.
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 18 Sep 2009 17:10:58 +0000 (17:10 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 18 Sep 2009 17:10:58 +0000 (17:10 +0000)
It used to return a pointer in wxUSE_STL==0 build and an object in
wxUSE_STL==1 one making checking its return value difficult without provoking
warnings from either MSVC or g++ (see #11038).

Also, all the other occurrences of Member() already returned bool, including
the one in wxStringList so changing it to return bool in wxList itself is more
consistent.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61966 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
include/wx/list.h
interface/wx/list.h
src/common/appbase.cpp

index 8e8ac5f3de19759d715e18f85f908689f882070c..8bcebd9415fc1caaca3a6a350c7797f251cb492f 100644 (file)
@@ -276,6 +276,11 @@ Changes in behaviour which may result in compilation errors
   without enclosing parentheses results in warnings from g++ with -Wparentheses,
   add parentheses around the if statement body to work around it.
 
+- wxList::Member() now returns book and not a pointer/iterator. This shouldn't
+  require any changes as it was always meant to be used for checking for the
+  presence of an element in the list only. If you used it as Find(), simple do
+  use Find() instead.
+
 
 Deprecated methods and their replacements
 -----------------------------------------
index 88913253ec23eae4738c6fdb6cc7062d3dcb2add..a84ee041bb9ed63357e60220e46eb01d05f6d4db 100644 (file)
@@ -258,7 +258,7 @@ inline const void *wxListCastElementToVoidPtr(const wxString& str)
             iterator i = const_cast< liT* >(this)->end();                     \
             return compatibility_iterator( this, !empty() ? --i : i );        \
         }                                                                     \
-        compatibility_iterator Member( elT e ) const                          \
+        bool Member( elT e ) const                                            \
             { return Find( e ); }                                             \
         compatibility_iterator Nth( int n ) const                             \
             { return Item( n ); }                                             \
@@ -1179,12 +1179,8 @@ public:
 
     // compatibility methods
     void Sort(wxSortCompareFunction compfunc) { wxListBase::Sort(compfunc); }
-#endif
-
-#if wxUSE_STL
-#else
-    wxNode *Member(wxObject *object) const { return (wxNode *)Find(object); }
-#endif
+    bool Member(wxObject *object) const { return Find(object) != NULL; }
+#endif // !wxUSE_STL
 };
 
 #if !wxUSE_STL
index bee1b9c1d065de66e3f305b9b720325d9802a733..cb925cde875688ef0d585736f6b5928b60e58b86 100644 (file)
@@ -209,9 +209,11 @@ public:
     wxList<T>::compatibility_iterator Item(size_t index) const;
 
     /**
-        @deprecated This function is deprecated, use Find() instead.
+        Check if the object is present in the list.
+
+        @see Find()
     */
-    wxList<T>::compatibility_iterator Member(T* object) const;
+    bool Member(T* object) const;
 
     /**
         @deprecated This function is deprecated, use Item() instead.
index cf9ad8b1af2b39fd343d633c5e6bcce0dde4878b..c8ec12a388bfaa0a50038e86d6a6284032dbce58 100644 (file)
@@ -535,7 +535,7 @@ void wxAppConsoleBase::DeletePendingEvents()
 
 bool wxAppConsoleBase::IsScheduledForDestruction(wxObject *object) const
 {
-    return wxPendingDelete.Member(object) != NULL;
+    return wxPendingDelete.Member(object);
 }
 
 void wxAppConsoleBase::ScheduleForDestruction(wxObject *object)