| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 setting and other persistable data. It includes the ability to | 6 // storing setting and other persistable data. It includes the ability to |
| 7 // specify (recursive) lists and dictionaries, so it's fairly expressive. | 7 // specify (recursive) lists and dictionaries, so it's fairly expressive. |
| 8 // However, the API is optimized for the common case, namely storing a | 8 // However, the API is optimized for the common case, namely storing a |
| 9 // hierarchical tree of simple values. Given a DictionaryValue root, you can | 9 // hierarchical tree of simple values. Given a DictionaryValue root, you can |
| 10 // easily do things like: | 10 // easily do things like: |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // this works because C++ supports covariant return types. | 106 // this works because C++ supports covariant return types. |
| 107 virtual Value* DeepCopy() const; | 107 virtual Value* DeepCopy() const; |
| 108 | 108 |
| 109 // Compares if two Value objects have equal contents. | 109 // Compares if two Value objects have equal contents. |
| 110 virtual bool Equals(const Value* other) const; | 110 virtual bool Equals(const Value* other) const; |
| 111 | 111 |
| 112 // Compares if two Value objects have equal contents. Can handle NULLs. | 112 // Compares if two Value objects have equal contents. Can handle NULLs. |
| 113 // NULLs are considered equal but different from Value::CreateNullValue(). | 113 // NULLs are considered equal but different from Value::CreateNullValue(). |
| 114 static bool Equals(const Value* a, const Value* b); | 114 static bool Equals(const Value* a, const Value* b); |
| 115 | 115 |
| 116 #if !defined(OS_CHROMEOS) |
| 117 // NOTE: We pass Value from libcros tp Chrome, so changing the size of Value |
| 118 // breaks it. TODO(stevenjb): Eliminate that dependency (crosbug.com/19576). |
| 116 // TODO(sky) bug 91396: remove this when we figure out 91396. | 119 // TODO(sky) bug 91396: remove this when we figure out 91396. |
| 117 // If true crash when deleted. | 120 // If true crash when deleted. |
| 118 void set_check_on_delete(bool value) { check_on_delete_ = value; } | 121 void set_check_on_delete(bool value) { check_on_delete_ = value; } |
| 122 #else |
| 123 void set_check_on_delete(bool value) {} |
| 124 #endif |
| 119 | 125 |
| 120 protected: | 126 protected: |
| 121 // This isn't safe for end-users (they should use the Create*Value() | 127 // This isn't safe for end-users (they should use the Create*Value() |
| 122 // static methods above), but it's useful for subclasses. | 128 // static methods above), but it's useful for subclasses. |
| 123 explicit Value(Type type); | 129 explicit Value(Type type); |
| 124 | 130 |
| 125 private: | 131 private: |
| 126 Type type_; | 132 Type type_; |
| 127 | 133 |
| 134 #if !defined(OS_CHROMEOS) |
| 128 // See description above setter. | 135 // See description above setter. |
| 129 bool check_on_delete_; | 136 bool check_on_delete_; |
| 137 #endif |
| 130 | 138 |
| 131 DISALLOW_COPY_AND_ASSIGN(Value); | 139 DISALLOW_COPY_AND_ASSIGN(Value); |
| 132 }; | 140 }; |
| 133 | 141 |
| 134 // FundamentalValue represents the simple fundamental types of values. | 142 // FundamentalValue represents the simple fundamental types of values. |
| 135 class BASE_EXPORT FundamentalValue : public Value { | 143 class BASE_EXPORT FundamentalValue : public Value { |
| 136 public: | 144 public: |
| 137 explicit FundamentalValue(bool in_value); | 145 explicit FundamentalValue(bool in_value); |
| 138 explicit FundamentalValue(int in_value); | 146 explicit FundamentalValue(int in_value); |
| 139 explicit FundamentalValue(double in_value); | 147 explicit FundamentalValue(double in_value); |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 | 474 |
| 467 } // namespace base | 475 } // namespace base |
| 468 | 476 |
| 469 // http://crbug.com/88666 | 477 // http://crbug.com/88666 |
| 470 using base::DictionaryValue; | 478 using base::DictionaryValue; |
| 471 using base::ListValue; | 479 using base::ListValue; |
| 472 using base::StringValue; | 480 using base::StringValue; |
| 473 using base::Value; | 481 using base::Value; |
| 474 | 482 |
| 475 #endif // BASE_VALUES_H_ | 483 #endif // BASE_VALUES_H_ |
| OLD | NEW |