| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 MOJO_PUBLIC_CPP_BINDINGS_MAP_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_MAP_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_MAP_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_MAP_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "mojo/public/cpp/bindings/lib/map_internal.h" | 10 #include "mojo/public/cpp/bindings/lib/map_internal.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 void insert(KeyForwardType key, ValueForwardType value) { | 81 void insert(KeyForwardType key, ValueForwardType value) { |
| 82 is_null_ = false; | 82 is_null_ = false; |
| 83 Traits::Insert(&map_, key, value); | 83 Traits::Insert(&map_, key, value); |
| 84 } | 84 } |
| 85 | 85 |
| 86 ValueRefType at(KeyForwardType key) { return Traits::at(&map_, key); } | 86 ValueRefType at(KeyForwardType key) { return Traits::at(&map_, key); } |
| 87 ValueConstRefType at(KeyForwardType key) const { | 87 ValueConstRefType at(KeyForwardType key) const { |
| 88 return Traits::at(&map_, key); | 88 return Traits::at(&map_, key); |
| 89 } | 89 } |
| 90 | 90 |
| 91 ValueRefType operator[](KeyForwardType key) { |
| 92 return Traits::Index(&map_, key); |
| 93 } |
| 94 |
| 91 void Swap(Map<Key, Value>* other) { | 95 void Swap(Map<Key, Value>* other) { |
| 92 std::swap(is_null_, other->is_null_); | 96 std::swap(is_null_, other->is_null_); |
| 93 map_.swap(other->map_); | 97 map_.swap(other->map_); |
| 94 } | 98 } |
| 95 void Swap(std::map<Key, Value>* other) { | 99 void Swap(std::map<Key, Value>* other) { |
| 96 is_null_ = false; | 100 is_null_ = false; |
| 97 map_.swap(*other); | 101 map_.swap(*other); |
| 98 } | 102 } |
| 99 | 103 |
| 100 // This moves all values in the map to a set of parallel arrays. This action | 104 // This moves all values in the map to a set of parallel arrays. This action |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 TypeConverter<STLValue, MojoValue>::Convert(it.GetValue()))); | 220 TypeConverter<STLValue, MojoValue>::Convert(it.GetValue()))); |
| 217 } | 221 } |
| 218 } | 222 } |
| 219 return result; | 223 return result; |
| 220 } | 224 } |
| 221 }; | 225 }; |
| 222 | 226 |
| 223 } // namespace mojo | 227 } // namespace mojo |
| 224 | 228 |
| 225 #endif // MOJO_PUBLIC_CPP_BINDINGS_MAP_H_ | 229 #endif // MOJO_PUBLIC_CPP_BINDINGS_MAP_H_ |
| OLD | NEW |