]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/hashmap.h
Added (Start|End)DrawingOnTop stubs
[wxWidgets.git] / include / wx / hashmap.h
index 621bd6c5288fa3900a2a40d0b9d686ef05da9b41..14d8684f5446e12ef2815dc6cffba4da6cf81fe2 100644 (file)
 
 #include <stddef.h>             // for ptrdiff_t
 
+#ifdef __WXWINCE__
+typedef int ptrdiff_t;
+#endif
+
 // private
 struct WXDLLIMPEXP_BASE _wxHashTable_NodeBase
 {
@@ -70,7 +74,11 @@ protected:
 
     static void** AllocTable( size_t sz )
     {
+#ifdef __WXWINCE__
+        return (void **)malloc(sz * sizeof(void*));
+#else
         return (void **)calloc(sz, sizeof(void*));
+#endif
     }
 };
 
@@ -563,5 +571,19 @@ public: \
     _WX_DECLARE_HASH_MAP( void*, VALUE_T, wxPointerHash, wxPointerEqual, \
                           CLASSNAME, class WXDLLEXPORT )
 
+// delete all hash elements
+//
+// NB: the class declaration of the hash elements must be visible from the
+//     place where you use this macro, otherwise the proper destructor may not
+//     be called (a decent compiler should give a warning about it, but don't
+//     count on it)!
+#define WX_CLEAR_HASH_MAP(type, hashmap)                                     \
+    {                                                                        \
+        type::iterator it, en;                                               \
+        for( it = (hashmap).begin(), en = (hashmap).end(); it != en; ++it )  \
+            delete it->second;                                               \
+        (hashmap).clear();                                                   \
+    }
+
 #endif // _WX_HASHMAP_H_