]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/dynarray.h
wxRegion::IsEmpty() added
[wxWidgets.git] / include / wx / dynarray.h
index c15997d203aea8ab00a3ceae30d6a33edb52fa4b..b5466516d25b4425d5ff560400a2c3b7885567db 100644 (file)
  callback compare function for quick sort
  must return negative value, 0 or positive value if pItem1 <, = or > pItem2
  */
  callback compare function for quick sort
  must return negative value, 0 or positive value if pItem1 <, = or > pItem2
  */
-
-#if defined(__VISUALC__)
-  #define   CMPFUNC_CONV    _cdecl
-#elif defined(__VISAGECPP__)
-  #define   CMPFUNC_CONV    _Optlink
-#else   // !Visual C++
-  #define   CMPFUNC_CONV
-#endif  // compiler
-typedef int (CMPFUNC_CONV *CMPFUNC)(const void* pItem1, const void* pItem2);
+typedef int (wxCMPFUNC_CONV *CMPFUNC)(const void* pItem1, const void* pItem2);
 
 // ----------------------------------------------------------------------------
 /**
 
 // ----------------------------------------------------------------------------
 /**
@@ -159,6 +151,11 @@ private:
 // template classes
 // ============================================================================
 
 // template classes
 // ============================================================================
 
+// resolves the name conflict between the T() macor and T typedef: we can't
+// use T() inside WX_DEFINE_ARRAY!
+#define _WX_ERROR_SIZEOF   T("illegal use of DEFINE_ARRAY")
+#define _WX_ERROR_REMOVE   T("removing inexisting element in wxArray::Remove")
+
 // ----------------------------------------------------------------------------
 // This macro generates a new array class. It is intended for storage of simple
 // types of sizeof()<=sizeof(long) or pointers if sizeof(pointer)<=sizeof(long)
 // ----------------------------------------------------------------------------
 // This macro generates a new array class. It is intended for storage of simple
 // types of sizeof()<=sizeof(long) or pointers if sizeof(pointer)<=sizeof(long)
@@ -174,9 +171,11 @@ class WXDLLEXPORT name : public wxBaseArray                         \
 {                                                                   \
 public:                                                             \
   name()                                                            \
 {                                                                   \
 public:                                                             \
   name()                                                            \
-  { size_t type = sizeof(T);                                        \
+  {                                                                 \
+    size_t type = sizeof(T);                                        \
     size_t sizelong = sizeof(long);                                 \
     size_t sizelong = sizeof(long);                                 \
-    wxASSERT( type <= sizelong );                                   \
+    if ( type > sizelong )                                          \
+      { wxFAIL_MSG( _WX_ERROR_SIZEOF ); }                           \
   }                                                                 \
                                                                     \
   name& operator=(const name& src)                                  \
   }                                                                 \
                                                                     \
   name& operator=(const name& src)                                  \
@@ -203,7 +202,7 @@ public:                                                             \
   void Remove(T Item)                                               \
     { int iIndex = Index(Item);                                     \
       wxCHECK2_MSG( iIndex != wxNOT_FOUND, return,                  \
   void Remove(T Item)                                               \
     { int iIndex = Index(Item);                                     \
       wxCHECK2_MSG( iIndex != wxNOT_FOUND, return,                  \
-        _T("removing inexisting element in wxArray::Remove") );     \
+         _WX_ERROR_REMOVE);                                         \
       wxBaseArray::Remove((size_t)iIndex); }                        \
                                                                     \
   void Sort(CMPFUNC##T fCmp) { wxBaseArray::Sort((CMPFUNC)fCmp); }  \
       wxBaseArray::Remove((size_t)iIndex); }                        \
                                                                     \
   void Sort(CMPFUNC##T fCmp) { wxBaseArray::Sort((CMPFUNC)fCmp); }  \
@@ -237,7 +236,8 @@ public:                                                             \
   name(SCMPFUNC##T fn)                                              \
   { size_t type = sizeof(T);                                        \
     size_t sizelong = sizeof(long);                                 \
   name(SCMPFUNC##T fn)                                              \
   { size_t type = sizeof(T);                                        \
     size_t sizelong = sizeof(long);                                 \
-    wxASSERT( type <= sizelong );                                   \
+    if ( type > sizelong )                                          \
+      { wxFAIL_MSG( _WX_ERROR_SIZEOF ); }                           \
     m_fnCompare = fn;                                               \
   }                                                                 \
                                                                     \
     m_fnCompare = fn;                                               \
   }                                                                 \
                                                                     \
@@ -264,7 +264,7 @@ public:                                                             \
   void Remove(T Item)                                               \
     { int iIndex = Index(Item);                                     \
       wxCHECK2_MSG( iIndex != wxNOT_FOUND, return,                  \
   void Remove(T Item)                                               \
     { int iIndex = Index(Item);                                     \
       wxCHECK2_MSG( iIndex != wxNOT_FOUND, return,                  \
-        _T("removing inexisting element in wxArray::Remove") );     \
+        _WX_ERROR_REMOVE );                                         \
       wxBaseArray::Remove((size_t)iIndex); }                        \
                                                                     \
 private:                                                            \
       wxBaseArray::Remove((size_t)iIndex); }                        \
                                                                     \
 private:                                                            \