| Index: third_party/WebKit/Source/wtf/HashIterators.h
|
| diff --git a/third_party/WebKit/Source/wtf/HashIterators.h b/third_party/WebKit/Source/wtf/HashIterators.h
|
| index 2133e84eb8daa12d4e67652838c64633ad42039d..d42775c61ebc4ce11e4c54ac70318c9b5d8fa8f9 100644
|
| --- a/third_party/WebKit/Source/wtf/HashIterators.h
|
| +++ b/third_party/WebKit/Source/wtf/HashIterators.h
|
| @@ -30,205 +30,250 @@
|
|
|
| namespace WTF {
|
|
|
| -template <typename HashTableType, typename KeyType, typename MappedType> struct HashTableConstKeysIterator;
|
| -template <typename HashTableType, typename KeyType, typename MappedType> struct HashTableConstValuesIterator;
|
| -template <typename HashTableType, typename KeyType, typename MappedType> struct HashTableKeysIterator;
|
| -template <typename HashTableType, typename KeyType, typename MappedType> struct HashTableValuesIterator;
|
| +template <typename HashTableType, typename KeyType, typename MappedType>
|
| +struct HashTableConstKeysIterator;
|
| +template <typename HashTableType, typename KeyType, typename MappedType>
|
| +struct HashTableConstValuesIterator;
|
| +template <typename HashTableType, typename KeyType, typename MappedType>
|
| +struct HashTableKeysIterator;
|
| +template <typename HashTableType, typename KeyType, typename MappedType>
|
| +struct HashTableValuesIterator;
|
|
|
| template <typename HashTableType, typename KeyType, typename MappedType>
|
| -struct HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType>> {
|
| - STACK_ALLOCATED();
|
| -private:
|
| - typedef KeyValuePair<KeyType, MappedType> ValueType;
|
| -public:
|
| - typedef HashTableConstKeysIterator<HashTableType, KeyType, MappedType> Keys;
|
| - typedef HashTableConstValuesIterator<HashTableType, KeyType, MappedType> Values;
|
| +struct HashTableConstIteratorAdapter<HashTableType,
|
| + KeyValuePair<KeyType, MappedType>> {
|
| + STACK_ALLOCATED();
|
|
|
| - HashTableConstIteratorAdapter() {}
|
| - HashTableConstIteratorAdapter(const typename HashTableType::const_iterator& impl) : m_impl(impl) {}
|
| + private:
|
| + typedef KeyValuePair<KeyType, MappedType> ValueType;
|
|
|
| - const ValueType* get() const { return (const ValueType*)m_impl.get(); }
|
| - const ValueType& operator*() const { return *get(); }
|
| - const ValueType* operator->() const { return get(); }
|
| + public:
|
| + typedef HashTableConstKeysIterator<HashTableType, KeyType, MappedType> Keys;
|
| + typedef HashTableConstValuesIterator<HashTableType, KeyType, MappedType>
|
| + Values;
|
|
|
| - HashTableConstIteratorAdapter& operator++() { ++m_impl; return *this; }
|
| - // postfix ++ intentionally omitted
|
| + HashTableConstIteratorAdapter() {}
|
| + HashTableConstIteratorAdapter(
|
| + const typename HashTableType::const_iterator& impl)
|
| + : m_impl(impl) {}
|
|
|
| - Keys keys() { return Keys(*this); }
|
| - Values values() { return Values(*this); }
|
| + const ValueType* get() const { return (const ValueType*)m_impl.get(); }
|
| + const ValueType& operator*() const { return *get(); }
|
| + const ValueType* operator->() const { return get(); }
|
|
|
| - typename HashTableType::const_iterator m_impl;
|
| -};
|
| + HashTableConstIteratorAdapter& operator++() {
|
| + ++m_impl;
|
| + return *this;
|
| + }
|
| + // postfix ++ intentionally omitted
|
|
|
| -template <typename HashTableType, typename KeyType, typename MappedType>
|
| -struct HashTableIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType>> {
|
| - STACK_ALLOCATED();
|
| -private:
|
| - typedef KeyValuePair<KeyType, MappedType> ValueType;
|
| -public:
|
| - typedef HashTableKeysIterator<HashTableType, KeyType, MappedType> Keys;
|
| - typedef HashTableValuesIterator<HashTableType, KeyType, MappedType> Values;
|
| -
|
| - HashTableIteratorAdapter() {}
|
| - HashTableIteratorAdapter(const typename HashTableType::iterator& impl) : m_impl(impl) {}
|
| -
|
| - ValueType* get() const { return (ValueType*)m_impl.get(); }
|
| - ValueType& operator*() const { return *get(); }
|
| - ValueType* operator->() const { return get(); }
|
| -
|
| - HashTableIteratorAdapter& operator++() { ++m_impl; return *this; }
|
| - // postfix ++ intentionally omitted
|
| -
|
| - operator HashTableConstIteratorAdapter<HashTableType, ValueType>()
|
| - {
|
| - typename HashTableType::const_iterator i = m_impl;
|
| - return i;
|
| - }
|
| -
|
| - Keys keys() { return Keys(*this); }
|
| - Values values() { return Values(*this); }
|
| -
|
| - typename HashTableType::iterator m_impl;
|
| + Keys keys() { return Keys(*this); }
|
| + Values values() { return Values(*this); }
|
| +
|
| + typename HashTableType::const_iterator m_impl;
|
| };
|
|
|
| template <typename HashTableType, typename KeyType, typename MappedType>
|
| -struct HashTableConstKeysIterator {
|
| - STACK_ALLOCATED();
|
| -private:
|
| - typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType>> ConstIterator;
|
| -
|
| -public:
|
| - HashTableConstKeysIterator(const ConstIterator& impl) : m_impl(impl) {}
|
| +struct HashTableIteratorAdapter<HashTableType,
|
| + KeyValuePair<KeyType, MappedType>> {
|
| + STACK_ALLOCATED();
|
|
|
| - const KeyType* get() const { return &(m_impl.get()->key); }
|
| - const KeyType& operator*() const { return *get(); }
|
| - const KeyType* operator->() const { return get(); }
|
| + private:
|
| + typedef KeyValuePair<KeyType, MappedType> ValueType;
|
|
|
| - HashTableConstKeysIterator& operator++() { ++m_impl; return *this; }
|
| - // postfix ++ intentionally omitted
|
| + public:
|
| + typedef HashTableKeysIterator<HashTableType, KeyType, MappedType> Keys;
|
| + typedef HashTableValuesIterator<HashTableType, KeyType, MappedType> Values;
|
|
|
| - ConstIterator m_impl;
|
| -};
|
| + HashTableIteratorAdapter() {}
|
| + HashTableIteratorAdapter(const typename HashTableType::iterator& impl)
|
| + : m_impl(impl) {}
|
|
|
| -template <typename HashTableType, typename KeyType, typename MappedType>
|
| -struct HashTableConstValuesIterator {
|
| - STACK_ALLOCATED();
|
| -private:
|
| - typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType>> ConstIterator;
|
| + ValueType* get() const { return (ValueType*)m_impl.get(); }
|
| + ValueType& operator*() const { return *get(); }
|
| + ValueType* operator->() const { return get(); }
|
|
|
| -public:
|
| - HashTableConstValuesIterator(const ConstIterator& impl) : m_impl(impl) {}
|
| + HashTableIteratorAdapter& operator++() {
|
| + ++m_impl;
|
| + return *this;
|
| + }
|
| + // postfix ++ intentionally omitted
|
|
|
| - const MappedType* get() const { return &(m_impl.get()->value); }
|
| - const MappedType& operator*() const { return *get(); }
|
| - const MappedType* operator->() const { return get(); }
|
| + operator HashTableConstIteratorAdapter<HashTableType, ValueType>() {
|
| + typename HashTableType::const_iterator i = m_impl;
|
| + return i;
|
| + }
|
|
|
| - HashTableConstValuesIterator& operator++() { ++m_impl; return *this; }
|
| - // postfix ++ intentionally omitted
|
| + Keys keys() { return Keys(*this); }
|
| + Values values() { return Values(*this); }
|
|
|
| - ConstIterator m_impl;
|
| + typename HashTableType::iterator m_impl;
|
| };
|
|
|
| template <typename HashTableType, typename KeyType, typename MappedType>
|
| -struct HashTableKeysIterator {
|
| - STACK_ALLOCATED();
|
| -private:
|
| - typedef HashTableIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType>> Iterator;
|
| - typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType>> ConstIterator;
|
| +struct HashTableConstKeysIterator {
|
| + STACK_ALLOCATED();
|
|
|
| -public:
|
| - HashTableKeysIterator(const Iterator& impl) : m_impl(impl) {}
|
| + private:
|
| + typedef HashTableConstIteratorAdapter<HashTableType,
|
| + KeyValuePair<KeyType, MappedType>>
|
| + ConstIterator;
|
|
|
| - KeyType* get() const { return &(m_impl.get()->key); }
|
| - KeyType& operator*() const { return *get(); }
|
| - KeyType* operator->() const { return get(); }
|
| + public:
|
| + HashTableConstKeysIterator(const ConstIterator& impl) : m_impl(impl) {}
|
|
|
| - HashTableKeysIterator& operator++() { ++m_impl; return *this; }
|
| - // postfix ++ intentionally omitted
|
| + const KeyType* get() const { return &(m_impl.get()->key); }
|
| + const KeyType& operator*() const { return *get(); }
|
| + const KeyType* operator->() const { return get(); }
|
|
|
| - operator HashTableConstKeysIterator<HashTableType, KeyType, MappedType>()
|
| - {
|
| - ConstIterator i = m_impl;
|
| - return i;
|
| - }
|
| + HashTableConstKeysIterator& operator++() {
|
| + ++m_impl;
|
| + return *this;
|
| + }
|
| + // postfix ++ intentionally omitted
|
|
|
| - Iterator m_impl;
|
| + ConstIterator m_impl;
|
| };
|
|
|
| template <typename HashTableType, typename KeyType, typename MappedType>
|
| -struct HashTableValuesIterator {
|
| - STACK_ALLOCATED();
|
| -private:
|
| - typedef HashTableIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType>> Iterator;
|
| - typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType>> ConstIterator;
|
| +struct HashTableConstValuesIterator {
|
| + STACK_ALLOCATED();
|
| +
|
| + private:
|
| + typedef HashTableConstIteratorAdapter<HashTableType,
|
| + KeyValuePair<KeyType, MappedType>>
|
| + ConstIterator;
|
| +
|
| + public:
|
| + HashTableConstValuesIterator(const ConstIterator& impl) : m_impl(impl) {}
|
|
|
| -public:
|
| - HashTableValuesIterator(const Iterator& impl) : m_impl(impl) {}
|
| + const MappedType* get() const { return &(m_impl.get()->value); }
|
| + const MappedType& operator*() const { return *get(); }
|
| + const MappedType* operator->() const { return get(); }
|
|
|
| - MappedType* get() const { return &(m_impl.get()->value); }
|
| - MappedType& operator*() const { return *get(); }
|
| - MappedType* operator->() const { return get(); }
|
| + HashTableConstValuesIterator& operator++() {
|
| + ++m_impl;
|
| + return *this;
|
| + }
|
| + // postfix ++ intentionally omitted
|
|
|
| - HashTableValuesIterator& operator++() { ++m_impl; return *this; }
|
| - // postfix ++ intentionally omitted
|
| + ConstIterator m_impl;
|
| +};
|
|
|
| - operator HashTableConstValuesIterator<HashTableType, KeyType, MappedType>()
|
| - {
|
| - ConstIterator i = m_impl;
|
| - return i;
|
| - }
|
| +template <typename HashTableType, typename KeyType, typename MappedType>
|
| +struct HashTableKeysIterator {
|
| + STACK_ALLOCATED();
|
| +
|
| + private:
|
| + typedef HashTableIteratorAdapter<HashTableType,
|
| + KeyValuePair<KeyType, MappedType>>
|
| + Iterator;
|
| + typedef HashTableConstIteratorAdapter<HashTableType,
|
| + KeyValuePair<KeyType, MappedType>>
|
| + ConstIterator;
|
| +
|
| + public:
|
| + HashTableKeysIterator(const Iterator& impl) : m_impl(impl) {}
|
| +
|
| + KeyType* get() const { return &(m_impl.get()->key); }
|
| + KeyType& operator*() const { return *get(); }
|
| + KeyType* operator->() const { return get(); }
|
| +
|
| + HashTableKeysIterator& operator++() {
|
| + ++m_impl;
|
| + return *this;
|
| + }
|
| + // postfix ++ intentionally omitted
|
| +
|
| + operator HashTableConstKeysIterator<HashTableType, KeyType, MappedType>() {
|
| + ConstIterator i = m_impl;
|
| + return i;
|
| + }
|
| +
|
| + Iterator m_impl;
|
| +};
|
|
|
| - Iterator m_impl;
|
| +template <typename HashTableType, typename KeyType, typename MappedType>
|
| +struct HashTableValuesIterator {
|
| + STACK_ALLOCATED();
|
| +
|
| + private:
|
| + typedef HashTableIteratorAdapter<HashTableType,
|
| + KeyValuePair<KeyType, MappedType>>
|
| + Iterator;
|
| + typedef HashTableConstIteratorAdapter<HashTableType,
|
| + KeyValuePair<KeyType, MappedType>>
|
| + ConstIterator;
|
| +
|
| + public:
|
| + HashTableValuesIterator(const Iterator& impl) : m_impl(impl) {}
|
| +
|
| + MappedType* get() const { return &(m_impl.get()->value); }
|
| + MappedType& operator*() const { return *get(); }
|
| + MappedType* operator->() const { return get(); }
|
| +
|
| + HashTableValuesIterator& operator++() {
|
| + ++m_impl;
|
| + return *this;
|
| + }
|
| + // postfix ++ intentionally omitted
|
| +
|
| + operator HashTableConstValuesIterator<HashTableType, KeyType, MappedType>() {
|
| + ConstIterator i = m_impl;
|
| + return i;
|
| + }
|
| +
|
| + Iterator m_impl;
|
| };
|
|
|
| template <typename T, typename U, typename V>
|
| -inline bool operator==(const HashTableConstKeysIterator<T, U, V>& a, const HashTableConstKeysIterator<T, U, V>& b)
|
| -{
|
| - return a.m_impl == b.m_impl;
|
| +inline bool operator==(const HashTableConstKeysIterator<T, U, V>& a,
|
| + const HashTableConstKeysIterator<T, U, V>& b) {
|
| + return a.m_impl == b.m_impl;
|
| }
|
|
|
| template <typename T, typename U, typename V>
|
| -inline bool operator!=(const HashTableConstKeysIterator<T, U, V>& a, const HashTableConstKeysIterator<T, U, V>& b)
|
| -{
|
| - return a.m_impl != b.m_impl;
|
| +inline bool operator!=(const HashTableConstKeysIterator<T, U, V>& a,
|
| + const HashTableConstKeysIterator<T, U, V>& b) {
|
| + return a.m_impl != b.m_impl;
|
| }
|
|
|
| template <typename T, typename U, typename V>
|
| -inline bool operator==(const HashTableConstValuesIterator<T, U, V>& a, const HashTableConstValuesIterator<T, U, V>& b)
|
| -{
|
| - return a.m_impl == b.m_impl;
|
| +inline bool operator==(const HashTableConstValuesIterator<T, U, V>& a,
|
| + const HashTableConstValuesIterator<T, U, V>& b) {
|
| + return a.m_impl == b.m_impl;
|
| }
|
|
|
| template <typename T, typename U, typename V>
|
| -inline bool operator!=(const HashTableConstValuesIterator<T, U, V>& a, const HashTableConstValuesIterator<T, U, V>& b)
|
| -{
|
| - return a.m_impl != b.m_impl;
|
| +inline bool operator!=(const HashTableConstValuesIterator<T, U, V>& a,
|
| + const HashTableConstValuesIterator<T, U, V>& b) {
|
| + return a.m_impl != b.m_impl;
|
| }
|
|
|
| template <typename T, typename U, typename V>
|
| -inline bool operator==(const HashTableKeysIterator<T, U, V>& a, const HashTableKeysIterator<T, U, V>& b)
|
| -{
|
| - return a.m_impl == b.m_impl;
|
| +inline bool operator==(const HashTableKeysIterator<T, U, V>& a,
|
| + const HashTableKeysIterator<T, U, V>& b) {
|
| + return a.m_impl == b.m_impl;
|
| }
|
|
|
| template <typename T, typename U, typename V>
|
| -inline bool operator!=(const HashTableKeysIterator<T, U, V>& a, const HashTableKeysIterator<T, U, V>& b)
|
| -{
|
| - return a.m_impl != b.m_impl;
|
| +inline bool operator!=(const HashTableKeysIterator<T, U, V>& a,
|
| + const HashTableKeysIterator<T, U, V>& b) {
|
| + return a.m_impl != b.m_impl;
|
| }
|
|
|
| template <typename T, typename U, typename V>
|
| -inline bool operator==(const HashTableValuesIterator<T, U, V>& a, const HashTableValuesIterator<T, U, V>& b)
|
| -{
|
| - return a.m_impl == b.m_impl;
|
| +inline bool operator==(const HashTableValuesIterator<T, U, V>& a,
|
| + const HashTableValuesIterator<T, U, V>& b) {
|
| + return a.m_impl == b.m_impl;
|
| }
|
|
|
| template <typename T, typename U, typename V>
|
| -inline bool operator!=(const HashTableValuesIterator<T, U, V>& a, const HashTableValuesIterator<T, U, V>& b)
|
| -{
|
| - return a.m_impl != b.m_impl;
|
| +inline bool operator!=(const HashTableValuesIterator<T, U, V>& a,
|
| + const HashTableValuesIterator<T, U, V>& b) {
|
| + return a.m_impl != b.m_impl;
|
| }
|
|
|
| -} // namespace WTF
|
| +} // namespace WTF
|
|
|
| -#endif // WTF_HashIterators_h
|
| +#endif // WTF_HashIterators_h
|
|
|