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

Side by Side Diff: base/values.h

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/trace_event/trace_event_memory_overhead.cc ('k') | base/values.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 // This file specifies a recursive data storage class called Value intended for 5 // This file specifies a recursive data storage class called Value intended for
6 // storing settings and other persistable data. 6 // storing settings and other persistable data.
7 // 7 //
8 // A Value represents something that can be stored in JSON or passed to/from 8 // A Value represents something that can be stored in JSON or passed to/from
9 // JavaScript. As such, it is NOT a generalized variant type, since only the 9 // JavaScript. As such, it is NOT a generalized variant type, since only the
10 // types supported by JavaScript/JSON are supported. 10 // types supported by JavaScript/JSON are supported.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // These will all fatally assert if the type doesn't match. 130 // These will all fatally assert if the type doesn't match.
131 bool GetBool() const; 131 bool GetBool() const;
132 int GetInt() const; 132 int GetInt() const;
133 double GetDouble() const; // Implicitly converts from int if necessary. 133 double GetDouble() const; // Implicitly converts from int if necessary.
134 const std::string& GetString() const; 134 const std::string& GetString() const;
135 const BlobStorage& GetBlob() const; 135 const BlobStorage& GetBlob() const;
136 136
137 ListStorage& GetList(); 137 ListStorage& GetList();
138 const ListStorage& GetList() const; 138 const ListStorage& GetList() const;
139 139
140 size_t GetSize() const; // DEPRECATED, use GetBlob().size() instead.
141 const char* GetBuffer() const; // DEPRECATED, use GetBlob().data() instead.
142
143 // These methods allow the convenient retrieval of the contents of the Value. 140 // These methods allow the convenient retrieval of the contents of the Value.
144 // If the current object can be converted into the given type, the value is 141 // If the current object can be converted into the given type, the value is
145 // returned through the |out_value| parameter and true is returned; 142 // returned through the |out_value| parameter and true is returned;
146 // otherwise, false is returned and |out_value| is unchanged. 143 // otherwise, false is returned and |out_value| is unchanged.
147 bool GetAsBoolean(bool* out_value) const; 144 bool GetAsBoolean(bool* out_value) const;
148 bool GetAsInteger(int* out_value) const; 145 bool GetAsInteger(int* out_value) const;
149 bool GetAsDouble(double* out_value) const; 146 bool GetAsDouble(double* out_value) const;
150 bool GetAsString(std::string* out_value) const; 147 bool GetAsString(std::string* out_value) const;
151 bool GetAsString(string16* out_value) const; 148 bool GetAsString(string16* out_value) const;
152 bool GetAsString(const Value** out_value) const; 149 bool GetAsString(const Value** out_value) const;
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 return out << static_cast<const Value&>(value); 535 return out << static_cast<const Value&>(value);
539 } 536 }
540 537
541 // Stream operator so that enum class Types can be used in log statements. 538 // Stream operator so that enum class Types can be used in log statements.
542 BASE_EXPORT std::ostream& operator<<(std::ostream& out, 539 BASE_EXPORT std::ostream& operator<<(std::ostream& out,
543 const Value::Type& type); 540 const Value::Type& type);
544 541
545 } // namespace base 542 } // namespace base
546 543
547 #endif // BASE_VALUES_H_ 544 #endif // BASE_VALUES_H_
OLDNEW
« no previous file with comments | « base/trace_event/trace_event_memory_overhead.cc ('k') | base/values.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698