| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 // new value was actually added | 143 // new value was actually added |
| 144 template <typename IncomingKeyType, typename IncomingMappedType> | 144 template <typename IncomingKeyType, typename IncomingMappedType> |
| 145 AddResult set(IncomingKeyType&&, IncomingMappedType&&); | 145 AddResult set(IncomingKeyType&&, IncomingMappedType&&); |
| 146 | 146 |
| 147 // does nothing if key is already present return value is a pair of the | 147 // does nothing if key is already present return value is a pair of the |
| 148 // iterator to the key location, and a boolean that's true if a new value | 148 // iterator to the key location, and a boolean that's true if a new value |
| 149 // was actually added | 149 // was actually added |
| 150 template <typename IncomingKeyType, typename IncomingMappedType> | 150 template <typename IncomingKeyType, typename IncomingMappedType> |
| 151 AddResult add(IncomingKeyType&&, IncomingMappedType&&); | 151 AddResult add(IncomingKeyType&&, IncomingMappedType&&); |
| 152 | 152 |
| 153 // TODO(pilgrim) remove remove() method once all references migrated to |
| 154 // erase() |
| 155 // https://crbug.com/662431 |
| 153 void remove(KeyPeekInType); | 156 void remove(KeyPeekInType); |
| 157 void erase(KeyPeekInType); |
| 154 void remove(iterator); | 158 void remove(iterator); |
| 155 void clear(); | 159 void clear(); |
| 156 template <typename Collection> | 160 template <typename Collection> |
| 157 void removeAll(const Collection& toBeRemoved) { | 161 void removeAll(const Collection& toBeRemoved) { |
| 158 WTF::removeAll(*this, toBeRemoved); | 162 WTF::removeAll(*this, toBeRemoved); |
| 159 } | 163 } |
| 160 | 164 |
| 161 MappedType take(KeyPeekInType); // efficient combination of get with remove | 165 MappedType take(KeyPeekInType); // efficient combination of get with remove |
| 162 | 166 |
| 163 // An alternate version of find() that finds the object by hashing and | 167 // An alternate version of find() that finds the object by hashing and |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 inline void HashMap<T, U, V, W, X, Y>::remove(KeyPeekInType key) { | 620 inline void HashMap<T, U, V, W, X, Y>::remove(KeyPeekInType key) { |
| 617 remove(find(key)); | 621 remove(find(key)); |
| 618 } | 622 } |
| 619 | 623 |
| 620 template <typename T, | 624 template <typename T, |
| 621 typename U, | 625 typename U, |
| 622 typename V, | 626 typename V, |
| 623 typename W, | 627 typename W, |
| 624 typename X, | 628 typename X, |
| 625 typename Y> | 629 typename Y> |
| 630 inline void HashMap<T, U, V, W, X, Y>::erase(KeyPeekInType key) { |
| 631 remove(find(key)); |
| 632 } |
| 633 |
| 634 template <typename T, |
| 635 typename U, |
| 636 typename V, |
| 637 typename W, |
| 638 typename X, |
| 639 typename Y> |
| 626 inline void HashMap<T, U, V, W, X, Y>::clear() { | 640 inline void HashMap<T, U, V, W, X, Y>::clear() { |
| 627 m_impl.clear(); | 641 m_impl.clear(); |
| 628 } | 642 } |
| 629 | 643 |
| 630 template <typename T, | 644 template <typename T, |
| 631 typename U, | 645 typename U, |
| 632 typename V, | 646 typename V, |
| 633 typename W, | 647 typename W, |
| 634 typename X, | 648 typename X, |
| 635 typename Y> | 649 typename Y> |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 iterator end = collection.end().values(); | 750 iterator end = collection.end().values(); |
| 737 for (unsigned i = 0; it != end; ++it, ++i) | 751 for (unsigned i = 0; it != end; ++it, ++i) |
| 738 vector[i] = *it; | 752 vector[i] = *it; |
| 739 } | 753 } |
| 740 | 754 |
| 741 } // namespace WTF | 755 } // namespace WTF |
| 742 | 756 |
| 743 using WTF::HashMap; | 757 using WTF::HashMap; |
| 744 | 758 |
| 745 #endif // WTF_HashMap_h | 759 #endif // WTF_HashMap_h |
| OLD | NEW |