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