| 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 // A JSON parser. Converts strings of JSON into a Value object (see | 5 // A JSON parser. Converts strings of JSON into a Value object (see |
| 6 // base/values.h). | 6 // base/values.h). |
| 7 // http://www.ietf.org/rfc/rfc4627.txt?number=4627 | 7 // http://www.ietf.org/rfc/rfc4627.txt?number=4627 |
| 8 // | 8 // |
| 9 // Known limitations/deviations from the RFC: | 9 // Known limitations/deviations from the RFC: |
| 10 // - Only knows how to parse ints within the range of a signed 32 bit int and | 10 // - Only knows how to parse ints within the range of a signed 32 bit int and |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #define BASE_JSON_JSON_READER_H_ | 29 #define BASE_JSON_JSON_READER_H_ |
| 30 | 30 |
| 31 #include <string> | 31 #include <string> |
| 32 | 32 |
| 33 #include "base/base_export.h" | 33 #include "base/base_export.h" |
| 34 #include "base/basictypes.h" | 34 #include "base/basictypes.h" |
| 35 #include "base/memory/scoped_ptr.h" | 35 #include "base/memory/scoped_ptr.h" |
| 36 #include "base/strings/string_piece.h" | 36 #include "base/strings/string_piece.h" |
| 37 | 37 |
| 38 namespace base { | 38 namespace base { |
| 39 |
| 39 class Value; | 40 class Value; |
| 40 | 41 |
| 41 namespace internal { | 42 namespace internal { |
| 42 class JSONParser; | 43 class JSONParser; |
| 43 } | 44 } |
| 44 } | |
| 45 | |
| 46 namespace base { | |
| 47 | 45 |
| 48 enum JSONParserOptions { | 46 enum JSONParserOptions { |
| 49 // Parses the input strictly according to RFC 4627, except for where noted | 47 // Parses the input strictly according to RFC 4627, except for where noted |
| 50 // above. | 48 // above. |
| 51 JSON_PARSE_RFC = 0, | 49 JSON_PARSE_RFC = 0, |
| 52 | 50 |
| 53 // Allows commas to exist after the last element in structures. | 51 // Allows commas to exist after the last element in structures. |
| 54 JSON_ALLOW_TRAILING_COMMAS = 1 << 0, | 52 JSON_ALLOW_TRAILING_COMMAS = 1 << 0, |
| 55 | 53 |
| 56 // The parser can perform optimizations by placing hidden data in the root of | 54 // The parser can perform optimizations by placing hidden data in the root of |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 // numbers if appropriate. | 125 // numbers if appropriate. |
| 128 std::string GetErrorMessage() const; | 126 std::string GetErrorMessage() const; |
| 129 | 127 |
| 130 private: | 128 private: |
| 131 scoped_ptr<internal::JSONParser> parser_; | 129 scoped_ptr<internal::JSONParser> parser_; |
| 132 }; | 130 }; |
| 133 | 131 |
| 134 } // namespace base | 132 } // namespace base |
| 135 | 133 |
| 136 #endif // BASE_JSON_JSON_READER_H_ | 134 #endif // BASE_JSON_JSON_READER_H_ |
| OLD | NEW |