| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CC_BASE_SCOPED_PTR_HASH_MAP_H_ | 5 #ifndef CC_BASE_SCOPED_PTR_HASH_MAP_H_ |
| 6 #define CC_BASE_SCOPED_PTR_HASH_MAP_H_ | 6 #define CC_BASE_SCOPED_PTR_HASH_MAP_H_ |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 // Returns the first element in the hash_map that matches the given key. | 111 // Returns the first element in the hash_map that matches the given key. |
| 112 // If no such element exists it returns NULL. | 112 // If no such element exists it returns NULL. |
| 113 Value* get(const Key& k) const { | 113 Value* get(const Key& k) const { |
| 114 const_iterator it = find(k); | 114 const_iterator it = find(k); |
| 115 if (it == end()) | 115 if (it == end()) |
| 116 return 0; | 116 return 0; |
| 117 return it->second; | 117 return it->second; |
| 118 } | 118 } |
| 119 | 119 |
| 120 inline bool contains(const Key& k) const { return data_.count(k) > 0; } | 120 inline bool contains(const Key& k) const { return data_.count(k); } |
| 121 | 121 |
| 122 inline void clear() { STLDeleteValues(&data_); } | 122 inline void clear() { STLDeleteValues(&data_); } |
| 123 | 123 |
| 124 inline const_iterator find(const Key& k) const { return data_.find(k); } | 124 inline const_iterator find(const Key& k) const { return data_.find(k); } |
| 125 inline iterator find(const Key& k) { return data_.find(k); } | 125 inline iterator find(const Key& k) { return data_.find(k); } |
| 126 | 126 |
| 127 inline size_t count(const Key& k) const { return data_.count(k); } | 127 inline size_t count(const Key& k) const { return data_.count(k); } |
| 128 inline std::pair<const_iterator, const_iterator> equal_range( | 128 inline std::pair<const_iterator, const_iterator> equal_range( |
| 129 const Key& k) const { | 129 const Key& k) const { |
| 130 return data_.equal_range(k); | 130 return data_.equal_range(k); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 148 | 148 |
| 149 private: | 149 private: |
| 150 Container data_; | 150 Container data_; |
| 151 | 151 |
| 152 DISALLOW_COPY_AND_ASSIGN(ScopedPtrHashMap); | 152 DISALLOW_COPY_AND_ASSIGN(ScopedPtrHashMap); |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 } // namespace cc | 155 } // namespace cc |
| 156 | 156 |
| 157 #endif // CC_BASE_SCOPED_PTR_HASH_MAP_H_ | 157 #endif // CC_BASE_SCOPED_PTR_HASH_MAP_H_ |
| OLD | NEW |