OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 | 5 // This file specifies a recursive data storage class called Value |
6 // intended for storing setting and other persistable data. | 6 // intended for storing setting and other persistable data. |
7 // It includes the ability to specify (recursive) lists and dictionaries, so | 7 // It includes the ability to specify (recursive) lists and dictionaries, so |
8 // it's fairly expressive. However, the API is optimized for the common case, | 8 // it's fairly expressive. However, the API is optimized for the common case, |
9 // namely storing a hierarchical tree of simple values. Given a | 9 // namely storing a hierarchical tree of simple values. Given a |
10 // DictionaryValue root, you can easily do things like: | 10 // DictionaryValue root, you can easily do things like: |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 class ValueSerializer { | 345 class ValueSerializer { |
346 public: | 346 public: |
347 virtual ~ValueSerializer() {} | 347 virtual ~ValueSerializer() {} |
348 | 348 |
349 virtual bool Serialize(const Value& root) = 0; | 349 virtual bool Serialize(const Value& root) = 0; |
350 | 350 |
351 // This method deserializes the subclass-specific format into a Value object. | 351 // This method deserializes the subclass-specific format into a Value object. |
352 // The method should return true if and only if the root parameter is set | 352 // The method should return true if and only if the root parameter is set |
353 // to a complete Value representation of the serialized form. If the | 353 // to a complete Value representation of the serialized form. If the |
354 // return value is true, the caller takes ownership of the objects pointed | 354 // return value is true, the caller takes ownership of the objects pointed |
355 // to by root. If the return value is false, root should be unchanged. | 355 // to by root. If the return value is false, root should be unchanged and if |
356 virtual bool Deserialize(Value** root) = 0; | 356 // error_message is non-null, it should be filled with a message describing |
| 357 // the error. |
| 358 virtual bool Deserialize(Value** root, std::string* error_message) = 0; |
357 }; | 359 }; |
358 | 360 |
359 #endif // BASE_VALUES_H_ | 361 #endif // BASE_VALUES_H_ |
OLD | NEW |