Debian Codegraph @

src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashMap.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 *
19 */
20
21 #ifndef WTF_HashMap_h
22 #define WTF_HashMap_hcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashMap.h:22:9`!
23
24 #include "HashTable.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h`/
25
26 namespace WTFcxx . . $ `<built-in>:467:9`! {
27
28 template<typename PairType> struct PairFirstExtractorcxx . . $ QTWTF/PairFirstExtractor#;
29
30 template<typename KeyArg, typename MappedArg, typename HashArg = typename DefaultHashcxx . . $ QTWTF/DefaultHash#<KeyArg>::Hash,
31 typename KeyTraitsArg = HashTraitscxx . . $ QTWTF/HashTraits#<KeyArg>, typename MappedTraitsArg = HashTraitscxx . . $ QTWTF/HashTraits#<MappedArg> >
32 class HashMapcxx . . $ QTWTF/HashMap# : public FastAllocBasecxx . . $ QTWTF/FastAllocBase# {
33 private:
34 typedef KeyTraitsArg KeyTraitscxx . . $ QTWTF/HashMap#KeyTraits#;
35 typedef MappedTraitsArg MappedTraitscxx . . $ QTWTF/HashMap#MappedTraits#;
36 typedef PairHashTraitscxx . . $ QTWTF/PairHashTraits#<KeyTraitscxx . . $ QTWTF/HashMap#KeyTraits#, MappedTraitscxx . . $ QTWTF/HashMap#MappedTraits#> ValueTraitscxx . . $ QTWTF/HashMap#ValueTraits#;
37
38 public:
39 typedef typename KeyTraitscxx . . $ QTWTF/HashMap#KeyTraits#::TraitType KeyTypecxx . . $ QTWTF/HashMap#KeyType#;
40 typedef typename MappedTraitscxx . . $ QTWTF/HashMap#MappedTraits#::TraitType MappedTypecxx . . $ QTWTF/HashMap#MappedType#;
41 typedef typename ValueTraitscxx . . $ QTWTF/HashMap#ValueTraits#::TraitType ValueTypecxx . . $ QTWTF/HashMap#ValueType#;
42
43 private:
44 typedef HashArg HashFunctionscxx . . $ QTWTF/HashMap#HashFunctions#;
45
46 typedef HashTablecxx . . $ QTWTF/HashTable#<KeyTypecxx . . $ QTWTF/HashMap#KeyType#, ValueTypecxx . . $ QTWTF/HashMap#ValueType#, PairFirstExtractorcxx . . $ QTWTF/PairFirstExtractor#<ValueTypecxx . . $ QTWTF/HashMap#ValueType#>,
47 HashFunctionscxx . . $ QTWTF/HashMap#HashFunctions#, ValueTraitscxx . . $ QTWTF/HashMap#ValueTraits#, KeyTraitscxx . . $ QTWTF/HashMap#KeyTraits#> HashTableTypecxx . . $ QTWTF/HashMap#HashTableType#;
48
49 public:
50 typedef HashTableIteratorAdaptercxx . . $ QTWTF/HashTableIteratorAdapter#<HashTableTypecxx . . $ QTWTF/HashMap#HashTableType#, ValueTypecxx . . $ QTWTF/HashMap#ValueType#> iteratorcxx . . $ QTWTF/HashMap#iterator#;
51 typedef HashTableConstIteratorAdaptercxx . . $ QTWTF/HashTableConstIteratorAdapter#<HashTableTypecxx . . $ QTWTF/HashMap#HashTableType#, ValueTypecxx . . $ QTWTF/HashMap#ValueType#> const_iteratorcxx . . $ QTWTF/HashMap#const_iterator#;
52
53 void swapcxx . . $ QTWTF/HashMap#swap(2860c731020d89de).(HashMap&);
54
55 int sizecxx . . $ QTWTF/HashMap#size(455f465bc33b4cdf).() const;
56 int capacitycxx . . $ QTWTF/HashMap#capacity(455f465bc33b4cdf).() const;
57 bool isEmptycxx . . $ QTWTF/HashMap#isEmpty(50ce9a9e25b4a850).() const;
58
59 // iterators iterate over pairs of keys and values
60 iteratorcxx . . $ QTWTF/HashMap#iterator# begincxx . . $ QTWTF/HashMap#begin(986fe7b85c0f397).();
61 iteratorcxx . . $ QTWTF/HashMap#iterator# endcxx . . $ QTWTF/HashMap#end(986fe7b85c0f397).();
62 const_iteratorcxx . . $ QTWTF/HashMap#const_iterator# begincxx . . $ QTWTF/HashMap#begin(31f6e9bf5ecd2b43).() const;
63 const_iteratorcxx . . $ QTWTF/HashMap#const_iterator# endcxx . . $ QTWTF/HashMap#end(31f6e9bf5ecd2b43).() const;
64
65 iteratorcxx . . $ QTWTF/HashMap#iterator# findcxx . . $ QTWTF/HashMap#find(afb70236f806b726).(const KeyTypecxx . . $ QTWTF/HashMap#KeyType#&);
66 const_iteratorcxx . . $ QTWTF/HashMap#const_iterator# findcxx . . $ QTWTF/HashMap#find(88d33ca431d01c5).(const KeyTypecxx . . $ QTWTF/HashMap#KeyType#&) const;
67 bool containscxx . . $ QTWTF/HashMap#contains(846cf93fb789cd8).(const KeyTypecxx . . $ QTWTF/HashMap#KeyType#&) const;
68 MappedTypecxx . . $ QTWTF/HashMap#MappedType# getcxx . . $ QTWTF/HashMap#get(1ae155e6fc1d8797).(const KeyTypecxx . . $ QTWTF/HashMap#KeyType#&) const;
69
70 // replaces value but not key if key is already present
71 // return value is a pair of the iterator to the key location,
72 // and a boolean that's true if a new value was actually added
73 paircxx . . $ QTWTF/pair#<iteratorcxx . . $ QTWTF/HashMap#iterator#, bool> setcxx . . $ QTWTF/HashMap#set(e61ba716440031a8).(const KeyTypecxx . . $ QTWTF/HashMap#KeyType#&, const MappedTypecxx . . $ QTWTF/HashMap#MappedType#&);
74
75 // does nothing if key is already present
76 // return value is a pair of the iterator to the key location,
77 // and a boolean that's true if a new value was actually added
78 paircxx . . $ QTWTF/pair#<iteratorcxx . . $ QTWTF/HashMap#iterator#, bool> addcxx . . $ QTWTF/HashMap#add(e61ba716440031a8).(const KeyTypecxx . . $ QTWTF/HashMap#KeyType#&, const MappedTypecxx . . $ QTWTF/HashMap#MappedType#&);
79
80 void removecxx . . $ QTWTF/HashMap#remove(d6e20c4a389f0962).(const KeyTypecxx . . $ QTWTF/HashMap#KeyType#&);
81 void removecxx . . $ QTWTF/HashMap#remove(863818dc0aad568c).(iteratorcxx . . $ QTWTF/HashMap#iterator#);
82 void clearcxx . . $ QTWTF/HashMap#clear(49f6e7a06ebc5aa8).();
83
84 MappedTypecxx . . $ QTWTF/HashMap#MappedType# takecxx . . $ QTWTF/HashMap#take(ed399c1bed1be543).(const KeyTypecxx . . $ QTWTF/HashMap#KeyType#&); // efficient combination of get with remove
85
86 // An alternate version of find() that finds the object by hashing and comparing
87 // with some other type, to avoid the cost of type conversion. HashTranslator
88 // must have the following function members:
89 // static unsigned hash(const T&);
90 // static bool equal(const ValueType&, const T&);
91 template<typename T, typename HashTranslator> iteratorcxx . . $ QTWTF/HashMap#iterator# findcxx . . $ QTWTF/HashMap#find(ecb71332326468ca).(const T&);
92 template<typename T, typename HashTranslator> const_iteratorcxx . . $ QTWTF/HashMap#const_iterator# findcxx . . $ QTWTF/HashMap#find(eed954e1e9c8841f).(const T&) const;
93 template<typename T, typename HashTranslator> bool containscxx . . $ QTWTF/HashMap#contains(52aad8a5ba75b80f).(const T&) const;
94
95 // An alternate version of add() that finds the object by hashing and comparing
96 // with some other type, to avoid the cost of type conversion if the object is already
97 // in the table. HashTranslator must have the following function members:
98 // static unsigned hash(const T&);
99 // static bool equal(const ValueType&, const T&);
100 // static translate(ValueType&, const T&, unsigned hashCode);
101 template<typename T, typename HashTranslator> paircxx . . $ QTWTF/pair#<iteratorcxx . . $ QTWTF/HashMap#iterator#, bool> addcxx . . $ QTWTF/HashMap#add(de65537c4949ed68).(const T&, const MappedTypecxx . . $ QTWTF/HashMap#MappedType#&);
102
103 private:
104 paircxx . . $ QTWTF/pair#<iteratorcxx . . $ QTWTF/HashMap#iterator#, bool> inlineAddcxx . . $ QTWTF/HashMap#inlineAdd(e61ba716440031a8).(const KeyTypecxx . . $ QTWTF/HashMap#KeyType#&, const MappedTypecxx . . $ QTWTF/HashMap#MappedType#&);
105
106 HashTableTypecxx . . $ QTWTF/HashMap#HashTableType# m_implcxx . . $ QTWTF/HashMap#m_impl.;
107 };
108
109 template<typename PairType> struct PairFirstExtractorcxx . . $ QTWTF/PairFirstExtractor# {
110 static const typename PairType::first_type& extractcxx . . $ QTWTF/PairFirstExtractor#extract(7c396f89f212f775).(const PairType& p) { return p.first; }
111 };
112
113 template<typename ValueType, typename ValueTraits, typename HashFunctions>
114 struct HashMapTranslatorcxx . . $ QTWTF/HashMapTranslator# {
115 typedef typename ValueType::first_type KeyTypecxx . . $ QTWTF/HashMapTranslator#KeyType#;
116 typedef typename ValueType::second_type MappedTypecxx . . $ QTWTF/HashMapTranslator#MappedType#;
117
118 static unsigned hashcxx . . $ QTWTF/HashMapTranslator#hash(1b37e7a4aeb71294).(const KeyTypecxx . . $ QTWTF/HashMapTranslator#KeyType#& key) { return HashFunctions::hash(key); }
119 static bool equalcxx . . $ QTWTF/HashMapTranslator#equal(9c46e4741f16ddbc).(const KeyTypecxx . . $ QTWTF/HashMapTranslator#KeyType#& a, const KeyTypecxx . . $ QTWTF/HashMapTranslator#KeyType#& b) { return HashFunctions::equal(a, b); }
120 static void translatecxx . . $ QTWTF/HashMapTranslator#translate(532bd8d9b1bddce).(ValueType& location, const KeyTypecxx . . $ QTWTF/HashMapTranslator#KeyType#& key, const MappedTypecxx . . $ QTWTF/HashMapTranslator#MappedType#& mapped)
121 {
122 location.first = key;
123 location.second = mapped;
124 }
125 };
126
127 template<typename ValueType, typename ValueTraits, typename T, typename Translator>
128 struct HashMapTranslatorAdaptercxx . . $ QTWTF/HashMapTranslatorAdapter# {
129 typedef typename ValueType::first_type KeyTypecxx . . $ QTWTF/HashMapTranslatorAdapter#KeyType#;
130 typedef typename ValueType::second_type MappedTypecxx . . $ QTWTF/HashMapTranslatorAdapter#MappedType#;
131
132 static unsigned hashcxx . . $ QTWTF/HashMapTranslatorAdapter#hash(55604f8245c8efb).(const T& key) { return Translator::hash(key); }
133 static bool equalcxx . . $ QTWTF/HashMapTranslatorAdapter#equal(344f6402fbbbda7a).(const KeyTypecxx . . $ QTWTF/HashMapTranslatorAdapter#KeyType#& a, const T& b) { return Translator::equal(a, b); }
134 static void translatecxx . . $ QTWTF/HashMapTranslatorAdapter#translate(9ab3380683fba861).(ValueType& location, const T& key, const MappedTypecxx . . $ QTWTF/HashMapTranslatorAdapter#MappedType#&, unsigned hashCode)
135 {
136 Translator::translate(location.first, key, hashCode);
137 }
138 };
139
140 template<typename T, typename U, typename V, typename W, typename X>
141 inline void HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::swapcxx . . $ QTWTF/HashMap#swap(2860c731020d89de).(HashMap& other)
142 {
143 m_implcxx . . $ QTWTF/HashMap#m_impl..swapcxx . . $ QTWTF/HashTable#swap(4c3dc139c52ec836).(other.m_implcxx . . $ QTWTF/HashMap#m_impl.);
144 }
145
146 template<typename T, typename U, typename V, typename W, typename X>
147 inline int HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::sizecxx . . $ QTWTF/HashMap#size(455f465bc33b4cdf).() const
148 {
149 return m_implcxx . . $ QTWTF/HashMap#m_impl..sizecxx . . $ QTWTF/HashTable#size(455f465bc33b4cdf).();
150 }
151
152 template<typename T, typename U, typename V, typename W, typename X>
153 inline int HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::capacitycxx . . $ QTWTF/HashMap#capacity(455f465bc33b4cdf).() const
154 {
155 return m_implcxx . . $ QTWTF/HashMap#m_impl..capacitycxx . . $ QTWTF/HashTable#capacity(455f465bc33b4cdf).();
156 }
157
158 template<typename T, typename U, typename V, typename W, typename X>
159 inline bool HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::isEmptycxx . . $ QTWTF/HashMap#isEmpty(50ce9a9e25b4a850).() const
160 {
161 return m_implcxx . . $ QTWTF/HashMap#m_impl..isEmptycxx . . $ QTWTF/HashTable#isEmpty(50ce9a9e25b4a850).();
162 }
163
164 template<typename T, typename U, typename V, typename W, typename X>
165 inline typename HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::iteratorcxx . . $ QTWTF/HashMap#iterator# HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::begincxx . . $ QTWTF/HashMap#begin(986fe7b85c0f397).()
166 {
167 return m_implcxx . . $ QTWTF/HashMap#m_impl..begincxx . . $ QTWTF/HashTable#begin(400fc12dfeddc5c0).();
168 }
169
170 template<typename T, typename U, typename V, typename W, typename X>
171 inline typename HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::iteratorcxx . . $ QTWTF/HashMap#iterator# HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::endcxx . . $ QTWTF/HashMap#end(986fe7b85c0f397).()
172 {
173 return m_implcxx . . $ QTWTF/HashMap#m_impl..endcxx . . $ QTWTF/HashTable#end(400fc12dfeddc5c0).();
174 }
175
176 template<typename T, typename U, typename V, typename W, typename X>
177 inline typename HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::const_iteratorcxx . . $ QTWTF/HashMap#const_iterator# HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::begincxx . . $ QTWTF/HashMap#begin(31f6e9bf5ecd2b43).() const
178 {
179 return m_implcxx . . $ QTWTF/HashMap#m_impl..begincxx . . $ QTWTF/HashTable#begin(400fc12dfeddc5c0).();
180 }
181
182 template<typename T, typename U, typename V, typename W, typename X>
183 inline typename HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::const_iteratorcxx . . $ QTWTF/HashMap#const_iterator# HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::endcxx . . $ QTWTF/HashMap#end(31f6e9bf5ecd2b43).() const
184 {
185 return m_implcxx . . $ QTWTF/HashMap#m_impl..endcxx . . $ QTWTF/HashTable#end(6bb497947033b321).();
186 }
187
188 template<typename T, typename U, typename V, typename W, typename X>
189 inline typename HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::iteratorcxx . . $ QTWTF/HashMap#iterator# HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::findcxx . . $ QTWTF/HashMap#find(afb70236f806b726).(const KeyTypecxx . . $ QTWTF/HashMap#KeyType#& key)
190 {
191 return m_implcxx . . $ QTWTF/HashMap#m_impl..findcxx . . $ QTWTF/HashTable#find(82ffd35d6795a744).(key);
192 }
193
194 template<typename T, typename U, typename V, typename W, typename X>
195 inline typename HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::const_iteratorcxx . . $ QTWTF/HashMap#const_iterator# HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::findcxx . . $ QTWTF/HashMap#find(88d33ca431d01c5).(const KeyTypecxx . . $ QTWTF/HashMap#KeyType#& key) const
196 {
197 return m_implcxx . . $ QTWTF/HashMap#m_impl..findcxx . . $ QTWTF/HashTable#find(82ffd35d6795a744).(key);
198 }
199
200 template<typename T, typename U, typename V, typename W, typename X>
201 inline bool HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::containscxx . . $ QTWTF/HashMap#contains(846cf93fb789cd8).(const KeyTypecxx . . $ QTWTF/HashMap#KeyType#& key) const
202 {
203 return m_implcxx . . $ QTWTF/HashMap#m_impl..containscxx . . $ QTWTF/HashTable#contains(8877ebe272b9620d).(key);
204 }
205
206 template<typename T, typename U, typename V, typename W, typename X>
207 template<typename TYPE, typename HashTranslator>
208 inline typename HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::iteratorcxx . . $ QTWTF/HashMap#iterator#
209 HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::findcxx . . $ QTWTF/HashMap#find(ecb71332326468ca).(const TYPE& value)
210 {
211 typedef HashMapTranslatorAdaptercxx . . $ QTWTF/HashMapTranslatorAdapter#<ValueTypecxx . . $ QTWTF/HashMap#ValueType#, ValueTraitscxx . . $ QTWTF/HashMap#ValueTraits#, TYPE, HashTranslator> Adaptercxx . . $ QTWTF/HashMap#find(ecb71332326468ca).Adapter#;
212 return m_implcxx . . $ QTWTF/HashMap#m_impl..template findcxx . . $ QTWTF/HashTable#find(10c59f90f1b43478).<TYPE, Adaptercxx . . $ QTWTF/HashMap#find(ecb71332326468ca).Adapter#>(value);
213 }
214
215 template<typename T, typename U, typename V, typename W, typename X>
216 template<typename TYPE, typename HashTranslator>
217 inline typename HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::const_iteratorcxx . . $ QTWTF/HashMap#const_iterator#
218 HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::findcxx . . $ QTWTF/HashMap#find(eed954e1e9c8841f).(const TYPE& value) const
219 {
220 typedef HashMapTranslatorAdaptercxx . . $ QTWTF/HashMapTranslatorAdapter#<ValueTypecxx . . $ QTWTF/HashMap#ValueType#, ValueTraitscxx . . $ QTWTF/HashMap#ValueTraits#, TYPE, HashTranslator> Adaptercxx . . $ QTWTF/HashMap#find(eed954e1e9c8841f).Adapter#;
221 return m_implcxx . . $ QTWTF/HashMap#m_impl..template findcxx . . $ QTWTF/HashTable#find(10c59f90f1b43478).<TYPE, Adaptercxx . . $ QTWTF/HashMap#find(eed954e1e9c8841f).Adapter#>(value);
222 }
223
224 template<typename T, typename U, typename V, typename W, typename X>
225 template<typename TYPE, typename HashTranslator>
226 inline bool
227 HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::containscxx . . $ QTWTF/HashMap#contains(52aad8a5ba75b80f).(const TYPE& value) const
228 {
229 typedef HashMapTranslatorAdaptercxx . . $ QTWTF/HashMapTranslatorAdapter#<ValueTypecxx . . $ QTWTF/HashMap#ValueType#, ValueTraitscxx . . $ QTWTF/HashMap#ValueTraits#, TYPE, HashTranslator> Adaptercxx . . $ QTWTF/HashMap#contains(52aad8a5ba75b80f).Adapter#;
230 return m_implcxx . . $ QTWTF/HashMap#m_impl..template containscxx . . $ QTWTF/HashTable#contains(8877ebe272b9620d).<TYPE, Adaptercxx . . $ QTWTF/HashMap#contains(52aad8a5ba75b80f).Adapter#>(value);
231 }
232
233 template<typename T, typename U, typename V, typename W, typename X>
234 inline paircxx . . $ QTWTF/pair#<typename HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::iteratorcxx . . $ QTWTF/HashMap#iterator#, bool>
235 HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::inlineAddcxx . . $ QTWTF/HashMap#inlineAdd(e61ba716440031a8).(const KeyTypecxx . . $ QTWTF/HashMap#KeyType#& key, const MappedTypecxx . . $ QTWTF/HashMap#MappedType#& mapped)
236 {
237 typedef HashMapTranslatorcxx . . $ QTWTF/HashMapTranslator#<ValueTypecxx . . $ QTWTF/HashMap#ValueType#, ValueTraitscxx . . $ QTWTF/HashMap#ValueTraits#, HashFunctionscxx . . $ QTWTF/HashMap#HashFunctions#> TranslatorTypecxx . . $ QTWTF/HashMap#inlineAdd(e61ba716440031a8).TranslatorType#;
238 paircxx . . $ QTWTF/pair#<typename HashTableTypecxx . . $ QTWTF/HashMap#HashTableType#::iterator, bool> p = m_implcxx . . $ QTWTF/HashMap#m_impl..template addcxx . . $ QTWTF/HashTable#add(b8ed51a42316103f).<KeyTypecxx . . $ QTWTF/HashMap#KeyType#, MappedTypecxx . . $ QTWTF/HashMap#MappedType#, TranslatorTypecxx . . $ QTWTF/HashMap#inlineAdd(e61ba716440031a8).TranslatorType#>(key, mapped);
239 typename HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::iteratorcxx . . $ QTWTF/HashMap#iterator# temp = p.firstcxx . . $ std/pair#first.;
240 return stdcxx . . $ std/::paircxx . . $ std/pair#<typename HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::iteratorcxx . . $ QTWTF/HashMap#iterator#, bool>(temp, p.secondcxx . . $ std/pair#second.);
241 // return m_impl.template add<KeyType, MappedType, TranslatorType>(key, mapped);
242 }
243
244 template<typename T, typename U, typename V, typename W, typename X>
245 paircxx . . $ QTWTF/pair#<typename HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::iteratorcxx . . $ QTWTF/HashMap#iterator#, bool>
246 HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::setcxx . . $ QTWTF/HashMap#set(e61ba716440031a8).(const KeyTypecxx . . $ QTWTF/HashMap#KeyType#& key, const MappedTypecxx . . $ QTWTF/HashMap#MappedType#& mapped)
247 {
248 paircxx . . $ QTWTF/pair#<iteratorcxx . . $ QTWTF/HashMap#iterator#, bool> result = inlineAddcxx . . $ QTWTF/HashMap#inlineAdd(e61ba716440031a8).(key, mapped);
249 if (!result.secondcxx . . $ std/pair#second.) {
250 // add call above didn't change anything, so set the mapped value
251 result.firstcxx . . $ std/pair#first.->second = mapped;
252 }
253 return result;
254 }
255
256 template<typename T, typename U, typename V, typename W, typename X>
257 template<typename TYPE, typename HashTranslator>
258 paircxx . . $ QTWTF/pair#<typename HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::iteratorcxx . . $ QTWTF/HashMap#iterator#, bool>
259 HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::addcxx . . $ QTWTF/HashMap#add(de65537c4949ed68).(const TYPE& key, const MappedTypecxx . . $ QTWTF/HashMap#MappedType#& value)
260 {
261 typedef HashMapTranslatorAdaptercxx . . $ QTWTF/HashMapTranslatorAdapter#<ValueTypecxx . . $ QTWTF/HashMap#ValueType#, ValueTraitscxx . . $ QTWTF/HashMap#ValueTraits#, TYPE, HashTranslator> Adaptercxx . . $ QTWTF/HashMap#add(de65537c4949ed68).Adapter#;
262 return m_implcxx . . $ QTWTF/HashMap#m_impl..template addPassingHashCodecxx . . $ QTWTF/HashTable#addPassingHashCode(f69b394842063ec6).<TYPE, MappedTypecxx . . $ QTWTF/HashMap#MappedType#, Adaptercxx . . $ QTWTF/HashMap#add(de65537c4949ed68).Adapter#>(key, value);
263 }
264
265 template<typename T, typename U, typename V, typename W, typename X>
266 paircxx . . $ QTWTF/pair#<typename HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::iteratorcxx . . $ QTWTF/HashMap#iterator#, bool>
267 HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::addcxx . . $ QTWTF/HashMap#add(e61ba716440031a8).(const KeyTypecxx . . $ QTWTF/HashMap#KeyType#& key, const MappedTypecxx . . $ QTWTF/HashMap#MappedType#& mapped)
268 {
269 return inlineAddcxx . . $ QTWTF/HashMap#inlineAdd(e61ba716440031a8).(key, mapped);
270 }
271
272 template<typename T, typename U, typename V, typename W, typename MappedTraits>
273 typename HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, MappedTraits>::MappedTypecxx . . $ QTWTF/HashMap#MappedType#
274 HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, MappedTraits>::getcxx . . $ QTWTF/HashMap#get(1ae155e6fc1d8797).(const KeyTypecxx . . $ QTWTF/HashMap#KeyType#& key) const
275 {
276 ValueTypecxx . . $ QTWTF/HashMap#ValueType#* entry = const_cast<HashTableTypecxx . . $ QTWTF/HashMap#HashTableType#&>(m_implcxx . . $ QTWTF/HashMap#m_impl.).lookupcxx . . $ QTWTF/HashTable#lookup(b8803fc2f699eb8b).(key);
277 if (!entry)
278 return MappedTraitscxx . . $ QTWTF/HashMap#MappedTraits#::emptyValue();
279 return entry->second;
280 }
281
282 template<typename T, typename U, typename V, typename W, typename X>
283 inline void HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::removecxx . . $ QTWTF/HashMap#remove(863818dc0aad568c).(iteratorcxx . . $ QTWTF/HashMap#iterator# it)
284 {
285 if (it.m_implcxx . . $ QTWTF/HashTableIteratorAdapter#m_impl. ==cxx . . $ QTWTF/`operator==`(b1a6445b02f80637). m_implcxx . . $ QTWTF/HashMap#m_impl..endcxx . . $ QTWTF/HashTable#end(6bb497947033b321).())
286 return;
287 m_implcxx . . $ QTWTF/HashMap#m_impl..checkTableConsistencycxx . . $ QTWTF/HashTable#checkTableConsistency(49f6e7a06ebc5aa8).();
288 m_implcxx . . $ QTWTF/HashMap#m_impl..removeWithoutEntryConsistencyCheckcxx . . $ QTWTF/HashTable#removeWithoutEntryConsistencyCheck(90fee5ddac1206fd).(it.m_implcxx . . $ QTWTF/HashTableIteratorAdapter#m_impl.);
289 }
290
291 template<typename T, typename U, typename V, typename W, typename X>
292 inline void HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::removecxx . . $ QTWTF/HashMap#remove(d6e20c4a389f0962).(const KeyTypecxx . . $ QTWTF/HashMap#KeyType#& key)
293 {
294 removecxx . . $ QTWTF/HashMap#remove(d6e20c4a389f0962).(findcxx . . $ QTWTF/HashMap#find(afb70236f806b726).(key));
295 }
296
297 template<typename T, typename U, typename V, typename W, typename X>
298 inline void HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::clearcxx . . $ QTWTF/HashMap#clear(49f6e7a06ebc5aa8).()
299 {
300 m_implcxx . . $ QTWTF/HashMap#m_impl..clearcxx . . $ QTWTF/HashTable#clear(49f6e7a06ebc5aa8).();
301 }
302
303 template<typename T, typename U, typename V, typename W, typename MappedTraits>
304 typename HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, MappedTraits>::MappedTypecxx . . $ QTWTF/HashMap#MappedType#
305 HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, MappedTraits>::takecxx . . $ QTWTF/HashMap#take(ed399c1bed1be543).(const KeyTypecxx . . $ QTWTF/HashMap#KeyType#& key)
306 {
307 // This can probably be made more efficient to avoid ref/deref churn.
308 iteratorcxx . . $ QTWTF/HashMap#iterator# it = findcxx . . $ QTWTF/HashMap#find(afb70236f806b726).(key);
309 if (it ==cxx . . $ QTWTF/`operator==`(d7551dba2187fdc0). endcxx . . $ QTWTF/HashMap#end(31f6e9bf5ecd2b43).())
310 return MappedTraitscxx . . $ QTWTF/HashMap#MappedTraits#::emptyValue();
311 typename HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, MappedTraits>::MappedTypecxx . . $ QTWTF/HashMap#MappedType# result = it->second;
312 removecxx . . $ QTWTF/HashMap#remove(d6e20c4a389f0962).(it);
313 return result;
314 }
315
316 template<typename T, typename U, typename V, typename W, typename X>
317 bool operatorcxx . . $ QTWTF/`operator==`(322c9107fe888812).==(const HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>& a, const HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>& b)
318 {
319 if (a.sizecxx . . $ QTWTF/HashMap#size(455f465bc33b4cdf).() !=cxx . . $ QTWTF/`operator!=`(a84e0eb909a2e1ac). b.sizecxx . . $ QTWTF/HashMap#size(455f465bc33b4cdf).())
320 return false;
321
322 typedef typename HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::const_iterator const_iteratorcxx . . $ QTWTF/`operator==`(322c9107fe888812).const_iterator#;
323
324 const_iteratorcxx . . $ QTWTF/`operator==`(322c9107fe888812).const_iterator# end = a.endcxx . . $ QTWTF/HashMap#end(31f6e9bf5ecd2b43).();
325 const_iteratorcxx . . $ QTWTF/`operator==`(322c9107fe888812).const_iterator# notFound = b.endcxx . . $ QTWTF/HashMap#end(31f6e9bf5ecd2b43).();
326 for (const_iteratorcxx . . $ QTWTF/`operator==`(322c9107fe888812).const_iterator# it = a.begincxx . . $ QTWTF/HashMap#begin(31f6e9bf5ecd2b43).(); it !=cxx . . $ QTWTF/`operator!=`(a84e0eb909a2e1ac). end; ++it) {
327 const_iteratorcxx . . $ QTWTF/`operator==`(322c9107fe888812).const_iterator# bPos = b.findcxx . . $ QTWTF/HashMap#find(afb70236f806b726).(it->first);
328 if (bPos ==cxx . . $ QTWTF/`operator==`(4c66e9ff63e4f9d3). notFound || it->second !=cxx . . $ QTWTF/`operator!=`(31369b2754de4004). bPos->second)
329 return false;
330 }
331
332 return true;
333 }
334
335 template<typename T, typename U, typename V, typename W, typename X>
336 inline bool operatorcxx . . $ QTWTF/`operator!=`(322c9107fe888812).!=(const HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>& a, const HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>& b)
337 {
338 return !(a ==cxx . . $ QTWTF/`operator==`(a84e0eb909a2e1ac). b);
339 }
340
341 template<typename MappedType, typename HashTableType>
342 void deleteAllPairSecondscxx . . $ QTWTF/deleteAllPairSeconds(b32c8f942b92bd92).(HashTableType& collection)
343 {
344 typedef typename HashTableType::const_iterator iteratorcxx . . $ QTWTF/deleteAllPairSeconds(b32c8f942b92bd92).iterator#;
345 iteratorcxx . . $ QTWTF/deleteAllPairSeconds(b32c8f942b92bd92).iterator# end = collection.end();
346 for (iteratorcxx . . $ QTWTF/deleteAllPairSeconds(b32c8f942b92bd92).iterator# it = collection.begin(); it !=cxx . . $ QTWTF/`operator!=`(4c66e9ff63e4f9d3). end; ++it)
347 delete it->second;
348 }
349
350 template<typename T, typename U, typename V, typename W, typename X>
351 inline void deleteAllValuescxx . . $ QTWTF/deleteAllValues(235734144632e3c0).(const HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>& collection)
352 {
353 deleteAllPairSecondscxx . . $ QTWTF/deleteAllPairSeconds(b32c8f942b92bd92).<typename HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::MappedType>(collection);
354 }
355
356 template<typename KeyType, typename HashTableType>
357 void deleteAllPairFirstscxx . . $ QTWTF/deleteAllPairFirsts(b32c8f942b92bd92).(HashTableType& collection)
358 {
359 typedef typename HashTableType::const_iterator iteratorcxx . . $ QTWTF/deleteAllPairFirsts(b32c8f942b92bd92).iterator#;
360 iteratorcxx . . $ QTWTF/deleteAllPairFirsts(b32c8f942b92bd92).iterator# end = collection.end();
361 for (iteratorcxx . . $ QTWTF/deleteAllPairFirsts(b32c8f942b92bd92).iterator# it = collection.begin(); it !=cxx . . $ QTWTF/`operator!=`(533d91b32a0a6cc1). end; ++it)
362 delete it->first;
363 }
364
365 template<typename T, typename U, typename V, typename W, typename X>
366 inline void deleteAllKeyscxx . . $ QTWTF/deleteAllKeys(235734144632e3c0).(const HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>& collection)
367 {
368 deleteAllPairFirstscxx . . $ QTWTF/deleteAllPairFirsts(b32c8f942b92bd92).<typename HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::KeyType>(collection);
369 }
370
371 template<typename T, typename U, typename V, typename W, typename X, typename Y>
372 inline void copyKeysToVectorcxx . . $ QTWTF/copyKeysToVector(fb9ee05c74683941).(const HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>& collection, Y& vector)
373 {
374 typedef typename HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::const_iterator::Keys iteratorcxx . . $ QTWTF/copyKeysToVector(fb9ee05c74683941).iterator#;
375
376 vector.resize(collection.sizecxx . . $ QTWTF/HashMap#size(455f465bc33b4cdf).());
377
378 iteratorcxx . . $ QTWTF/copyKeysToVector(fb9ee05c74683941).iterator# it = collection.begincxx . . $ QTWTF/HashMap#begin(31f6e9bf5ecd2b43).().keys();
379 iteratorcxx . . $ QTWTF/copyKeysToVector(fb9ee05c74683941).iterator# end = collection.endcxx . . $ QTWTF/HashMap#end(31f6e9bf5ecd2b43).().keys();
380 for (unsigned i = 0; it !=cxx . . $ QTWTF/`operator!=`(4c66e9ff63e4f9d3). end; ++it, ++i)
381 vector[i] = *it;
382 }
383
384 template<typename T, typename U, typename V, typename W, typename X, typename Y>
385 inline void copyValuesToVectorcxx . . $ QTWTF/copyValuesToVector(fb9ee05c74683941).(const HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>& collection, Y& vector)
386 {
387 typedef typename HashMapcxx . . $ QTWTF/HashMap#<T, U, V, W, X>::const_iterator::Values iteratorcxx . . $ QTWTF/copyValuesToVector(fb9ee05c74683941).iterator#;
388
389 vector.resize(collection.sizecxx . . $ QTWTF/HashMap#size(455f465bc33b4cdf).());
390
391 iteratorcxx . . $ QTWTF/copyValuesToVector(fb9ee05c74683941).iterator# it = collection.begincxx . . $ QTWTF/HashMap#begin(31f6e9bf5ecd2b43).().values();
392 iteratorcxx . . $ QTWTF/copyValuesToVector(fb9ee05c74683941).iterator# end = collection.endcxx . . $ QTWTF/HashMap#end(31f6e9bf5ecd2b43).().values();
393 for (unsigned i = 0; it !=cxx . . $ QTWTF/`operator!=`(69feba05d53a7241). end; ++it, ++i)
394 vector[i] = *it;
395 }
396
397 } // namespace WTF
398
399 using WTFcxx . . $ `<built-in>:467:9`!::HashMapcxx . . $ QTWTF/HashMap#;
400
401 #include "RefPtrHashMap.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/RefPtrHashMap.h`/
402
403 #endif /* WTF_HashMap_h */