| 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_PARSER_H_ | 5 #ifndef BASE_JSON_JSON_PARSER_H_ |
| 6 #define BASE_JSON_JSON_PARSER_H_ | 6 #define BASE_JSON_JSON_PARSER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 const std::string& AsString(); | 126 const std::string& AsString(); |
| 127 | 127 |
| 128 private: | 128 private: |
| 129 // The beginning of the input string. | 129 // The beginning of the input string. |
| 130 const char* pos_; | 130 const char* pos_; |
| 131 | 131 |
| 132 // Number of bytes in |pos_| that make up the string being built. | 132 // Number of bytes in |pos_| that make up the string being built. |
| 133 size_t length_; | 133 size_t length_; |
| 134 | 134 |
| 135 // The copied string representation. NULL until Convert() is called. | 135 // The copied string representation. NULL until Convert() is called. |
| 136 // Strong. scoped_ptr<T> has too much of an overhead here. | 136 // Strong. std::unique_ptr<T> has too much of an overhead here. |
| 137 std::string* string_; | 137 std::string* string_; |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 // Quick check that the stream has capacity to consume |length| more bytes. | 140 // Quick check that the stream has capacity to consume |length| more bytes. |
| 141 bool CanConsume(int length); | 141 bool CanConsume(int length); |
| 142 | 142 |
| 143 // The basic way to consume a single character in the stream. Consumes one | 143 // The basic way to consume a single character in the stream. Consumes one |
| 144 // byte of the input stream and returns a pointer to the rest of it. | 144 // byte of the input stream and returns a pointer to the rest of it. |
| 145 const char* NextChar(); | 145 const char* NextChar(); |
| 146 | 146 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ConsumeNumbers); | 256 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ConsumeNumbers); |
| 257 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ErrorMessages); | 257 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ErrorMessages); |
| 258 | 258 |
| 259 DISALLOW_COPY_AND_ASSIGN(JSONParser); | 259 DISALLOW_COPY_AND_ASSIGN(JSONParser); |
| 260 }; | 260 }; |
| 261 | 261 |
| 262 } // namespace internal | 262 } // namespace internal |
| 263 } // namespace base | 263 } // namespace base |
| 264 | 264 |
| 265 #endif // BASE_JSON_JSON_PARSER_H_ | 265 #endif // BASE_JSON_JSON_PARSER_H_ |
| OLD | NEW |