]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/hash.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxHashTable
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
12 @b Please note that this class is retained for backward compatibility
13 reasons; you should use wxHashMap.
15 This class provides hash table functionality for wxWidgets, and for an
16 application if it wishes. Data can be hashed on an integer or string
24 class wxHashTable
: public wxObject
28 Constructor. @a key_type is one of wxKEY_INTEGER, or wxKEY_STRING,
29 and indicates what sort of keying is required. @a size is optional.
31 wxHashTable(unsigned int key_type
, int size
= 1000);
34 Destroys the hash table.
36 virtual ~wxHashTable();
39 The counterpart of @e Next. If the application wishes to iterate
40 through all the data in the hash table, it can call @e BeginFind and
46 Clears the hash table of all nodes (but as usual, doesn't delete user data).
52 Deletes entry in hash table and returns the user's data (if found).
54 wxObject
* Delete(long key
);
55 wxObject
* Delete(const wxString
& key
);
59 If set to @true data stored in hash table will be deleted when hash table object
62 void DeleteContents(bool flag
);
66 Gets data from the hash table, using an integer or string key (depending on
68 has table constructor was used).
70 wxObject
* Get(long key
);
71 wxObject
* Get(const char* key
);
75 Returns the number of elements in the hash table.
77 size_t GetCount() const;
80 Makes an integer key out of a string. An application may wish to make a key
81 explicitly (for instance when combining two data values to form a key).
83 static long MakeKey(const wxString
& string
);
86 If the application wishes to iterate through all the data in the hash
87 table, it can call @e BeginFind and then loop on @e Next. This function
88 returns a @b Node() pointer (or @NULL if there are no more nodes).
89 The return value is functionally equivalent to @b wxNode but might not be
90 implemented as a @b wxNode. The user will probably only wish to use the
91 @b GetData method to retrieve the data; the node may also be deleted.
93 wxHashTable::Node
* Next();
97 Inserts data into the hash table, using an integer or string key (depending on
99 has table constructor was used). The key string is copied and stored by the hash
100 table implementation.
102 void Put(long key
, wxObject
* object
);
103 void Put(const char* key
, wxObject
* object
);