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 // 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 16 matching lines...) Expand all Loading... |
27 // TODO(aa): Consider making the constructor public and the static Read() method | 27 // TODO(aa): Consider making the constructor public and the static Read() method |
28 // only a convenience for the common uses with more complex configuration going | 28 // only a convenience for the common uses with more complex configuration going |
29 // on the instance. | 29 // on the instance. |
30 | 30 |
31 #ifndef BASE_JSON_JSON_READER_H_ | 31 #ifndef BASE_JSON_JSON_READER_H_ |
32 #define BASE_JSON_JSON_READER_H_ | 32 #define BASE_JSON_JSON_READER_H_ |
33 #pragma once | 33 #pragma once |
34 | 34 |
35 #include <string> | 35 #include <string> |
36 | 36 |
37 #include "base/base_api.h" | 37 #include "base/base_export.h" |
38 #include "base/basictypes.h" | 38 #include "base/basictypes.h" |
39 | 39 |
40 // Chromium and Chromium OS check out gtest to different places, so we're | 40 // Chromium and Chromium OS check out gtest to different places, so we're |
41 // unable to compile on both if we include gtest_prod.h here. Instead, include | 41 // unable to compile on both if we include gtest_prod.h here. Instead, include |
42 // its only contents -- this will need to be updated if the macro ever changes. | 42 // its only contents -- this will need to be updated if the macro ever changes. |
43 #define FRIEND_TEST(test_case_name, test_name)\ | 43 #define FRIEND_TEST(test_case_name, test_name)\ |
44 friend class test_case_name##_##test_name##_Test | 44 friend class test_case_name##_##test_name##_Test |
45 | 45 |
46 namespace base { | 46 namespace base { |
47 | 47 |
48 class Value; | 48 class Value; |
49 | 49 |
50 class BASE_API JSONReader { | 50 class BASE_EXPORT JSONReader { |
51 public: | 51 public: |
52 // A struct to hold a JS token. | 52 // A struct to hold a JS token. |
53 class Token { | 53 class Token { |
54 public: | 54 public: |
55 enum Type { | 55 enum Type { |
56 OBJECT_BEGIN, // { | 56 OBJECT_BEGIN, // { |
57 OBJECT_END, // } | 57 OBJECT_END, // } |
58 ARRAY_BEGIN, // [ | 58 ARRAY_BEGIN, // [ |
59 ARRAY_END, // ] | 59 ARRAY_END, // ] |
60 STRING, | 60 STRING, |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 JsonParseError error_code_; | 212 JsonParseError error_code_; |
213 int error_line_; | 213 int error_line_; |
214 int error_col_; | 214 int error_col_; |
215 | 215 |
216 DISALLOW_COPY_AND_ASSIGN(JSONReader); | 216 DISALLOW_COPY_AND_ASSIGN(JSONReader); |
217 }; | 217 }; |
218 | 218 |
219 } // namespace base | 219 } // namespace base |
220 | 220 |
221 #endif // BASE_JSON_JSON_READER_H_ | 221 #endif // BASE_JSON_JSON_READER_H_ |
OLD | NEW |