]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: hashset.h | |
e54c96f1 | 3 | // Purpose: interface of wxHashSet |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxHashSet | |
7c913512 | 11 | |
23324ae1 FM |
12 | This is a simple, type-safe, and reasonably efficient hash set class, |
13 | whose interface is a subset of the interface of STL containers. In | |
14 | particular, the interface is modeled after std::set, and the various, | |
15 | non-standard, std::hash_map. | |
7c913512 | 16 | |
23324ae1 FM |
17 | @library{wxbase} |
18 | @category{FIXME} | |
19 | */ | |
7c913512 | 20 | class wxHashSet |
23324ae1 FM |
21 | { |
22 | public: | |
23 | //@{ | |
24 | /** | |
25 | Copy constructor. | |
26 | */ | |
27 | wxHashSet(size_type size = 10); | |
7c913512 | 28 | wxHashSet(const wxHashSet& set); |
23324ae1 FM |
29 | //@} |
30 | ||
31 | //@{ | |
32 | /** | |
33 | Returns an iterator pointing at the first element of the hash set. | |
34 | Please remember that hash sets do not guarantee ordering. | |
35 | */ | |
36 | const_iterator begin(); | |
328f5751 | 37 | const iterator begin(); |
23324ae1 FM |
38 | //@} |
39 | ||
40 | /** | |
41 | Removes all elements from the hash set. | |
42 | */ | |
43 | void clear(); | |
44 | ||
45 | /** | |
46 | Counts the number of elements with the given key present in the set. | |
47 | This function returns only 0 or 1. | |
48 | */ | |
328f5751 | 49 | size_type count(const key_type& key) const; |
23324ae1 FM |
50 | |
51 | /** | |
52 | Returns @true if the hash set does not contain any elements, @false otherwise. | |
53 | */ | |
328f5751 | 54 | bool empty() const; |
23324ae1 FM |
55 | |
56 | //@{ | |
57 | /** | |
58 | Returns an iterator pointing at the one-after-the-last element of the hash set. | |
59 | Please remember that hash sets do not guarantee ordering. | |
60 | */ | |
61 | const_iterator end(); | |
328f5751 | 62 | const iterator end(); |
23324ae1 FM |
63 | //@} |
64 | ||
65 | //@{ | |
66 | /** | |
67 | Erases the element pointed to by the iterator. After the deletion | |
68 | the iterator is no longer valid and must not be used. | |
69 | */ | |
70 | size_type erase(const key_type& key); | |
7c913512 FM |
71 | void erase(iterator it); |
72 | void erase(const_iterator it); | |
23324ae1 FM |
73 | //@} |
74 | ||
75 | //@{ | |
76 | /** | |
77 | If an element with the given key is present, the functions returns | |
78 | an iterator pointing at that element, otherwise an invalid iterator | |
79 | is returned (i.e. hashset.find( non_existent_key ) == hashset.end()). | |
80 | */ | |
328f5751 FM |
81 | iterator find(const key_type& key) const; |
82 | const_iterator find(const key_type& key) const; | |
23324ae1 FM |
83 | //@} |
84 | ||
85 | /** | |
86 | Inserts the given value in the hash set. The return value is | |
87 | equivalent to a @c std::pairwxHashMap::iterator, bool; | |
88 | the iterator points to the inserted element, the boolean value | |
89 | is @true if @c v was actually inserted. | |
90 | */ | |
91 | Insert_Result insert(const value_type& v); | |
92 | ||
93 | /** | |
94 | Returns the number of elements in the set. | |
95 | */ | |
328f5751 | 96 | size_type size() const; |
23324ae1 | 97 | }; |
e54c96f1 | 98 |