]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/dynarray.h
wxGetEmptyString() function added
[wxWidgets.git] / include / wx / dynarray.h
index ef2f64518a539050553d44148d2f0babd7cef257..58002387fd0ace91e79c5cb6e1f2e949523d5903 100644 (file)
@@ -19,8 +19,6 @@
 #include "wx/defs.h"
 #include "wx/utils.h"
 
-typedef   bool Bool;
-
 /** @name Dynamic arrays and lists 
     @memo Arrays which grow on demand and do range checking (only in debug)
   */
@@ -100,7 +98,7 @@ public:
     /// number of elements in the array
   uint  Count() const   { return m_uiCount;      }
     /// is it empty?
-  Bool  IsEmpty() const { return m_uiCount == 0; }
+  bool  IsEmpty() const { return m_uiCount == 0; }
   //@}
 
 protected:
@@ -125,7 +123,7 @@ protected:
       @return index of the first item matched or NOT_FOUND
       @see NOT_FOUND
      */
-  int  Index (long lItem, Bool bFromEnd = FALSE) const;
+  int  Index (long lItem, bool bFromEnd = FALSE) const;
     /// add new element at the end
   void Add   (long lItem);
     /// add new element at given position
@@ -174,8 +172,10 @@ public:                                                             \
     { return (T&)(wxBaseArray::Item(uiIndex)); }                    \
   T& Item(uint uiIndex) const                                       \
     { return (T&)(wxBaseArray::Item(uiIndex)); }                    \
+  T& Last() const                                                   \
+    { return (T&)(wxBaseArray::Item(Count() - 1)); }                \
                                                                     \
-  int Index(T Item, Bool bFromEnd = FALSE) const                    \
+  int Index(T Item, bool bFromEnd = FALSE) const                    \
     { return wxBaseArray::Index((long)Item, bFromEnd); }            \
                                                                     \
   void Add(T Item)                                                  \
@@ -186,7 +186,8 @@ public:                                                             \
   void Remove(uint uiIndex) { wxBaseArray::Remove(uiIndex); }       \
   void Remove(T Item)                                               \
     { int iIndex = Index(Item);                                     \
-      wxCHECK( iIndex != NOT_FOUND );                               \
+      wxCHECK2_MSG( iIndex != NOT_FOUND, return,                    \
+        "removing inexisting element in wxArray::Remove" );         \
       wxBaseArray::Remove((uint)iIndex); }                          \
                                                                     \
   void Sort(CMPFUNC##T fCmp) { wxBaseArray::Sort((CMPFUNC)fCmp); }  \
@@ -210,8 +211,10 @@ public:                                                             \
     { return *(T*)wxBaseArray::Item(uiIndex); }                     \
   T& Item(uint uiIndex) const                                       \
     { return *(T*)wxBaseArray::Item(uiIndex); }                     \
+  T& Last() const                                                   \
+    { return *(T*)(wxBaseArray::Item(Count() - 1)); }               \
                                                                     \
-  int Index(const T& Item, Bool bFromEnd = FALSE) const;            \
+  int Index(const T& Item, bool bFromEnd = FALSE) const;            \
                                                                     \
   void Add(const T& Item);                                          \
   void Add(const T* pItem)                                          \