OLD | NEW |
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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 bool Remove(const Value& value, size_t* index); | 446 bool Remove(const Value& value, size_t* index); |
447 | 447 |
448 // Removes the element at |iter|. If |out_value| is NULL, the value will be | 448 // Removes the element at |iter|. If |out_value| is NULL, the value will be |
449 // deleted, otherwise ownership of the value is passed back to the caller. | 449 // deleted, otherwise ownership of the value is passed back to the caller. |
450 // Returns an iterator pointing to the location of the element that | 450 // Returns an iterator pointing to the location of the element that |
451 // followed the erased element. | 451 // followed the erased element. |
452 iterator Erase(iterator iter, std::unique_ptr<Value>* out_value); | 452 iterator Erase(iterator iter, std::unique_ptr<Value>* out_value); |
453 | 453 |
454 // Appends a Value to the end of the list. | 454 // Appends a Value to the end of the list. |
455 void Append(std::unique_ptr<Value> in_value); | 455 void Append(std::unique_ptr<Value> in_value); |
456 #if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | |
457 // Deprecated version of the above. TODO(estade): remove. | |
458 void Append(Value* in_value); | |
459 #endif | |
460 | 456 |
461 // Convenience forms of Append. | 457 // Convenience forms of Append. |
462 void AppendBoolean(bool in_value); | 458 void AppendBoolean(bool in_value); |
463 void AppendInteger(int in_value); | 459 void AppendInteger(int in_value); |
464 void AppendDouble(double in_value); | 460 void AppendDouble(double in_value); |
465 void AppendString(StringPiece in_value); | 461 void AppendString(StringPiece in_value); |
466 void AppendString(const string16& in_value); | 462 void AppendString(const string16& in_value); |
467 void AppendStrings(const std::vector<std::string>& in_values); | 463 void AppendStrings(const std::vector<std::string>& in_values); |
468 void AppendStrings(const std::vector<string16>& in_values); | 464 void AppendStrings(const std::vector<string16>& in_values); |
469 | 465 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 return out << static_cast<const Value&>(value); | 534 return out << static_cast<const Value&>(value); |
539 } | 535 } |
540 | 536 |
541 // Stream operator so that enum class Types can be used in log statements. | 537 // Stream operator so that enum class Types can be used in log statements. |
542 BASE_EXPORT std::ostream& operator<<(std::ostream& out, | 538 BASE_EXPORT std::ostream& operator<<(std::ostream& out, |
543 const Value::Type& type); | 539 const Value::Type& type); |
544 | 540 |
545 } // namespace base | 541 } // namespace base |
546 | 542 |
547 #endif // BASE_VALUES_H_ | 543 #endif // BASE_VALUES_H_ |
OLD | NEW |