]>
git.saurik.com Git - wxWidgets.git/blob - interface/hash.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxHashTable
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
13 @b Please note that this class is retained for backward compatibility
14 reasons; you should use wxHashMap.
16 This class provides hash table functionality for wxWidgets, and for an
17 application if it wishes. Data can be hashed on an integer or string
25 class wxHashTable
: public wxObject
29 Constructor. @a key_type is one of wxKEY_INTEGER, or wxKEY_STRING,
30 and indicates what sort of keying is required. @a size is optional.
32 wxHashTable(unsigned int key_type
, int size
= 1000);
35 Destroys the hash table.
40 The counterpart of @e Next. If the application wishes to iterate
41 through all the data in the hash table, it can call @e BeginFind and
47 Clears the hash table of all nodes (but as usual, doesn't delete user data).
53 Deletes entry in hash table and returns the user's data (if found).
55 wxObject
* Delete(long key
);
56 wxObject
* Delete(const wxString
& key
);
60 If set to @true data stored in hash table will be deleted when hash table object
63 void DeleteContents(bool flag
);
67 Gets data from the hash table, using an integer or string key (depending on
69 has table constructor was used).
71 wxObject
* Get(long key
);
72 wxObject
* Get(const char* key
);
76 Returns the number of elements in the hash table.
78 size_t GetCount() const;
81 Makes an integer key out of a string. An application may wish to make a key
82 explicitly (for instance when combining two data values to form a key).
84 long MakeKey(const wxString
& string
);
87 If the application wishes to iterate through all the data in the hash
88 table, it can call @e BeginFind and then loop on @e Next. This function
89 returns a @b Node() pointer (or @NULL if there are no more nodes).
90 The return value is functionally equivalent to @b wxNode but might not be
91 implemented as a @b wxNode. The user will probably only wish to use the
92 @b GetData method to retrieve the data; the node may also be deleted.
94 wxHashTable::Node
* Next();
98 Inserts data into the hash table, using an integer or string key (depending on
100 has table constructor was used). The key string is copied and stored by the hash
101 table implementation.
103 void Put(long key
, wxObject
* object
);
104 void Put(const char* key
, wxObject
* object
);