OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights |
| 3 * reserved. |
3 * Copyright (C) 2011, Benjamin Poulain <ikipou@gmail.com> | 4 * Copyright (C) 2011, Benjamin Poulain <ikipou@gmail.com> |
4 * | 5 * |
5 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
9 * | 10 * |
10 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 void removeFirst(); | 240 void removeFirst(); |
240 | 241 |
241 Value& last(); | 242 Value& last(); |
242 const Value& last() const; | 243 const Value& last() const; |
243 void removeLast(); | 244 void removeLast(); |
244 | 245 |
245 iterator find(ValuePeekInType); | 246 iterator find(ValuePeekInType); |
246 const_iterator find(ValuePeekInType) const; | 247 const_iterator find(ValuePeekInType) const; |
247 bool contains(ValuePeekInType) const; | 248 bool contains(ValuePeekInType) const; |
248 | 249 |
249 // An alternate version of find() that finds the object by hashing and compari
ng | 250 // An alternate version of find() that finds the object by hashing and |
250 // with some other type, to avoid the cost of type conversion. | 251 // comparing with some other type, to avoid the cost of type conversion. |
251 // The HashTranslator interface is defined in HashSet. | 252 // The HashTranslator interface is defined in HashSet. |
252 template <typename HashTranslator, typename T> | 253 template <typename HashTranslator, typename T> |
253 iterator find(const T&); | 254 iterator find(const T&); |
254 template <typename HashTranslator, typename T> | 255 template <typename HashTranslator, typename T> |
255 const_iterator find(const T&) const; | 256 const_iterator find(const T&) const; |
256 template <typename HashTranslator, typename T> | 257 template <typename HashTranslator, typename T> |
257 bool contains(const T&) const; | 258 bool contains(const T&) const; |
258 | 259 |
259 // The return value of add is a pair of a pointer to the stored value, | 260 // The return value of add is a pair of a pointer to the stored value, |
260 // and a bool that is true if an new entry was added. | 261 // and a bool that is true if an new entry was added. |
261 template <typename IncomingValueType> | 262 template <typename IncomingValueType> |
262 AddResult add(IncomingValueType&&); | 263 AddResult add(IncomingValueType&&); |
263 | 264 |
264 // Same as add() except that the return value is an | 265 // Same as add() except that the return value is an |
265 // iterator. Useful in cases where it's needed to have the | 266 // iterator. Useful in cases where it's needed to have the |
266 // same return value as find() and where it's not possible to | 267 // same return value as find() and where it's not possible to |
267 // use a pointer to the storedValue. | 268 // use a pointer to the storedValue. |
268 template <typename IncomingValueType> | 269 template <typename IncomingValueType> |
269 iterator addReturnIterator(IncomingValueType&&); | 270 iterator addReturnIterator(IncomingValueType&&); |
270 | 271 |
271 // Add the value to the end of the collection. If the value was already in | 272 // Add the value to the end of the collection. If the value was already in |
272 // the list, it is moved to the end. | 273 // the list, it is moved to the end. |
273 template <typename IncomingValueType> | 274 template <typename IncomingValueType> |
274 AddResult appendOrMoveToLast(IncomingValueType&&); | 275 AddResult appendOrMoveToLast(IncomingValueType&&); |
275 | 276 |
276 // Add the value to the beginning of the collection. If the value was already
in | 277 // Add the value to the beginning of the collection. If the value was already |
277 // the list, it is moved to the beginning. | 278 // in the list, it is moved to the beginning. |
278 template <typename IncomingValueType> | 279 template <typename IncomingValueType> |
279 AddResult prependOrMoveToFirst(IncomingValueType&&); | 280 AddResult prependOrMoveToFirst(IncomingValueType&&); |
280 | 281 |
281 template <typename IncomingValueType> | 282 template <typename IncomingValueType> |
282 AddResult insertBefore(ValuePeekInType beforeValue, | 283 AddResult insertBefore(ValuePeekInType beforeValue, |
283 IncomingValueType&& newValue); | 284 IncomingValueType&& newValue); |
284 template <typename IncomingValueType> | 285 template <typename IncomingValueType> |
285 AddResult insertBefore(iterator it, IncomingValueType&& newValue) { | 286 AddResult insertBefore(iterator it, IncomingValueType&& newValue) { |
286 return m_impl.template add<NodeHashFunctions>( | 287 return m_impl.template add<NodeHashFunctions>( |
287 std::forward<IncomingValueType>(newValue), it.getNode()); | 288 std::forward<IncomingValueType>(newValue), it.getNode()); |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 swap(static_cast<Base&>(a), static_cast<Base&>(b)); | 868 swap(static_cast<Base&>(a), static_cast<Base&>(b)); |
868 swap(a.m_value, b.m_value); | 869 swap(a.m_value, b.m_value); |
869 Allocator::leaveGCForbiddenScope(); | 870 Allocator::leaveGCForbiddenScope(); |
870 } | 871 } |
871 | 872 |
872 } // namespace WTF | 873 } // namespace WTF |
873 | 874 |
874 using WTF::LinkedHashSet; | 875 using WTF::LinkedHashSet; |
875 | 876 |
876 #endif /* WTF_LinkedHashSet_h */ | 877 #endif /* WTF_LinkedHashSet_h */ |
OLD | NEW |