]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/list.h
partially reverted Robert's changes, did it more cleanly
[wxWidgets.git] / include / wx / list.h
index 2312ea49082a20e5a4faab5767639a0d8eeb0344..a9da690450a9fc5f2063435c3979efa2294d3982 100644 (file)
@@ -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() ); }               \
@@ -371,7 +371,7 @@ private:
 // a double-linked list class
 // -----------------------------------------------------------------------------
 
-class wxList;
+class WXDLLIMPEXP_BASE wxList;
 
 class WXDLLIMPEXP_BASE wxListBase : public wxObject
 {
@@ -390,7 +390,7 @@ public:
         // count of items in the list
     size_t GetCount() const { return m_count; }
 
-        // return TRUE if this list is empty
+        // return true if this list is empty
     bool IsEmpty() const { return m_count == 0; }
 
     // operations
@@ -446,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; }
@@ -489,15 +486,15 @@ protected:
         // removes node from the list but doesn't delete it (returns pointer
         // to the node or NULL if it wasn't found in the list)
     wxNodeBase *DetachNode(wxNodeBase *node);
-        // delete element from list, returns FALSE if node not found
+        // delete element from list, returns false if node not found
     bool DeleteNode(wxNodeBase *node);
         // finds object pointer and deletes node (and object if DeleteContents
-        // is on), returns FALSE if object not found
+        // is on), returns false if object not found
     bool DeleteObject(void *object);
 
     // 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;
@@ -604,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(); }                  \
@@ -647,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                  \
@@ -968,7 +967,7 @@ private:
 #define WX_DECLARE_LIST_WITH_DECL(elementtype, listname, decl) \
     typedef elementtype _WX_LIST_ITEM_TYPE_##listname;                      \
     WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, decl)
-    
+
 #define WX_DECLARE_EXPORTED_LIST(elementtype, listname)                     \
     WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class WXDLLEXPORT)
 
@@ -1090,20 +1089,20 @@ public:
 
         // copying the string list: the strings are copied, too (extremely
         // inefficient!)
-    wxStringList(const wxStringList& other) : wxStringListBase() { DeleteContents(TRUE); DoCopy(other); }
+    wxStringList(const wxStringList& other) : wxStringListBase() { DeleteContents(true); DoCopy(other); }
     wxStringList& operator=(const wxStringList& other)
         { Clear(); DoCopy(other); return *this; }
 
     // operations
         // makes a copy of the string
     wxNode *Add(const wxChar *s);
-        
+
         // Append to beginning of list
     wxNode *Prepend(const wxChar *s);
 
     bool Delete(const wxChar *s);
 
-    wxChar **ListToArray(bool new_copies = FALSE) const;
+    wxChar **ListToArray(bool new_copies = false) const;
     bool Member(const wxChar *s) const;
 
     // alphabetic sort