- class dummy;
-
- struct compatibility_iterator
- {
- hash::iterator m_iter;
- hash* m_hash;
-
- operator bool() const { return m_iter != m_hash->end(); }
- bool operator !() const { return m_iter == m_hash->end(); }
- compatibility_iterator( hash* li, hash::iterator it )
- : m_iter( it ), m_hash( li ) {}
- compatibility_iterator() { }
-
- dummy* operator->() { return (dummy*)this; }
- };
- typedef compatibility_iterator citer;
-
- class dummy
- {
- typedef hash::iterator it;
- typedef compatibility_iterator citer;
- public:
- wxObject* GetData() const
- {
- citer* i = (citer*)this;
- return (wxObject*)i->m_iter->second;
- }
- citer GetNext() const
- {
- citer* i = (citer*)this;
- it lit = i->m_iter;
- return citer( i->m_hash, ++lit );
- }
- citer GetPrevious() const
- {
- citer* i = (citer*)this;
- it lit = i->m_iter;
- return citer( i->m_hash, ++lit );
- }
- void SetData( wxObject* e )
- {
- citer* i = (citer*)this;
- i->m_iter->second = e;
- }
- private:
- dummy();
- };
-public:
- wxHashTable( wxKeyType keyType = wxKEY_INTEGER,
- size_t size = wxHASH_SIZE_DEFAULT )
- : wxHashTableBase( keyType, size ) { }
-
- void Destroy() { Clear(); }
-
- // key and value are the same
- void Put(long value, wxObject *object) { DoPut( value, object ); }
- void Put(const wxChar *value, wxObject *object) { DoPut( value, object ); }
-
- // key and value are the same
- wxObject *Get(long value) const { return (wxObject*)DoGet( value ); }
- wxObject *Get(const wxChar *value) const { return (wxObject*)DoGet( value ); }
-
- // Deletes entry and returns data if found
- wxObject *Delete(long key) { return (wxObject*)DoGet( key ); }
- wxObject *Delete(const wxChar *key) { return (wxObject*)DoGet( key ); }
-
-#if 0
- // 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;
-#endif
- // 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_iter = citer( &this->m_map, this->m_map.begin() ); }
- compatibility_iterator Next()
- {
- compatibility_iterator it = m_iter;
- if( m_iter )
- m_iter = m_iter->GetNext();
- return it;
- }
-
- void Clear() { wxHashTableBase::Clear(); }
-private:
- compatibility_iterator m_iter;
+ wxHashTable_Node( long key, void* value,
+ wxHashTableBase* table )
+ : wxHashTableBase_Node( key, value, table ) { }
+ wxHashTable_Node( const wxString& 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(); }