+#else
+
+#include "wx/hashmap.h"
+
+#if !defined(wxENUM_KEY_TYPE_DEFINED)
+#define wxENUM_KEY_TYPE_DEFINED
+
+enum wxKeyType
+{
+ wxKEY_NONE,
+ wxKEY_INTEGER,
+ wxKEY_STRING
+};
+
+#endif
+
+union wxHashKeyValue
+{
+ long integer;
+ wxChar *string;
+};
+
+struct WXDLLIMPEXP_BASE wxHashTableHash
+{
+ wxHashTableHash() { }
+ wxHashTableHash( wxKeyType keyType ) : m_keyType( keyType ) { }
+
+ wxKeyType m_keyType;
+
+ unsigned long operator ()( const wxHashKeyValue& k ) const
+ {
+ if( m_keyType == wxKEY_STRING )
+ return wxStringHash::wxCharStringHash( k.string );
+ else
+ return (unsigned long)k.integer;
+ }
+};
+
+struct WXDLLIMPEXP_BASE wxHashTableEqual
+{
+ wxHashTableEqual() { }
+ wxHashTableEqual( wxKeyType keyType ) : m_keyType( keyType ) { }
+
+ wxKeyType m_keyType;
+
+ bool operator ()( const wxHashKeyValue& k1, const wxHashKeyValue& k2 ) const
+ {
+ if( m_keyType == wxKEY_STRING )
+ return wxStrcmp( k1.string, k2.string ) == 0;
+ else
+ return k1.integer == k2.integer;
+ }
+};
+
+WX_DECLARE_EXPORTED_HASH_MAP( wxHashKeyValue,
+ void*,
+ wxHashTableHash,
+ wxHashTableEqual,
+ wxHashTableBaseBase );
+
+class WXDLLIMPEXP_BASE wxHashTableBase
+{
+public:
+ wxHashTableBase( wxKeyType keyType = wxKEY_INTEGER,
+ size_t size = wxHASH_SIZE_DEFAULT )
+ : m_map( size, wxHashTableHash( keyType ),
+ wxHashTableEqual( keyType ) ),
+ m_keyType( keyType ) { }
+
+ ~wxHashTableBase() { Clear(); }
+
+ size_t GetCount() const { return m_map.size(); }
+
+ void Clear()
+ {
+ if( m_keyType == wxKEY_STRING )
+ {
+ for( wxHashTableBaseBase::iterator it = m_map.begin(),
+ en = m_map.end();
+ it != en; )
+ {
+ wxChar* tmp = it->first.string;
+ ++it;
+ delete[] tmp; // used in operator++
+ }
+ }
+ m_map.clear();
+ }
+protected:
+ void DoPut( long key, void* data )
+ {
+ wxASSERT( m_keyType == wxKEY_INTEGER );
+
+ wxHashKeyValue k; k.integer = key;
+ m_map[k] = data;
+ }
+
+ void DoPut( const wxChar* key, void* data )
+ {
+ wxASSERT( m_keyType == wxKEY_STRING );
+
+ wxHashKeyValue k;
+ k.string = (wxChar*)key;
+ wxHashTableBaseBase::iterator it = m_map.find(k);
+
+ if( it == m_map.end() )
+ {
+ k.string = new wxChar[wxStrlen(key) + 1];
+ wxStrcpy(k.string, key);
+ m_map[k] = data;
+ }
+ else
+ it->second = data;
+ }
+
+ void* DoGet( long key ) const
+ {
+ wxASSERT( m_keyType == wxKEY_INTEGER );
+
+ wxHashKeyValue k; k.integer = key;
+ wxHashTableBaseBase::const_iterator it = m_map.find( k );
+
+ return it != m_map.end() ? it->second : NULL;
+ }
+
+ void* DoGet( const wxChar* key ) const
+ {
+ wxASSERT( m_keyType == wxKEY_STRING );
+
+ wxHashKeyValue k; k.string = (wxChar*)key;
+ wxHashTableBaseBase::const_iterator it = m_map.find( k );
+
+ return it != m_map.end() ? it->second : NULL;
+ }
+
+ void* DoDelete( long key )
+ {
+ wxASSERT( m_keyType == wxKEY_INTEGER );
+
+ wxHashKeyValue k; k.integer = key;
+ wxHashTableBaseBase::iterator it = m_map.find( k );
+
+ if( it != m_map.end() )
+ {
+ void* data = it->second;
+
+ m_map.erase( it );
+ return data;
+ }
+
+ return NULL;
+ }
+
+ void* DoDelete( const wxChar* key )
+ {
+ wxASSERT( m_keyType == wxKEY_STRING );
+
+ wxHashKeyValue k; k.string = (wxChar*)key;
+ wxHashTableBaseBase::iterator it = m_map.find( k );
+
+ if( it != m_map.end() )
+ {
+ void* data = it->second;
+ wxChar* k = it->first.string;
+
+ m_map.erase( it );
+ delete[] k;
+ return data;
+ }
+
+ return NULL;
+ }
+
+ wxHashTableBaseBase m_map;
+ wxKeyType m_keyType;
+};
+
+#endif // !wxUSE_STL
+
+#if !wxUSE_STL
+