| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 // static bool equal(const ValueType&, const T&); | 103 // static bool equal(const ValueType&, const T&); |
| 104 // static translate(ValueType&, const T&, unsigned hashCode); | 104 // static translate(ValueType&, const T&, unsigned hashCode); |
| 105 template <typename HashTranslator, typename T> AddResult add(const T&); | 105 template <typename HashTranslator, typename T> AddResult add(const T&); |
| 106 | 106 |
| 107 void remove(ValuePeekInType); | 107 void remove(ValuePeekInType); |
| 108 void remove(iterator); | 108 void remove(iterator); |
| 109 void clear(); | 109 void clear(); |
| 110 template <typename Collection> | 110 template <typename Collection> |
| 111 void removeAll(const Collection& toBeRemoved) { WTF::removeAll(*this, toBeRe
moved); } | 111 void removeAll(const Collection& toBeRemoved) { WTF::removeAll(*this, toBeRe
moved); } |
| 112 | 112 |
| 113 static bool isValidValue(ValuePeekInType); | |
| 114 | |
| 115 ValuePassOutType take(iterator); | 113 ValuePassOutType take(iterator); |
| 116 ValuePassOutType take(ValuePeekInType); | 114 ValuePassOutType take(ValuePeekInType); |
| 117 ValuePassOutType takeAny(); | 115 ValuePassOutType takeAny(); |
| 118 | 116 |
| 119 template <typename VisitorDispatcher> | 117 template <typename VisitorDispatcher> |
| 120 void trace(VisitorDispatcher visitor) { m_impl.trace(visitor); } | 118 void trace(VisitorDispatcher visitor) { m_impl.trace(visitor); } |
| 121 | 119 |
| 122 private: | 120 private: |
| 123 HashTableType m_impl; | 121 HashTableType m_impl; |
| 124 }; | 122 }; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 remove(find(value)); | 221 remove(find(value)); |
| 224 } | 222 } |
| 225 | 223 |
| 226 template <typename T, typename U, typename V, typename W> | 224 template <typename T, typename U, typename V, typename W> |
| 227 inline void HashSet<T, U, V, W>::clear() | 225 inline void HashSet<T, U, V, W>::clear() |
| 228 { | 226 { |
| 229 m_impl.clear(); | 227 m_impl.clear(); |
| 230 } | 228 } |
| 231 | 229 |
| 232 template <typename T, typename U, typename V, typename W> | 230 template <typename T, typename U, typename V, typename W> |
| 233 inline bool HashSet<T, U, V, W>::isValidValue(ValuePeekInType value) | |
| 234 { | |
| 235 if (ValueTraits::isDeletedValue(value)) | |
| 236 return false; | |
| 237 | |
| 238 if (HashFunctions::safeToCompareToEmptyOrDeleted) { | |
| 239 if (value == ValueTraits::emptyValue()) | |
| 240 return false; | |
| 241 } else { | |
| 242 if (isHashTraitsEmptyValue<ValueTraits>(value)) | |
| 243 return false; | |
| 244 } | |
| 245 | |
| 246 return true; | |
| 247 } | |
| 248 | |
| 249 template <typename T, typename U, typename V, typename W> | |
| 250 inline typename HashSet<T, U, V, W>::ValuePassOutType HashSet<T, U, V, W>::take(
iterator it) | 231 inline typename HashSet<T, U, V, W>::ValuePassOutType HashSet<T, U, V, W>::take(
iterator it) |
| 251 { | 232 { |
| 252 if (it == end()) | 233 if (it == end()) |
| 253 return ValueTraits::emptyValue(); | 234 return ValueTraits::emptyValue(); |
| 254 | 235 |
| 255 ValuePassOutType result = ValueTraits::passOut(const_cast<ValueType&>(*it)); | 236 ValuePassOutType result = ValueTraits::passOut(const_cast<ValueType&>(*it)); |
| 256 remove(it); | 237 remove(it); |
| 257 | 238 |
| 258 return result; | 239 return result; |
| 259 } | 240 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 struct NeedsTracing<HashSet<T, U, V>> { | 273 struct NeedsTracing<HashSet<T, U, V>> { |
| 293 static const bool value = false; | 274 static const bool value = false; |
| 294 }; | 275 }; |
| 295 #endif | 276 #endif |
| 296 | 277 |
| 297 } // namespace WTF | 278 } // namespace WTF |
| 298 | 279 |
| 299 using WTF::HashSet; | 280 using WTF::HashSet; |
| 300 | 281 |
| 301 #endif // WTF_HashSet_h | 282 #endif // WTF_HashSet_h |
| OLD | NEW |