]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/dynarray.h
Updated version to 2.3.2 so apps can test for differences in new merged source
[wxWidgets.git] / include / wx / dynarray.h
index fc49a0f260c5399e89f6f0b6d34e712352b05293..321c49a94deb1c15669a757ab9fe9a2fc9435769 100644 (file)
@@ -17,7 +17,6 @@
 #endif
 
 #include "wx/defs.h"
-#include "wx/debug.h"
 
 /** @name Dynamic arrays and object arrays (array which own their elements)
     @memo Arrays which grow on demand and do range checking (only in debug)
@@ -165,6 +164,7 @@ private:
 //    { ((wxBaseArray *)this)->operator=((const wxBaseArray&)src);
 // so using a temporary variable instead.
 // ----------------------------------------------------------------------------
+// __MAC_X__ added min ~name() below for compiling Mac X
 #define  _WX_DEFINE_ARRAY(T, name, classexp)                        \
 typedef int (CMPFUNC_CONV *CMPFUNC##T)(T *pItem1, T *pItem2);       \
 classexp name : public wxBaseArray                                  \
@@ -177,6 +177,7 @@ public:                                                             \
     if ( type > sizelong )                                          \
       { wxFAIL_MSG( _WX_ERROR_SIZEOF ); }                           \
   }                                                                 \
+  ~name() {}                                                        \
                                                                     \
   name& operator=(const name& src)                                  \
     { wxBaseArray* temp = (wxBaseArray*) this;                      \
@@ -304,7 +305,8 @@ public:                                                             \
   void Insert(const T* pItem, size_t uiIndex)                       \
     { wxBaseArray::Insert((long)pItem, uiIndex); }                  \
                                                                     \
-  void Empty();                                                     \
+  void Empty() { DoEmpty(); wxBaseArray::Empty(); }                 \
+  void Clear() { DoEmpty(); wxBaseArray::Clear(); }                 \
                                                                     \
   T*   Detach(size_t uiIndex)                                       \
     { T* p = (T*)wxBaseArray::Item(uiIndex);                        \
@@ -315,6 +317,7 @@ public:                                                             \
   void Sort(CMPFUNC##T fCmp) { wxBaseArray::Sort((CMPFUNC)fCmp); }  \
                                                                     \
 private:                                                            \
+  void DoEmpty();                                                   \
   void DoCopy(const name& src);                                     \
 }
 
@@ -448,6 +451,16 @@ WX_DEFINE_EXPORTED_ARRAY(void *, wxArrayPtrVoid);
 // convinience macros
 // -----------------------------------------------------------------------------
 
+// append all element of one array to another one
+#define WX_APPEND_ARRAY(array, other)                                         \
+    {                                                                         \
+        size_t count = (other).Count();                                       \
+        for ( size_t n = 0; n < count; n++ )                                  \
+        {                                                                     \
+            (array).Add((other)[n]);                                          \
+        }                                                                     \
+    }
+
 // delete all array elements
 //
 // NB: the class declaration of the array elements must be visible from the
@@ -456,13 +469,13 @@ WX_DEFINE_EXPORTED_ARRAY(void *, wxArrayPtrVoid);
 //     count on it)!
 #define WX_CLEAR_ARRAY(array)                                                 \
     {                                                                         \
-        size_t count = array.Count();                                         \
+        size_t count = (array).Count();                                       \
         for ( size_t n = 0; n < count; n++ )                                  \
         {                                                                     \
-            delete array[n];                                                  \
+            delete (array)[n];                                                \
         }                                                                     \
                                                                               \
-        array.Empty();                                                        \
+        (array).Empty();                                                      \
     }
 
 #endif // _DYNARRAY_H