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

Side by Side Diff: base/values.cc

Issue 2841623003: Remove base::Value::Get{Buffer,Size} (Closed)
Patch Set: std::vector::assign instead of std::vector::operator= Created 3 years, 8 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 | « base/values.h ('k') | base/values_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "base/values.h" 5 #include "base/values.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 Value::ListStorage& Value::GetList() { 237 Value::ListStorage& Value::GetList() {
238 CHECK(is_list()); 238 CHECK(is_list());
239 return *list_; 239 return *list_;
240 } 240 }
241 241
242 const Value::ListStorage& Value::GetList() const { 242 const Value::ListStorage& Value::GetList() const {
243 CHECK(is_list()); 243 CHECK(is_list());
244 return *list_; 244 return *list_;
245 } 245 }
246 246
247 size_t Value::GetSize() const {
248 return GetBlob().size();
249 }
250
251 const char* Value::GetBuffer() const {
252 return GetBlob().data();
253 }
254
255 bool Value::GetAsBoolean(bool* out_value) const { 247 bool Value::GetAsBoolean(bool* out_value) const {
256 if (out_value && is_bool()) { 248 if (out_value && is_bool()) {
257 *out_value = bool_value_; 249 *out_value = bool_value_;
258 return true; 250 return true;
259 } 251 }
260 return is_bool(); 252 return is_bool();
261 } 253 }
262 254
263 bool Value::GetAsInteger(int* out_value) const { 255 bool Value::GetAsInteger(int* out_value) const {
264 if (out_value && is_int()) { 256 if (out_value && is_int()) {
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 } 1316 }
1325 1317
1326 std::ostream& operator<<(std::ostream& out, const Value::Type& type) { 1318 std::ostream& operator<<(std::ostream& out, const Value::Type& type) {
1327 if (static_cast<int>(type) < 0 || 1319 if (static_cast<int>(type) < 0 ||
1328 static_cast<size_t>(type) >= arraysize(kTypeNames)) 1320 static_cast<size_t>(type) >= arraysize(kTypeNames))
1329 return out << "Invalid Type (index = " << static_cast<int>(type) << ")"; 1321 return out << "Invalid Type (index = " << static_cast<int>(type) << ")";
1330 return out << Value::GetTypeName(type); 1322 return out << Value::GetTypeName(type);
1331 } 1323 }
1332 1324
1333 } // namespace base 1325 } // namespace base
OLDNEW
« no previous file with comments | « base/values.h ('k') | base/values_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698