- void Destroy() { m_map.clear(); } \
- void Put(long key, eltype *data) { DoPut(key, (void*)data); } \
- eltype *Get(long key) const { return (eltype*)DoGet(key); } \
- eltype *Delete(long key) { return (eltype*)DoDelete(key); } \
- }
-
-#else // if !wxUSE_STL
-
-#define _WX_DECLARE_HASH(eltype, listclass, hashclass, classexp) \
- classexp hashclass : public wxHashTableBase \
- { \
- public: \
- hashclass(wxKeyType keyType = wxKEY_INTEGER, \
- size_t size = wxHASH_SIZE_DEFAULT) \
- { Create(keyType, size); } \
- \
- ~hashclass() { Destroy(); } \
- \
- void Put(long key, long val, eltype *data) { DoPut(key, val, data); } \
- void Put(long key, eltype *data) { DoPut(key, key, data); } \
- \
- eltype *Get(long key, long value) const \
- { \
- wxNodeBase *node = GetNode(key, value); \
- return node ? ((listclass::Node *)node)->GetData() : (eltype *)0; \
- } \
- eltype *Get(long key) const { return Get(key, key); } \
- \
- eltype *Delete(long key, long value) \
- { \
- eltype *data; \
- \
- wxNodeBase *node = GetNode(key, value); \
- if ( node ) \
- { \
- data = ((listclass::Node *)node)->GetData(); \
- \
- delete node; \
- m_count--; \
- } \
- else \
- { \
- data = (eltype *)0; \
- } \
- \
- return data; \
- } \
- eltype *Delete(long key) { return Delete(key, key); } \
- \
- protected: \
- void DoPut(long key, long value, eltype *data) \
- { \
- size_t slot = (size_t)abs((int)(key % (long)m_hashSize)); \
- \
- if ( !m_hashTable[slot] ) \
- { \
- m_hashTable[slot] = new listclass(m_keyType); \
- if ( m_deleteContents ) \
- m_hashTable[slot]->DeleteContents(TRUE); \
- } \
- \
- ((listclass *)m_hashTable[slot])->Append(value, data); \
- m_count++; \
- } \
+ void Put(long key, eltype *data) { DoPut(key, key, (void*)data); } \
+ void Put(long lhash, long key, eltype *data) \
+ { DoPut(key, lhash, (void*)data); } \
+ eltype *Get(long key) const { return (eltype*)DoGet(key, key); } \
+ eltype *Get(long lhash, long key) const \
+ { return (eltype*)DoGet(key, lhash); } \
+ eltype *Delete(long key) { return (eltype*)DoDelete(key, key); } \
+ eltype *Delete(long lhash, long key) \
+ { return (eltype*)DoDelete(key, lhash); } \
+ private: \
+ virtual void DoDeleteContents( wxHashTableBase_Node* node ) \
+ { delete (eltype*)node->GetData(); } \
+ \
+ DECLARE_NO_COPY_CLASS(hashclass) \