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 #ifndef BASE_JSON_JSON_FILE_VALUE_SERIALIZER_H_ | 5 #ifndef BASE_JSON_JSON_FILE_VALUE_SERIALIZER_H_ |
6 #define BASE_JSON_JSON_FILE_VALUE_SERIALIZER_H_ | 6 #define BASE_JSON_JSON_FILE_VALUE_SERIALIZER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 ~JSONFileValueDeserializer() override; | 52 ~JSONFileValueDeserializer() override; |
53 | 53 |
54 // Attempt to deserialize the data structure encoded in the file passed | 54 // Attempt to deserialize the data structure encoded in the file passed |
55 // in to the constructor into a structure of Value objects. If the return | 55 // in to the constructor into a structure of Value objects. If the return |
56 // value is NULL, and if |error_code| is non-null, |error_code| will | 56 // value is NULL, and if |error_code| is non-null, |error_code| will |
57 // contain an integer error code (either JsonFileError or JsonParseError). | 57 // contain an integer error code (either JsonFileError or JsonParseError). |
58 // If |error_message| is non-null, it will be filled in with a formatted | 58 // If |error_message| is non-null, it will be filled in with a formatted |
59 // error message including the location of the error if appropriate. | 59 // error message including the location of the error if appropriate. |
60 // The caller takes ownership of the returned value. | 60 // The caller takes ownership of the returned value. |
61 base::Value* Deserialize(int* error_code, | 61 scoped_ptr<base::Value> Deserialize(int* error_code, |
62 std::string* error_message) override; | 62 std::string* error_message) override; |
63 | 63 |
64 // This enum is designed to safely overlap with JSONReader::JsonParseError. | 64 // This enum is designed to safely overlap with JSONReader::JsonParseError. |
65 enum JsonFileError { | 65 enum JsonFileError { |
66 JSON_NO_ERROR = 0, | 66 JSON_NO_ERROR = 0, |
67 JSON_ACCESS_DENIED = 1000, | 67 JSON_ACCESS_DENIED = 1000, |
68 JSON_CANNOT_READ_FILE, | 68 JSON_CANNOT_READ_FILE, |
69 JSON_FILE_LOCKED, | 69 JSON_FILE_LOCKED, |
70 JSON_NO_SUCH_FILE | 70 JSON_NO_SUCH_FILE |
71 }; | 71 }; |
72 | 72 |
(...skipping 22 matching lines...) Expand all Loading... |
95 | 95 |
96 const base::FilePath json_file_path_; | 96 const base::FilePath json_file_path_; |
97 bool allow_trailing_comma_; | 97 bool allow_trailing_comma_; |
98 size_t last_read_size_; | 98 size_t last_read_size_; |
99 | 99 |
100 DISALLOW_IMPLICIT_CONSTRUCTORS(JSONFileValueDeserializer); | 100 DISALLOW_IMPLICIT_CONSTRUCTORS(JSONFileValueDeserializer); |
101 }; | 101 }; |
102 | 102 |
103 #endif // BASE_JSON_JSON_FILE_VALUE_SERIALIZER_H_ | 103 #endif // BASE_JSON_JSON_FILE_VALUE_SERIALIZER_H_ |
104 | 104 |
OLD | NEW |