]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/dynarray.h
Get/Set LayoutDirection
[wxWidgets.git] / include / wx / dynarray.h
index 4c2584fb49662abcfcc1cd5f0ee321645aeba90e..3e9da36b53fe16f5b5bba18604b4aef4170041ad 100644 (file)
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////////
-// Name:        dynarray.h
+// Name:        wx/dynarray.h
 // Purpose:     auto-resizable (i.e. dynamic) array support
 // Author:      Vadim Zeitlin
 // Modified by:
@@ -169,7 +169,7 @@ public:                                                             \
                                                                     \
   void Empty() { m_nCount = 0; }                                    \
   void Clear();                                                     \
-  void Alloc(size_t uiSize);                                        \
+  void Alloc(size_t n) { if ( n > m_nSize ) Realloc(n); }           \
   void Shrink();                                                    \
                                                                     \
   size_t GetCount() const { return m_nCount; }                      \
@@ -225,7 +225,7 @@ protected:                                                          \
   void insert(iterator it, const_iterator first, const_iterator last);\
   void pop_back() { RemoveAt(size() - 1); }                         \
   void push_back(const value_type& v) { Add(v); }                   \
-  void reserve(size_type n) { if(n > m_nSize) Realloc(n); }         \
+  void reserve(size_type n) { Alloc(n); }                           \
   void resize(size_type n, value_type v = value_type())             \
     { SetCount(n, v); }                                             \
                                                                     \
@@ -805,6 +805,7 @@ private:                                                                 \
 
 WX_DECLARE_USER_EXPORTED_BASEARRAY(const void *, wxBaseArrayPtrVoid,
                                    WXDLLIMPEXP_BASE);
+WX_DECLARE_USER_EXPORTED_BASEARRAY(char, wxBaseArrayChar, WXDLLIMPEXP_BASE);
 WX_DECLARE_USER_EXPORTED_BASEARRAY(short, wxBaseArrayShort, WXDLLIMPEXP_BASE);
 WX_DECLARE_USER_EXPORTED_BASEARRAY(int, wxBaseArrayInt, WXDLLIMPEXP_BASE);
 WX_DECLARE_USER_EXPORTED_BASEARRAY(long, wxBaseArrayLong, WXDLLIMPEXP_BASE);
@@ -830,6 +831,13 @@ WX_DECLARE_USER_EXPORTED_BASEARRAY(double, wxBaseArrayDouble, WXDLLIMPEXP_BASE);
 #define WX_DEFINE_USER_EXPORTED_ARRAY_PTR(T, name, expmode)         \
     WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayPtrVoid, expmode)
 
+#define WX_DEFINE_ARRAY_CHAR(T, name)                                 \
+    WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayChar)
+#define WX_DEFINE_EXPORTED_ARRAY_CHAR(T, name)                        \
+    WX_DEFINE_EXPORTED_TYPEARRAY_PTR(T, name, wxBaseArrayChar)
+#define WX_DEFINE_USER_EXPORTED_ARRAY_CHAR(T, name, expmode)          \
+    WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(T, name, wxBaseArrayChar, expmode)
+
 #define WX_DEFINE_ARRAY_SHORT(T, name)                                 \
     WX_DEFINE_TYPEARRAY_PTR(T, name, wxBaseArrayShort)
 #define WX_DEFINE_EXPORTED_ARRAY_SHORT(T, name)                        \
@@ -876,6 +884,13 @@ WX_DECLARE_USER_EXPORTED_BASEARRAY(double, wxBaseArrayDouble, WXDLLIMPEXP_BASE);
 #define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY(T, name, expmode)         \
     WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayPtrVoid, expmode)
 
+#define WX_DEFINE_SORTED_ARRAY_CHAR(T, name)                          \
+    WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayChar)
+#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CHAR(T, name)                 \
+    WX_DEFINE_SORTED_EXPORTED_TYPEARRAY(T, name, wxBaseArrayChar)
+#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CHAR(T, name, expmode)   \
+    WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY(T, name, wxBaseArrayChar, expmode)
+
 #define WX_DEFINE_SORTED_ARRAY_SHORT(T, name)                          \
     WX_DEFINE_SORTED_TYPEARRAY(T, name, wxBaseArrayShort)
 #define WX_DEFINE_SORTED_EXPORTED_ARRAY_SHORT(T, name)                 \
@@ -917,6 +932,15 @@ WX_DECLARE_USER_EXPORTED_BASEARRAY(double, wxBaseArrayDouble, WXDLLIMPEXP_BASE);
     WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name,     \
                                                  wxBaseArrayPtrVoid, expmode)
 
+#define WX_DEFINE_SORTED_ARRAY_CMP_CHAR(T, cmpfunc, name)             \
+    WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayChar)
+#define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_CHAR(T, cmpfunc, name)    \
+    WX_DEFINE_SORTED_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayChar)
+#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_CMP_CHAR(T, cmpfunc,     \
+                                                       name, expmode)  \
+    WX_DEFINE_SORTED_USER_EXPORTED_TYPEARRAY_CMP(T, cmpfunc, name,     \
+                                                 wxBaseArrayChar, expmode)
+
 #define WX_DEFINE_SORTED_ARRAY_CMP_SHORT(T, cmpfunc, name)             \
     WX_DEFINE_SORTED_TYPEARRAY_CMP(T, cmpfunc, name, wxBaseArrayShort)
 #define WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_SHORT(T, cmpfunc, name)    \
@@ -973,6 +997,7 @@ WX_DEFINE_USER_EXPORTED_ARRAY_PTR(void *, wxArrayPtrVoid, class WXDLLIMPEXP_BASE
 #define WX_PREPEND_ARRAY(array, other)                                        \
     {                                                                         \
         size_t wxAAcnt = (other).size();                                      \
+        (array).Alloc(wxAAcnt);                                               \
         for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ )                    \
         {                                                                     \
             (array).Insert((other)[wxAAn], wxAAn);                            \
@@ -983,6 +1008,7 @@ WX_DEFINE_USER_EXPORTED_ARRAY_PTR(void *, wxArrayPtrVoid, class WXDLLIMPEXP_BASE
 #define WX_APPEND_ARRAY(array, other)                                         \
     {                                                                         \
         size_t wxAAcnt = (other).size();                                      \
+        (array).Alloc(wxAAcnt);                                               \
         for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ )                    \
         {                                                                     \
             (array).push_back((other)[wxAAn]);                                \
@@ -1007,4 +1033,3 @@ WX_DEFINE_USER_EXPORTED_ARRAY_PTR(void *, wxArrayPtrVoid, class WXDLLIMPEXP_BASE
     }
 
 #endif // _DYNARRAY_H
-