Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: Source/wtf/HashIterators.h

Issue 835953003: Fix template angle bracket syntax (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/wtf/HashFunctions.h ('k') | Source/wtf/HashMap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 15 matching lines...) Expand all
26 #ifndef WTF_HashIterators_h 26 #ifndef WTF_HashIterators_h
27 #define WTF_HashIterators_h 27 #define WTF_HashIterators_h
28 28
29 namespace WTF { 29 namespace WTF {
30 30
31 template<typename HashTableType, typename KeyType, typename MappedType> stru ct HashTableConstKeysIterator; 31 template<typename HashTableType, typename KeyType, typename MappedType> stru ct HashTableConstKeysIterator;
32 template<typename HashTableType, typename KeyType, typename MappedType> stru ct HashTableConstValuesIterator; 32 template<typename HashTableType, typename KeyType, typename MappedType> stru ct HashTableConstValuesIterator;
33 template<typename HashTableType, typename KeyType, typename MappedType> stru ct HashTableKeysIterator; 33 template<typename HashTableType, typename KeyType, typename MappedType> stru ct HashTableKeysIterator;
34 template<typename HashTableType, typename KeyType, typename MappedType> stru ct HashTableValuesIterator; 34 template<typename HashTableType, typename KeyType, typename MappedType> stru ct HashTableValuesIterator;
35 35
36 template<typename HashTableType, typename KeyType, typename MappedType> stru ct HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType > > { 36 template<typename HashTableType, typename KeyType, typename MappedType> stru ct HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType >> {
37 private: 37 private:
38 typedef KeyValuePair<KeyType, MappedType> ValueType; 38 typedef KeyValuePair<KeyType, MappedType> ValueType;
39 public: 39 public:
40 typedef HashTableConstKeysIterator<HashTableType, KeyType, MappedType> K eys; 40 typedef HashTableConstKeysIterator<HashTableType, KeyType, MappedType> K eys;
41 typedef HashTableConstValuesIterator<HashTableType, KeyType, MappedType> Values; 41 typedef HashTableConstValuesIterator<HashTableType, KeyType, MappedType> Values;
42 42
43 HashTableConstIteratorAdapter() {} 43 HashTableConstIteratorAdapter() {}
44 HashTableConstIteratorAdapter(const typename HashTableType::const_iterat or& impl) : m_impl(impl) {} 44 HashTableConstIteratorAdapter(const typename HashTableType::const_iterat or& impl) : m_impl(impl) {}
45 45
46 const ValueType* get() const { return (const ValueType*)m_impl.get(); } 46 const ValueType* get() const { return (const ValueType*)m_impl.get(); }
47 const ValueType& operator*() const { return *get(); } 47 const ValueType& operator*() const { return *get(); }
48 const ValueType* operator->() const { return get(); } 48 const ValueType* operator->() const { return get(); }
49 49
50 HashTableConstIteratorAdapter& operator++() { ++m_impl; return *this; } 50 HashTableConstIteratorAdapter& operator++() { ++m_impl; return *this; }
51 // postfix ++ intentionally omitted 51 // postfix ++ intentionally omitted
52 52
53 Keys keys() { return Keys(*this); } 53 Keys keys() { return Keys(*this); }
54 Values values() { return Values(*this); } 54 Values values() { return Values(*this); }
55 55
56 typename HashTableType::const_iterator m_impl; 56 typename HashTableType::const_iterator m_impl;
57 }; 57 };
58 58
59 template<typename HashTableType, typename KeyType, typename MappedType> stru ct HashTableIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType> > { 59 template<typename HashTableType, typename KeyType, typename MappedType> stru ct HashTableIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType>> {
60 private: 60 private:
61 typedef KeyValuePair<KeyType, MappedType> ValueType; 61 typedef KeyValuePair<KeyType, MappedType> ValueType;
62 public: 62 public:
63 typedef HashTableKeysIterator<HashTableType, KeyType, MappedType> Keys; 63 typedef HashTableKeysIterator<HashTableType, KeyType, MappedType> Keys;
64 typedef HashTableValuesIterator<HashTableType, KeyType, MappedType> Valu es; 64 typedef HashTableValuesIterator<HashTableType, KeyType, MappedType> Valu es;
65 65
66 HashTableIteratorAdapter() {} 66 HashTableIteratorAdapter() {}
67 HashTableIteratorAdapter(const typename HashTableType::iterator& impl) : m_impl(impl) {} 67 HashTableIteratorAdapter(const typename HashTableType::iterator& impl) : m_impl(impl) {}
68 68
69 ValueType* get() const { return (ValueType*)m_impl.get(); } 69 ValueType* get() const { return (ValueType*)m_impl.get(); }
70 ValueType& operator*() const { return *get(); } 70 ValueType& operator*() const { return *get(); }
71 ValueType* operator->() const { return get(); } 71 ValueType* operator->() const { return get(); }
72 72
73 HashTableIteratorAdapter& operator++() { ++m_impl; return *this; } 73 HashTableIteratorAdapter& operator++() { ++m_impl; return *this; }
74 // postfix ++ intentionally omitted 74 // postfix ++ intentionally omitted
75 75
76 operator HashTableConstIteratorAdapter<HashTableType, ValueType>() { 76 operator HashTableConstIteratorAdapter<HashTableType, ValueType>() {
77 typename HashTableType::const_iterator i = m_impl; 77 typename HashTableType::const_iterator i = m_impl;
78 return i; 78 return i;
79 } 79 }
80 80
81 Keys keys() { return Keys(*this); } 81 Keys keys() { return Keys(*this); }
82 Values values() { return Values(*this); } 82 Values values() { return Values(*this); }
83 83
84 typename HashTableType::iterator m_impl; 84 typename HashTableType::iterator m_impl;
85 }; 85 };
86 86
87 template<typename HashTableType, typename KeyType, typename MappedType> stru ct HashTableConstKeysIterator { 87 template<typename HashTableType, typename KeyType, typename MappedType> stru ct HashTableConstKeysIterator {
88 private: 88 private:
89 typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyTyp e, MappedType> > ConstIterator; 89 typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyTyp e, MappedType>> ConstIterator;
90 90
91 public: 91 public:
92 HashTableConstKeysIterator(const ConstIterator& impl) : m_impl(impl) {} 92 HashTableConstKeysIterator(const ConstIterator& impl) : m_impl(impl) {}
93 93
94 const KeyType* get() const { return &(m_impl.get()->key); } 94 const KeyType* get() const { return &(m_impl.get()->key); }
95 const KeyType& operator*() const { return *get(); } 95 const KeyType& operator*() const { return *get(); }
96 const KeyType* operator->() const { return get(); } 96 const KeyType* operator->() const { return get(); }
97 97
98 HashTableConstKeysIterator& operator++() { ++m_impl; return *this; } 98 HashTableConstKeysIterator& operator++() { ++m_impl; return *this; }
99 // postfix ++ intentionally omitted 99 // postfix ++ intentionally omitted
100 100
101 ConstIterator m_impl; 101 ConstIterator m_impl;
102 }; 102 };
103 103
104 template<typename HashTableType, typename KeyType, typename MappedType> stru ct HashTableConstValuesIterator { 104 template<typename HashTableType, typename KeyType, typename MappedType> stru ct HashTableConstValuesIterator {
105 private: 105 private:
106 typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyTyp e, MappedType> > ConstIterator; 106 typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyTyp e, MappedType>> ConstIterator;
107 107
108 public: 108 public:
109 HashTableConstValuesIterator(const ConstIterator& impl) : m_impl(impl) { } 109 HashTableConstValuesIterator(const ConstIterator& impl) : m_impl(impl) { }
110 110
111 const MappedType* get() const { return &(m_impl.get()->value); } 111 const MappedType* get() const { return &(m_impl.get()->value); }
112 const MappedType& operator*() const { return *get(); } 112 const MappedType& operator*() const { return *get(); }
113 const MappedType* operator->() const { return get(); } 113 const MappedType* operator->() const { return get(); }
114 114
115 HashTableConstValuesIterator& operator++() { ++m_impl; return *this; } 115 HashTableConstValuesIterator& operator++() { ++m_impl; return *this; }
116 // postfix ++ intentionally omitted 116 // postfix ++ intentionally omitted
117 117
118 ConstIterator m_impl; 118 ConstIterator m_impl;
119 }; 119 };
120 120
121 template<typename HashTableType, typename KeyType, typename MappedType> stru ct HashTableKeysIterator { 121 template<typename HashTableType, typename KeyType, typename MappedType> stru ct HashTableKeysIterator {
122 private: 122 private:
123 typedef HashTableIteratorAdapter<HashTableType, KeyValuePair<KeyType, Ma ppedType> > Iterator; 123 typedef HashTableIteratorAdapter<HashTableType, KeyValuePair<KeyType, Ma ppedType>> Iterator;
124 typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyTyp e, MappedType> > ConstIterator; 124 typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyTyp e, MappedType>> ConstIterator;
125 125
126 public: 126 public:
127 HashTableKeysIterator(const Iterator& impl) : m_impl(impl) {} 127 HashTableKeysIterator(const Iterator& impl) : m_impl(impl) {}
128 128
129 KeyType* get() const { return &(m_impl.get()->key); } 129 KeyType* get() const { return &(m_impl.get()->key); }
130 KeyType& operator*() const { return *get(); } 130 KeyType& operator*() const { return *get(); }
131 KeyType* operator->() const { return get(); } 131 KeyType* operator->() const { return get(); }
132 132
133 HashTableKeysIterator& operator++() { ++m_impl; return *this; } 133 HashTableKeysIterator& operator++() { ++m_impl; return *this; }
134 // postfix ++ intentionally omitted 134 // postfix ++ intentionally omitted
135 135
136 operator HashTableConstKeysIterator<HashTableType, KeyType, MappedType>( ) { 136 operator HashTableConstKeysIterator<HashTableType, KeyType, MappedType>( ) {
137 ConstIterator i = m_impl; 137 ConstIterator i = m_impl;
138 return i; 138 return i;
139 } 139 }
140 140
141 Iterator m_impl; 141 Iterator m_impl;
142 }; 142 };
143 143
144 template<typename HashTableType, typename KeyType, typename MappedType> stru ct HashTableValuesIterator { 144 template<typename HashTableType, typename KeyType, typename MappedType> stru ct HashTableValuesIterator {
145 private: 145 private:
146 typedef HashTableIteratorAdapter<HashTableType, KeyValuePair<KeyType, Ma ppedType> > Iterator; 146 typedef HashTableIteratorAdapter<HashTableType, KeyValuePair<KeyType, Ma ppedType>> Iterator;
147 typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyTyp e, MappedType> > ConstIterator; 147 typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyTyp e, MappedType>> ConstIterator;
148 148
149 public: 149 public:
150 HashTableValuesIterator(const Iterator& impl) : m_impl(impl) {} 150 HashTableValuesIterator(const Iterator& impl) : m_impl(impl) {}
151 151
152 MappedType* get() const { return &(m_impl.get()->value); } 152 MappedType* get() const { return &(m_impl.get()->value); }
153 MappedType& operator*() const { return *get(); } 153 MappedType& operator*() const { return *get(); }
154 MappedType* operator->() const { return get(); } 154 MappedType* operator->() const { return get(); }
155 155
156 HashTableValuesIterator& operator++() { ++m_impl; return *this; } 156 HashTableValuesIterator& operator++() { ++m_impl; return *this; }
157 // postfix ++ intentionally omitted 157 // postfix ++ intentionally omitted
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 template<typename T, typename U, typename V> 209 template<typename T, typename U, typename V>
210 inline bool operator!=(const HashTableValuesIterator<T, U, V>& a, const HashTableValuesIterator<T, U, V>& b) 210 inline bool operator!=(const HashTableValuesIterator<T, U, V>& a, const HashTableValuesIterator<T, U, V>& b)
211 { 211 {
212 return a.m_impl != b.m_impl; 212 return a.m_impl != b.m_impl;
213 } 213 }
214 214
215 215
216 } // namespace WTF 216 } // namespace WTF
217 217
218 #endif // WTF_HashIterators_h 218 #endif // WTF_HashIterators_h
OLDNEW
« no previous file with comments | « Source/wtf/HashFunctions.h ('k') | Source/wtf/HashMap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698