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