]> git.saurik.com Git - wxWidgets.git/blob - interface/hash.h
Fix for non-pch
[wxWidgets.git] / interface / hash.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: hash.h
3 // Purpose: interface of wxHashTable
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxHashTable
11 @wxheader{hash.h}
12
13 @b Please note that this class is retained for backward compatibility
14 reasons; you should use wxHashMap.
15
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
18 key.
19
20 @library{wxbase}
21 @category{containers}
22
23 @see wxList
24 */
25 class wxHashTable : public wxObject
26 {
27 public:
28 /**
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.
31 */
32 wxHashTable(unsigned int key_type, int size = 1000);
33
34 /**
35 Destroys the hash table.
36 */
37 ~wxHashTable();
38
39 /**
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
42 then loop on @e Next.
43 */
44 void BeginFind();
45
46 /**
47 Clears the hash table of all nodes (but as usual, doesn't delete user data).
48 */
49 void Clear();
50
51 //@{
52 /**
53 Deletes entry in hash table and returns the user's data (if found).
54 */
55 wxObject* Delete(long key);
56 wxObject* Delete(const wxString& key);
57 //@}
58
59 /**
60 If set to @true data stored in hash table will be deleted when hash table object
61 is destroyed.
62 */
63 void DeleteContents(bool flag);
64
65 //@{
66 /**
67 Gets data from the hash table, using an integer or string key (depending on
68 which
69 has table constructor was used).
70 */
71 wxObject* Get(long key);
72 wxObject* Get(const char* key);
73 //@}
74
75 /**
76 Returns the number of elements in the hash table.
77 */
78 size_t GetCount() const;
79
80 /**
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).
83 */
84 long MakeKey(const wxString& string);
85
86 /**
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.
93 */
94 wxHashTable::Node* Next();
95
96 //@{
97 /**
98 Inserts data into the hash table, using an integer or string key (depending on
99 which
100 has table constructor was used). The key string is copied and stored by the hash
101 table implementation.
102 */
103 void Put(long key, wxObject* object);
104 void Put(const char* key, wxObject* object);
105 //@}
106 };
107