]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/list.h
added some trivial macros for exception handling
[wxWidgets.git] / include / wx / list.h
index 07be25312510357c9d2c25cc98e8ac3aa30fecca..2312ea49082a20e5a4faab5767639a0d8eeb0344 100644 (file)
@@ -25,7 +25,7 @@
 #ifndef _WX_LISTH__
 #define _WX_LISTH__
 
-#if defined(__GNUG__) && !defined(__APPLE__) && \
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) && \
     !(defined(__MINGW32__) && __GNUC__ == 3 && __GNUC_MINOR__ == 2)
 #pragma interface "list.h"
 #endif
@@ -84,16 +84,16 @@ enum wxKeyType
 #define wxLIST_COMPATIBILITY
 
 #define WX_DECLARE_LIST_3(elT, dummy1, liT, dummy2, decl) \
-    WX_DECLARE_LIST_X(elT, liT, decl)
+    WX_DECLARE_LIST_WITH_DECL(elT, liT, decl)
 #define WX_DECLARE_LIST_PTR_3(elT, dummy1, liT, dummy2, decl) \
     WX_DECLARE_LIST_3(elT, dummy1, liT, dummy2, decl)
 
 #define WX_DECLARE_LIST_2(elT, liT, dummy, decl) \
-    WX_DECLARE_LIST_X(elT, liT, decl)
+    WX_DECLARE_LIST_WITH_DECL(elT, liT, decl)
 #define WX_DECLARE_LIST_PTR_2(elT, liT, dummy, decl) \
     WX_DECLARE_LIST_2(elT, liT, dummy, decl) \
 
-#define WX_DECLARE_LIST_X(elT, liT, decl) \
+#define WX_DECLARE_LIST_WITH_DECL(elT, liT, decl) \
     WX_DECLARE_LIST_XO(elT*, liT, decl)
 
 #define WX_DECLARE_LIST_XO(elT, liT, decl) \
@@ -215,17 +215,17 @@ enum wxKeyType
     }
 
 #define WX_DECLARE_LIST(elementtype, listname)                              \
-    WX_DECLARE_LIST_X(elementtype, listname, class)
+    WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class)
 #define WX_DECLARE_LIST_PTR(elementtype, listname)                          \
     WX_DECLARE_LIST(elementtype, listname)
 
 #define WX_DECLARE_EXPORTED_LIST(elementtype, listname)                     \
-    WX_DECLARE_LIST_X(elementtype, listname, class WXDLLEXPORT)
+    WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class WXDLLEXPORT)
 #define WX_DECLARE_EXPORTED_LIST_PTR(elementtype, listname)                 \
     WX_DECLARE_EXPORTED_LIST(elementtype, listname)
 
 #define WX_DECLARE_USER_EXPORTED_LIST(elementtype, listname, usergoo)       \
-    WX_DECLARE_LIST_X(elementtype, listname, class usergoo)
+    WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class usergoo)
 #define WX_DECLARE_USER_EXPORTED_LIST_PTR(elementtype, listname, usergoo)   \
     WX_DECLARE_USER_EXPORTED_LIST(elementtype, listname, usergoo)
 
@@ -240,7 +240,9 @@ enum wxKeyType
 
 // due to circular header dependencies this function has to be declared here
 // (normally it's found in utils.h which includes itself list.h...)
+#if WXWIN_COMPATIBILITY_2_4
 extern WXDLLIMPEXP_BASE wxChar* copystring(const wxChar *s);
+#endif
 
 class WXDLLEXPORT wxObjectListNode;
 typedef wxObjectListNode wxNode;
@@ -859,10 +861,10 @@ private:
             { return const_reverse_iterator(NULL, GetFirst()); }            \
         void resize(size_type n, value_type v = value_type())               \
         {                                                                   \
-            if(n < size())                                                  \
-                for(; n < size(); pop_back());                              \
-            else if(n > size())                                             \
-                for(; n > size(); push_back(v));                            \
+            while (n < size())                                              \
+                pop_back();                                                 \
+            while (n > size())                                              \
+                push_back(v);                                                \
         }                                                                   \
         size_type size() const { return GetCount(); }                       \
         size_type max_size() const { return INT_MAX; }                      \
@@ -963,9 +965,13 @@ private:
     typedef elementtype _WX_LIST_ITEM_TYPE_##listname;                      \
     WX_DECLARE_LIST_PTR_2(elementtype, listname, wx##listname##Node, class)
 
-#define WX_DECLARE_EXPORTED_LIST(elementtype, listname)                     \
+#define WX_DECLARE_LIST_WITH_DECL(elementtype, listname, decl) \
     typedef elementtype _WX_LIST_ITEM_TYPE_##listname;                      \
-    WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, class WXDLLEXPORT)
+    WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, decl)
+    
+#define WX_DECLARE_EXPORTED_LIST(elementtype, listname)                     \
+    WX_DECLARE_LIST_WITH_DECL(elementtype, listname, class WXDLLEXPORT)
+
 #define WX_DECLARE_EXPORTED_LIST_PTR(elementtype, listname)                     \
     typedef elementtype _WX_LIST_ITEM_TYPE_##listname;                      \
     WX_DECLARE_LIST_PTR_2(elementtype, listname, wx##listname##Node, class WXDLLEXPORT)