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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 DISALLOW_COPY_AND_ASSIGN(DictionaryValue); | 348 DISALLOW_COPY_AND_ASSIGN(DictionaryValue); |
349 }; | 349 }; |
350 | 350 |
351 // This type of Value represents a list of other Value values. | 351 // This type of Value represents a list of other Value values. |
352 class BASE_API ListValue : public Value { | 352 class BASE_API ListValue : public Value { |
353 public: | 353 public: |
354 typedef ValueVector::iterator iterator; | 354 typedef ValueVector::iterator iterator; |
355 typedef ValueVector::const_iterator const_iterator; | 355 typedef ValueVector::const_iterator const_iterator; |
356 | 356 |
357 ListValue(); | 357 ListValue(); |
358 ~ListValue(); | 358 virtual ~ListValue(); |
359 | 359 |
360 // Clears the contents of this ListValue | 360 // Clears the contents of this ListValue |
361 void Clear(); | 361 void Clear(); |
362 | 362 |
363 // Returns the number of Values in this list. | 363 // Returns the number of Values in this list. |
364 size_t GetSize() const { return list_.size(); } | 364 size_t GetSize() const { return list_.size(); } |
365 | 365 |
366 // Returns whether the list is empty. | 366 // Returns whether the list is empty. |
367 bool empty() const { return list_.empty(); } | 367 bool empty() const { return list_.empty(); } |
368 | 368 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 // This method deserializes the subclass-specific format into a Value object. | 447 // This method deserializes the subclass-specific format into a Value object. |
448 // If the return value is non-NULL, the caller takes ownership of returned | 448 // If the return value is non-NULL, the caller takes ownership of returned |
449 // Value. If the return value is NULL, and if error_code is non-NULL, | 449 // Value. If the return value is NULL, and if error_code is non-NULL, |
450 // error_code will be set with the underlying error. | 450 // error_code will be set with the underlying error. |
451 // If |error_message| is non-null, it will be filled in with a formatted | 451 // If |error_message| is non-null, it will be filled in with a formatted |
452 // error message including the location of the error if appropriate. | 452 // error message including the location of the error if appropriate. |
453 virtual Value* Deserialize(int* error_code, std::string* error_str) = 0; | 453 virtual Value* Deserialize(int* error_code, std::string* error_str) = 0; |
454 }; | 454 }; |
455 | 455 |
456 #endif // BASE_VALUES_H_ | 456 #endif // BASE_VALUES_H_ |
OLD | NEW |