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 // 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 | 33 |
34 #include <string> | 34 #include <string> |
35 | 35 |
36 #include "base/basictypes.h" | 36 #include "base/basictypes.h" |
37 #include "testing/gtest/include/gtest/gtest_prod.h" | 37 |
| 38 // Chromium and Chromium OS check out gtest to different places, so we're |
| 39 // unable to compile on both if we include gtest_prod.h here. Instead, include |
| 40 // its only contents -- this will need to be updated if the macro ever changes. |
| 41 #define FRIEND_TEST(test_case_name, test_name)\ |
| 42 friend class test_case_name##_##test_name##_Test |
38 | 43 |
39 class Value; | 44 class Value; |
40 | 45 |
41 namespace base { | 46 namespace base { |
42 | 47 |
43 class JSONReader { | 48 class JSONReader { |
44 public: | 49 public: |
45 // A struct to hold a JS token. | 50 // A struct to hold a JS token. |
46 class Token { | 51 class Token { |
47 public: | 52 public: |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // A parser flag that allows trailing commas in objects and arrays. | 186 // A parser flag that allows trailing commas in objects and arrays. |
182 bool allow_trailing_comma_; | 187 bool allow_trailing_comma_; |
183 | 188 |
184 // Contains the error message for the last call to JsonToValue(), if any. | 189 // Contains the error message for the last call to JsonToValue(), if any. |
185 std::string error_message_; | 190 std::string error_message_; |
186 }; | 191 }; |
187 | 192 |
188 } // namespace base | 193 } // namespace base |
189 | 194 |
190 #endif // BASE_JSON_JSON_READER_H_ | 195 #endif // BASE_JSON_JSON_READER_H_ |
OLD | NEW |