]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/hash.h
Restore wxFile docs
[wxWidgets.git] / interface / wx / hash.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: hash.h
e54c96f1 3// Purpose: interface of wxHashTable
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxHashTable
7c913512 11
23324ae1
FM
12 @b Please note that this class is retained for backward compatibility
13 reasons; you should use wxHashMap.
7c913512 14
23324ae1
FM
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.
7c913512 18
23324ae1
FM
19 @library{wxbase}
20 @category{containers}
7c913512 21
e54c96f1 22 @see wxList
23324ae1
FM
23*/
24class wxHashTable : public wxObject
25{
26public:
27 /**
4cc4bfaf
FM
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.
23324ae1
FM
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 */
4cc4bfaf
FM
54 wxObject* Delete(long key);
55 wxObject* Delete(const wxString& key);
23324ae1
FM
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 */
4cc4bfaf
FM
70 wxObject* Get(long key);
71 wxObject* Get(const char* key);
23324ae1
FM
72 //@}
73
74 /**
75 Returns the number of elements in the hash table.
76 */
328f5751 77 size_t GetCount() const;
23324ae1
FM
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 */
4cc4bfaf 93 wxHashTable::Node* Next();
23324ae1
FM
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 */
4cc4bfaf
FM
102 void Put(long key, wxObject* object);
103 void Put(const char* key, wxObject* object);
23324ae1
FM
104 //@}
105};
e54c96f1 106