]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/dynarray.h
wxFontEnumerator class for Motif/X
[wxWidgets.git] / include / wx / dynarray.h
index a5b90b2b1605169b8ab26afc6095310bd0a68e1c..caf4b814d1e2241ee043022b7e205381c11e912a 100644 (file)
  must return negative value, 0 or positive value if pItem1 <, = or > pItem2
  */
 
-#ifdef  __VISUALC__
+#if defined(__VISUALC__)
   #define   CMPFUNC_CONV    _cdecl
+#elif defined(__VISAGECPP__)
+  #define   CMPFUNC_CONV    _Optlink
 #else   // !Visual C++
   #define   CMPFUNC_CONV
 #endif  // compiler
@@ -168,11 +170,16 @@ private:
 // ----------------------------------------------------------------------------
 #define  _WX_DEFINE_ARRAY(T, name)                                  \
 typedef int (CMPFUNC_CONV *CMPFUNC##T)(T *pItem1, T *pItem2);       \
-class WXDLLEXPORTLOCAL name : public wxBaseArray                                     \
+class WXDLLEXPORT name : public wxBaseArray                         \
 {                                                                   \
 public:                                                             \
   name()                                                            \
-    { wxASSERT( sizeof(T) <= sizeof(long) ); }                      \
+  {                                                                 \
+    size_t type = sizeof(T);                                        \
+    size_t sizelong = sizeof(long);                                 \
+    if ( type > sizelong )                                          \
+      { wxFAIL_MSG( _T("illegal use of DEFINE_ARRAY") ); }          \
+  }                                                                 \
                                                                     \
   name& operator=(const name& src)                                  \
     { wxBaseArray* temp = (wxBaseArray*) this;                      \
@@ -197,9 +204,9 @@ public:                                                             \
   void Remove(size_t uiIndex) { wxBaseArray::Remove(uiIndex); }     \
   void Remove(T Item)                                               \
     { int iIndex = Index(Item);                                     \
-      wxCHECK2_MSG( iIndex != wxNOT_FOUND, return,                    \
-        "removing inexisting element in wxArray::Remove" );         \
-      wxBaseArray::Remove((size_t)iIndex); }                          \
+      wxCHECK2_MSG( iIndex != wxNOT_FOUND, return,                  \
+        _T("removing inexisting element in wxArray::Remove") );     \
+      wxBaseArray::Remove((size_t)iIndex); }                        \
                                                                     \
   void Sort(CMPFUNC##T fCmp) { wxBaseArray::Sort((CMPFUNC)fCmp); }  \
 }
@@ -226,11 +233,16 @@ public:                                                             \
 // ----------------------------------------------------------------------------
 #define  _WX_DEFINE_SORTED_ARRAY(T, name)                           \
 typedef int (CMPFUNC_CONV *SCMPFUNC##T)(T pItem1, T pItem2);        \
-class WXDLLEXPORTLOCAL  name : public wxBaseArray                                     \
+class WXDLLEXPORT name : public wxBaseArray                         \
 {                                                                   \
 public:                                                             \
   name(SCMPFUNC##T fn)                                              \
-    { wxASSERT( sizeof(T) <= sizeof(long) ); m_fnCompare = fn; }    \
+  { size_t type = sizeof(T);                                        \
+    size_t sizelong = sizeof(long);                                 \
+    if ( type > sizelong )                                          \
+      { wxFAIL_MSG( _T("illegal use of DEFINE_ARRAY") ); }          \
+    m_fnCompare = fn;                                               \
+  }                                                                 \
                                                                     \
   name& operator=(const name& src)                                  \
     { wxBaseArray* temp = (wxBaseArray*) this;                      \
@@ -254,8 +266,8 @@ public:                                                             \
   void Remove(size_t uiIndex) { wxBaseArray::Remove(uiIndex); }     \
   void Remove(T Item)                                               \
     { int iIndex = Index(Item);                                     \
-      wxCHECK2_MSG( iIndex != wxNOT_FOUND, return,                    \
-        "removing inexisting element in wxArray::Remove" );         \
+      wxCHECK2_MSG( iIndex != wxNOT_FOUND, return,                  \
+        _T("removing inexisting element in wxArray::Remove") );     \
       wxBaseArray::Remove((size_t)iIndex); }                        \
                                                                     \
 private:                                                            \
@@ -267,7 +279,7 @@ private:                                                            \
 // ----------------------------------------------------------------------------
 #define _WX_DECLARE_OBJARRAY(T, name)                               \
 typedef int (CMPFUNC_CONV *CMPFUNC##T)(T** pItem1, T** pItem2);     \
-class WXDLLEXPORTLOCAL name : public wxBaseArray                    \
+class WXDLLEXPORT name : public wxBaseArray                         \
 {                                                                   \
 public:                                                             \
   name() { }                                                        \
@@ -403,8 +415,6 @@ private:                                                            \
 // # overhead if not used?
 // ----------------------------------------------------------------------------
 
-#define WXDLLEXPORTLOCAL WXDLLEXPORT
-
 //@{
   /** @name ArrayInt */
 WX_DEFINE_ARRAY(int,    wxArrayInt);
@@ -416,9 +426,6 @@ WX_DEFINE_ARRAY(void *, wxArrayPtrVoid);
 
 //@}
 
-#undef  WXDLLEXPORTLOCAL
-#define WXDLLEXPORTLOCAL
-
 // -----------------------------------------------------------------------------
 // convinience macros
 // -----------------------------------------------------------------------------