+ wxHashTable_Node( long key, void* value,
+ wxHashTableBase* table )
+ : wxHashTableBase_Node( key, value, table ) { }
+ wxHashTable_Node( const wxChar* key, void* value,
+ wxHashTableBase* table )
+ : wxHashTableBase_Node( key, value, table ) { }
+
+ wxObject* GetData() const
+ { return (wxObject*)wxHashTableBase_Node::GetData(); }
+ void SetData( wxObject* data )
+ { wxHashTableBase_Node::SetData( data ); }
+
+ wxHashTable_Node* GetNext() const
+ { return (wxHashTable_Node*)wxHashTableBase_Node::GetNext(); }
+};
+
+// should inherit protectedly, but it is public for compatibility in
+// order to publicly inherit from wxObject
+class WXDLLIMPEXP_BASE wxHashTable : public wxHashTableBase
+{
+ typedef wxHashTableBase hash;
+public:
+ typedef wxHashTable_Node Node;
+ typedef wxHashTable_Node* compatibility_iterator;
+public:
+ wxHashTable( wxKeyType keyType = wxKEY_INTEGER,
+ size_t size = wxHASH_SIZE_DEFAULT )
+ : wxHashTableBase() { Create( keyType, size ); BeginFind(); }
+ wxHashTable( const wxHashTable& table );
+
+ virtual ~wxHashTable() { Destroy(); }
+
+ const wxHashTable& operator=( const wxHashTable& );
+
+ // key and value are the same
+ void Put(long value, wxObject *object)
+ { DoPut( value, value, object ); }
+ void Put(long hash, long value, wxObject *object)
+ { DoPut( value, hash, object ); }
+ void Put(const wxChar *value, wxObject *object)
+ { DoPut( value, MakeKey( value ), object ); }
+ void Put(long hash, const wxChar *value, wxObject *object)
+ { DoPut( value, hash, object ); }
+
+ // key and value are the same
+ wxObject *Get(long value) const
+ { return (wxObject*)DoGet( value, value ); }
+ wxObject *Get(long hash, long value) const
+ { return (wxObject*)DoGet( value, hash ); }
+ wxObject *Get(const wxChar *value) const
+ { return (wxObject*)DoGet( value, MakeKey( value ) ); }
+ wxObject *Get(long hash, const wxChar *value) const
+ { return (wxObject*)DoGet( value, hash ); }
+
+ // Deletes entry and returns data if found
+ wxObject *Delete(long key)
+ { return (wxObject*)DoDelete( key, key ); }
+ wxObject *Delete(long hash, long key)
+ { return (wxObject*)DoDelete( key, hash ); }
+ wxObject *Delete(const wxChar *key)
+ { return (wxObject*)DoDelete( key, MakeKey( key ) ); }
+ wxObject *Delete(long hash, const wxChar *key)
+ { return (wxObject*)DoDelete( key, hash ); }
+
+ // Construct your own integer key from a string, e.g. in case
+ // you need to combine it with something
+ long MakeKey(const wxChar *string) const
+ { return wxHashTableBase::MakeKey(string); }
+
+ // Way of iterating through whole hash table (e.g. to delete everything)
+ // Not necessary, of course, if you're only storing pointers to
+ // objects maintained separately
+ void BeginFind() { m_curr = NULL; m_currBucket = 0; }
+ Node* Next();
+
+ void Clear() { wxHashTableBase::Clear(); }
+
+ size_t GetCount() const { return wxHashTableBase::GetCount(); }
+protected:
+ virtual void DoDeleteContents( wxHashTableBase_Node* node );
+
+ // copy helper
+ void DoCopy( const wxHashTable& copy );
+
+ // searches the next node starting from bucket bucketStart and sets
+ // m_curr to it and m_currBucket to its bucket
+ void GetNextNode( size_t bucketStart );
+private:
+ // current node
+ Node* m_curr;
+
+ // bucket the current node belongs to
+ size_t m_currBucket;
+};
+
+#else // if wxUSE_OLD_HASH_TABLE
+
+class WXDLLIMPEXP_BASE wxHashTable : public wxObject
+{
+public:
+ typedef wxNode Node;
+ typedef wxNode* compatibility_iterator;
+