| 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_STRING_VALUE_SERIALIZER_H_ | 5 #ifndef BASE_JSON_JSON_STRING_VALUE_SERIALIZER_H_ |
| 6 #define BASE_JSON_JSON_STRING_VALUE_SERIALIZER_H_ | 6 #define BASE_JSON_JSON_STRING_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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 ~JSONStringValueDeserializer() override; | 53 ~JSONStringValueDeserializer() override; |
| 54 | 54 |
| 55 // Attempt to deserialize the data structure encoded in the string passed | 55 // Attempt to deserialize the data structure encoded in the string passed |
| 56 // in to the constructor into a structure of Value objects. If the return | 56 // in to the constructor into a structure of Value objects. If the return |
| 57 // value is null, and if |error_code| is non-null, |error_code| will | 57 // value is null, and if |error_code| is non-null, |error_code| will |
| 58 // contain an integer error code (a JsonParseError in this case). | 58 // contain an integer error code (a JsonParseError in this case). |
| 59 // If |error_message| is non-null, it will be filled in with a formatted | 59 // If |error_message| is non-null, it will be filled in with a formatted |
| 60 // error message including the location of the error if appropriate. | 60 // error message including the location of the error if appropriate. |
| 61 // The caller takes ownership of the returned value. | 61 // The caller takes ownership of the returned value. |
| 62 scoped_ptr<base::Value> Deserialize(int* error_code, | 62 std::unique_ptr<base::Value> Deserialize(int* error_code, |
| 63 std::string* error_message) override; | 63 std::string* error_message) override; |
| 64 | 64 |
| 65 void set_allow_trailing_comma(bool new_value) { | 65 void set_allow_trailing_comma(bool new_value) { |
| 66 allow_trailing_comma_ = new_value; | 66 allow_trailing_comma_ = new_value; |
| 67 } | 67 } |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 // Data is owned by the caller of the constructor. | 70 // Data is owned by the caller of the constructor. |
| 71 base::StringPiece json_string_; | 71 base::StringPiece json_string_; |
| 72 // If true, deserialization will allow trailing commas. | 72 // If true, deserialization will allow trailing commas. |
| 73 bool allow_trailing_comma_; | 73 bool allow_trailing_comma_; |
| 74 | 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(JSONStringValueDeserializer); | 75 DISALLOW_COPY_AND_ASSIGN(JSONStringValueDeserializer); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 #endif // BASE_JSON_JSON_STRING_VALUE_SERIALIZER_H_ | 78 #endif // BASE_JSON_JSON_STRING_VALUE_SERIALIZER_H_ |
| OLD | NEW |