OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 AddResult set(KeyPeekInType, MappedPassInType); | 119 AddResult set(KeyPeekInType, MappedPassInType); |
120 | 120 |
121 // does nothing if key is already present | 121 // does nothing if key is already present |
122 // return value is a pair of the iterator to the key location, | 122 // return value is a pair of the iterator to the key location, |
123 // and a boolean that's true if a new value was actually added | 123 // and a boolean that's true if a new value was actually added |
124 AddResult add(KeyPeekInType, MappedPassInType); | 124 AddResult add(KeyPeekInType, MappedPassInType); |
125 | 125 |
126 void remove(KeyPeekInType); | 126 void remove(KeyPeekInType); |
127 void remove(iterator); | 127 void remove(iterator); |
128 void clear(); | 128 void clear(); |
| 129 template<typename Collection> |
| 130 void removeAll(const Collection& toBeRemoved) { WTF::removeAll(*this, to
BeRemoved); } |
129 | 131 |
130 MappedPassOutType take(KeyPeekInType); // efficient combination of get w
ith remove | 132 MappedPassOutType take(KeyPeekInType); // efficient combination of get w
ith remove |
131 | 133 |
132 // An alternate version of find() that finds the object by hashing and c
omparing | 134 // An alternate version of find() that finds the object by hashing and c
omparing |
133 // with some other type, to avoid the cost of type conversion. HashTrans
lator | 135 // with some other type, to avoid the cost of type conversion. HashTrans
lator |
134 // must have the following function members: | 136 // must have the following function members: |
135 // static unsigned hash(const T&); | 137 // static unsigned hash(const T&); |
136 // static bool equal(const ValueType&, const T&); | 138 // static bool equal(const ValueType&, const T&); |
137 template<typename HashTranslator, typename T> iterator find(const T&); | 139 template<typename HashTranslator, typename T> iterator find(const T&); |
138 template<typename HashTranslator, typename T> const_iterator find(const
T&) const; | 140 template<typename HashTranslator, typename T> const_iterator find(const
T&) const; |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 iterator end = collection.end().values(); | 509 iterator end = collection.end().values(); |
508 for (unsigned i = 0; it != end; ++it, ++i) | 510 for (unsigned i = 0; it != end; ++it, ++i) |
509 vector[i] = *it; | 511 vector[i] = *it; |
510 } | 512 } |
511 | 513 |
512 } // namespace WTF | 514 } // namespace WTF |
513 | 515 |
514 using WTF::HashMap; | 516 using WTF::HashMap; |
515 | 517 |
516 #endif /* WTF_HashMap_h */ | 518 #endif /* WTF_HashMap_h */ |
OLD | NEW |