X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/debe6624c1e9d4bf3243381153d1e173c849bcd8..695237bccd652c60deba347117ba5ab32067880c:/include/wx/hash.h diff --git a/include/wx/hash.h b/include/wx/hash.h index a1ae912a67..e5450054f0 100644 --- a/include/wx/hash.h +++ b/include/wx/hash.h @@ -9,8 +9,8 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifndef __WXHASHH__ -#define __WXHASHH__ +#ifndef _WX_WXHASHH__ +#define _WX_WXHASHH__ #ifdef __GNUG__ #pragma interface "hash.h" @@ -40,6 +40,13 @@ class WXDLLEXPORT wxHashTable: public wxObject wxHashTable(int the_key_type = wxKEY_INTEGER, int size = 1000); ~wxHashTable(void); + + // copy ctor and assignment operator + wxHashTable(const wxHashTable& table) { DoCopy(table); } + wxHashTable& operator=(const wxHashTable& table) { Clear(); DoCopy(table); return *this; } + void DoCopy(const wxHashTable& table); + + void Destroy(void); // Robert Roebling bool Create(int the_key_type = wxKEY_INTEGER, int size = 1000); @@ -57,30 +64,30 @@ class WXDLLEXPORT wxHashTable: public wxObject // key and value are NOT necessarily the same void Put(long key, long value, wxObject *object); - void Put(long key, const char *value, wxObject *object); + void Put(long key, const wxChar *value, wxObject *object); // key and value are the same void Put(long value, wxObject *object); - void Put(const char *value, wxObject *object); + void Put(const wxChar *value, wxObject *object); // key and value not the same wxObject *Get(long key, long value) const; - wxObject *Get(long key, const char *value) const; + wxObject *Get(long key, const wxChar *value) const; // key and value are the same wxObject *Get(long value) const; - wxObject *Get(const char *value) const; + wxObject *Get(const wxChar *value) const; // Deletes entry and returns data if found wxObject *Delete(long key); - wxObject *Delete(const char *key); + wxObject *Delete(const wxChar *key); wxObject *Delete(long key, int value); - wxObject *Delete(long key, const char *value); + wxObject *Delete(long key, const wxChar *value); // Construct your own integer key from a string, e.g. in case // you need to combine it with something - long MakeKey(const char *string) const; + long MakeKey(const wxChar *string) const; // Way of iterating through whole hash table (e.g. to delete everything) // Not necessary, of course, if you're only storing pointers to @@ -92,7 +99,13 @@ class WXDLLEXPORT wxHashTable: public wxObject void DeleteContents(bool flag); void Clear(void); + // Returns number of nodes + size_t GetCount() const { return m_count; } + + private: + size_t m_count; // number of elements in the hashtable + bool m_deleteContents; }; #endif - // __WXHASHH__ + // _WX_WXHASHH__