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 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 TYPE_INTEGER, | 59 TYPE_INTEGER, |
60 TYPE_DOUBLE, | 60 TYPE_DOUBLE, |
61 TYPE_STRING, | 61 TYPE_STRING, |
62 TYPE_BINARY, | 62 TYPE_BINARY, |
63 TYPE_DICTIONARY, | 63 TYPE_DICTIONARY, |
64 TYPE_LIST | 64 TYPE_LIST |
65 }; | 65 }; |
66 | 66 |
67 virtual ~Value(); | 67 virtual ~Value(); |
68 | 68 |
69 // Convenience methods for creating Value objects for various | |
70 // kinds of values without thinking about which class implements them. | |
71 // These can always be expected to return a valid Value*. | |
72 static Value* CreateNullValue(); | 69 static Value* CreateNullValue(); |
| 70 // DEPRECATED: Do not use the following 5 functions. Instead, use |
| 71 // new FundamentalValue or new StringValue. |
73 static FundamentalValue* CreateBooleanValue(bool in_value); | 72 static FundamentalValue* CreateBooleanValue(bool in_value); |
74 static FundamentalValue* CreateIntegerValue(int in_value); | 73 static FundamentalValue* CreateIntegerValue(int in_value); |
75 static FundamentalValue* CreateDoubleValue(double in_value); | 74 static FundamentalValue* CreateDoubleValue(double in_value); |
76 static StringValue* CreateStringValue(const std::string& in_value); | 75 static StringValue* CreateStringValue(const std::string& in_value); |
77 static StringValue* CreateStringValue(const string16& in_value); | 76 static StringValue* CreateStringValue(const string16& in_value); |
78 | 77 |
79 // Returns the type of the value stored by the current Value object. | 78 // Returns the type of the value stored by the current Value object. |
80 // Each type will be implemented by only one subclass of Value, so it's | 79 // Each type will be implemented by only one subclass of Value, so it's |
81 // safe to use the Type to determine whether you can cast from | 80 // safe to use the Type to determine whether you can cast from |
82 // Value* to (Implementing Class)*. Also, a Value object never changes | 81 // Value* to (Implementing Class)*. Also, a Value object never changes |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 | 529 |
531 } // namespace base | 530 } // namespace base |
532 | 531 |
533 // http://crbug.com/88666 | 532 // http://crbug.com/88666 |
534 using base::DictionaryValue; | 533 using base::DictionaryValue; |
535 using base::ListValue; | 534 using base::ListValue; |
536 using base::StringValue; | 535 using base::StringValue; |
537 using base::Value; | 536 using base::Value; |
538 | 537 |
539 #endif // BASE_VALUES_H_ | 538 #endif // BASE_VALUES_H_ |
OLD | NEW |