| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 bool remove(const ValueType& value) { return remove(find(value)); } | 79 bool remove(const ValueType& value) { return remove(find(value)); } |
| 80 bool remove(iterator); | 80 bool remove(iterator); |
| 81 | 81 |
| 82 // Removes the value, regardless of its count. | 82 // Removes the value, regardless of its count. |
| 83 void removeAll(const ValueType& value) { removeAll(find(value)); } | 83 void removeAll(const ValueType& value) { removeAll(find(value)); } |
| 84 void removeAll(iterator); | 84 void removeAll(iterator); |
| 85 | 85 |
| 86 // Clears the whole set. | 86 // Clears the whole set. |
| 87 void clear() { m_impl.clear(); } | 87 void clear() { m_impl.clear(); } |
| 88 | 88 |
| 89 Vector<Value> asVector() const; |
| 90 |
| 89 template <typename VisitorDispatcher> | 91 template <typename VisitorDispatcher> |
| 90 void trace(VisitorDispatcher visitor) { m_impl.trace(visitor); } | 92 void trace(VisitorDispatcher visitor) { m_impl.trace(visitor); } |
| 91 | 93 |
| 92 private: | 94 private: |
| 93 ImplType m_impl; | 95 ImplType m_impl; |
| 94 }; | 96 }; |
| 95 | 97 |
| 96 template <typename T, typename U, typename V, typename W> | 98 template <typename T, typename U, typename V, typename W> |
| 97 inline typename HashCountedSet<T, U, V, W>::AddResult HashCountedSet<T, U, V, W>
::add(const ValueType& value, unsigned count) | 99 inline typename HashCountedSet<T, U, V, W>::AddResult HashCountedSet<T, U, V, W>
::add(const ValueType& value, unsigned count) |
| 98 { | 100 { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 typename VectorType::GCForbiddenScope scope; | 145 typename VectorType::GCForbiddenScope scope; |
| 144 vector.resize(collection.size()); | 146 vector.resize(collection.size()); |
| 145 } | 147 } |
| 146 | 148 |
| 147 auto it = collection.begin(); | 149 auto it = collection.begin(); |
| 148 auto end = collection.end(); | 150 auto end = collection.end(); |
| 149 for (unsigned i = 0; it != end; ++it, ++i) | 151 for (unsigned i = 0; it != end; ++it, ++i) |
| 150 vector[i] = (*it).key; | 152 vector[i] = (*it).key; |
| 151 } | 153 } |
| 152 | 154 |
| 155 template <typename T, typename U, typename V, typename W> |
| 156 inline Vector<T> HashCountedSet<T, U, V, W>::asVector() const |
| 157 { |
| 158 Vector<T> vector; |
| 159 copyToVector(*this, vector); |
| 160 return vector; |
| 161 } |
| 162 |
| 153 } // namespace WTF | 163 } // namespace WTF |
| 154 | 164 |
| 155 using WTF::HashCountedSet; | 165 using WTF::HashCountedSet; |
| 156 | 166 |
| 157 #endif // WTF_HashCountedSet_h | 167 #endif // WTF_HashCountedSet_h |
| OLD | NEW |