]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/dynarray.h
Applied patch [ 619705 ] Fixes wxApp::GetComCtl32Version
[wxWidgets.git] / include / wx / dynarray.h
index f0e511682056f97afb3f76dea30559e5f9314713..fb4b3f6d8baaa8e8748924cea59c0100a9507faf 100644 (file)
@@ -6,13 +6,13 @@
 // Created:     12.09.97
 // RCS-ID:      $Id$
 // Copyright:   (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 
 #ifndef   _DYNARRAY_H
 #define   _DYNARRAY_H
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(__APPLE__)
 #pragma interface "dynarray.h"
 #endif
 
@@ -90,11 +90,13 @@ public:                                                             \
   void Alloc(size_t uiSize);                                        \
   void Shrink();                                                    \
                                                                     \
-  size_t  GetCount() const { return m_nCount; }                     \
-  bool  IsEmpty() const { return m_nCount == 0; }                   \
-  size_t  Count() const { return m_nCount; }                        \
+  size_t GetCount() const { return m_nCount; }                      \
+  void SetCount(size_t n, T defval = T(0));                         \
+  bool IsEmpty() const { return m_nCount == 0; }                    \
+  size_t Count() const { return m_nCount; }                         \
                                                                     \
   typedef T base_type;                                              \
+                                                                    \
 protected:                                                          \
   T& Item(size_t uiIndex) const                                     \
     { wxASSERT( uiIndex < m_nCount ); return m_pItems[uiIndex]; }   \
@@ -112,14 +114,14 @@ protected:                                                          \
   void Sort(CMPFUNC fnCompare);                                     \
                                                                     \
 private:                                                            \
-                                                                    \
-  void    Grow(size_t nIncrement = 0);                              \
+  void Grow(size_t nIncrement = 0);                                 \
+  bool Realloc(size_t nSize);                                       \
                                                                     \
   size_t  m_nSize,                                                  \
           m_nCount;                                                 \
                                                                     \
   T      *m_pItems;                                                 \
-};
+}
 
 // ============================================================================
 // The private helper macros containing the core of the array classes
@@ -166,12 +168,12 @@ public:                                                               \
     { return (T&)(base::Item(Count() - 1)); }                         \
                                                                       \
   int Index(T Item, bool bFromEnd = FALSE) const                      \
-    { return base::Index(Item, bFromEnd); }                           \
+    { return base::Index((base_type)Item, bFromEnd); }                \
                                                                       \
   void Add(T Item, size_t nInsert = 1)                                \
-    { base::Add(Item, nInsert); }                                     \
+    { base::Add((base_type)Item, nInsert); }                          \
   void Insert(T Item, size_t uiIndex, size_t nInsert = 1)             \
-    { base::Insert(Item, uiIndex, nInsert) ; }                        \
+    { base::Insert((base_type)Item, uiIndex, nInsert) ; }             \
                                                                       \
   void RemoveAt(size_t uiIndex, size_t nRemove = 1)                   \
     { base::RemoveAt(uiIndex, nRemove); }                             \