OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_ARRAY_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_ARRAY_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_ARRAY_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_ARRAY_H_ |
7 | 7 |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 void reset() { | 61 void reset() { |
62 if (!vec_.empty()) { | 62 if (!vec_.empty()) { |
63 Traits::Finalize(&vec_); | 63 Traits::Finalize(&vec_); |
64 vec_.clear(); | 64 vec_.clear(); |
65 } | 65 } |
66 is_null_ = true; | 66 is_null_ = true; |
67 } | 67 } |
68 | 68 |
69 bool is_null() const { return is_null_; } | 69 bool is_null() const { return is_null_; } |
70 | 70 |
| 71 ConstRefType front() const { return vec_.front(); } |
| 72 RefType front() { return vec_.front(); } |
| 73 |
71 size_t size() const { return vec_.size(); } | 74 size_t size() const { return vec_.size(); } |
72 | 75 |
73 ConstRefType at(size_t offset) const { return Traits::at(&vec_, offset); } | 76 ConstRefType at(size_t offset) const { return Traits::at(&vec_, offset); } |
74 ConstRefType operator[](size_t offset) const { return at(offset); } | 77 ConstRefType operator[](size_t offset) const { return at(offset); } |
75 | 78 |
76 RefType at(size_t offset) { return Traits::at(&vec_, offset); } | 79 RefType at(size_t offset) { return Traits::at(&vec_, offset); } |
77 RefType operator[](size_t offset) { return at(offset); } | 80 RefType operator[](size_t offset) { return at(offset); } |
78 | 81 |
79 void push_back(ForwardType value) { | 82 void push_back(ForwardType value) { |
80 is_null_ = false; | 83 is_null_ = false; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 for (size_t i = 0; i < input.size(); ++i) | 140 for (size_t i = 0; i < input.size(); ++i) |
138 result[i] = TypeConverter<E, T>::Convert(input[i]); | 141 result[i] = TypeConverter<E, T>::Convert(input[i]); |
139 } | 142 } |
140 return result; | 143 return result; |
141 } | 144 } |
142 }; | 145 }; |
143 | 146 |
144 } // namespace mojo | 147 } // namespace mojo |
145 | 148 |
146 #endif // MOJO_PUBLIC_CPP_BINDINGS_ARRAY_H_ | 149 #endif // MOJO_PUBLIC_CPP_BINDINGS_ARRAY_H_ |
OLD | NEW |