]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/list.h
Removed my copy of distutils from the wxPython source tree.
[wxWidgets.git] / include / wx / list.h
index 93ea9a13ac9fe88600dcec77356022810299a1e9..80353b3fdb28feebb8d86c1688e1b18adbe31e0c 100644 (file)
@@ -25,7 +25,7 @@
 #ifndef _WX_LISTH__
 #define _WX_LISTH__
 
-#if defined(__GNUG__) && !defined(__APPLE__) && \
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) && \
     !(defined(__MINGW32__) && __GNUC__ == 3 && __GNUC_MINOR__ == 2)
 #pragma interface "list.h"
 #endif
@@ -157,7 +157,7 @@ enum wxKeyType
             dummy();                                                          \
         };                                                                    \
     protected:                                                                \
-        iterator find( elT e )                                                \
+        iterator find( const elT e )                                          \
         {                                                                     \
             iterator it, en;                                                  \
             for( it = begin(), en = end(); it != en; ++it )                   \
@@ -166,7 +166,7 @@ enum wxKeyType
             return it;                                                        \
         }                                                                     \
     public:                                                                   \
-        liT() {};                                                             \
+        liT() {}                                                              \
                                                                               \
         citer Append( elT e ) { push_back( e ); return GetLast(); }           \
         void Clear() { clear(); }                                             \
@@ -188,7 +188,7 @@ enum wxKeyType
         {                                                                     \
             erase( it.m_iter );                                               \
         }                                                                     \
-        citer Find( elT e ) const { return citer( this, ((liT*)this)->find( e ) ); } \
+        citer Find( const elT e ) const { return citer( this, ((liT*)this)->find( e ) ); } \
         citer Member( elT e ) const { return Find( e ); }                     \
         citer Insert( elT e )                                                 \
             { push_front( e ); return citer( this, begin() ); }               \
@@ -240,7 +240,9 @@ enum wxKeyType
 
 // due to circular header dependencies this function has to be declared here
 // (normally it's found in utils.h which includes itself list.h...)
+#if WXWIN_COMPATIBILITY_2_4
 extern WXDLLIMPEXP_BASE wxChar* copystring(const wxChar *s);
+#endif
 
 class WXDLLEXPORT wxObjectListNode;
 typedef wxObjectListNode wxNode;
@@ -369,7 +371,7 @@ private:
 // a double-linked list class
 // -----------------------------------------------------------------------------
 
-class wxList;
+class WXDLLIMPEXP_BASE wxList;
 
 class WXDLLIMPEXP_BASE wxListBase : public wxObject
 {
@@ -444,11 +446,8 @@ public:
     wxListBase(void *object, ... /* terminate with NULL */);
 
 protected:
-        // copy ctor and assignment operator
-    wxListBase(const wxListBase& list) : wxObject()
-        { Init(); DoCopy(list); }
-    wxListBase& operator=(const wxListBase& list)
-        { Clear(); DoCopy(list); return *this; }
+    void Assign(const wxListBase& list)
+        { Clear(); DoCopy(list); }
 
         // get list head/tail
     wxNodeBase *GetFirst() const { return m_nodeFirst; }
@@ -495,7 +494,7 @@ protected:
 
     // search (all return NULL if item not found)
         // by data
-    wxNodeBase *Find(void *object) const;
+    wxNodeBase *Find(const void *object) const;
 
         // by key
     wxNodeBase *Find(const wxListKey& key) const;
@@ -602,11 +601,13 @@ private:
                                                                             \
         name(wxKeyType keyType = wxKEY_NONE) : wxListBase(keyType)          \
             { }                                                             \
+        name(const name& list) : wxListBase(list.GetKeyType())              \
+            { Assign(list); }                                               \
         name(size_t count, T *elements[])                                   \
             : wxListBase(count, (void **)elements) { }                      \
                                                                             \
         name& operator=(const name& list)                                   \
-            { (void) wxListBase::operator=(list); return *this; }           \
+            { Assign(list); return *this; }                                 \
                                                                             \
         nodetype *GetFirst() const                                          \
             { return (nodetype *)wxListBase::GetFirst(); }                  \
@@ -645,7 +646,7 @@ private:
         void Erase(compatibility_iterator it)                               \
             { DeleteNode(it); }                                             \
                                                                             \
-        nodetype *Find(Tbase *object) const                                 \
+        nodetype *Find(const Tbase *object) const                           \
             { return (nodetype *)wxListBase::Find(object); }                \
                                                                             \
         virtual nodetype *Find(const wxListKey& key) const                  \
@@ -859,10 +860,10 @@ private:
             { return const_reverse_iterator(NULL, GetFirst()); }            \
         void resize(size_type n, value_type v = value_type())               \
         {                                                                   \
-            if(n < size())                                                  \
-                for(; n < size(); pop_back());                              \
-            else if(n > size())                                             \
-                for(; n > size(); push_back(v));                            \
+            while (n < size())                                              \
+                pop_back();                                                 \
+            while (n > size())                                              \
+                push_back(v);                                                \
         }                                                                   \
         size_type size() const { return GetCount(); }                       \
         size_type max_size() const { return INT_MAX; }                      \