Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: base/json/json_parser.h

Issue 1538743002: Switch to standard integer types in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DEPS roll too Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/json/json_file_value_serializer.cc ('k') | base/json/json_parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
9 #include <stdint.h>
10
8 #include <string> 11 #include <string>
9 12
10 #include "base/base_export.h" 13 #include "base/base_export.h"
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
13 #include "base/gtest_prod_util.h" 15 #include "base/gtest_prod_util.h"
14 #include "base/json/json_reader.h" 16 #include "base/json/json_reader.h"
17 #include "base/macros.h"
15 #include "base/strings/string_piece.h" 18 #include "base/strings/string_piece.h"
16 19
17 namespace base { 20 namespace base {
18 21
19 class Value; 22 class Value;
20 23
21 namespace internal { 24 namespace internal {
22 25
23 class JSONParserTest; 26 class JSONParserTest;
24 27
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 bool ConsumeStringRaw(StringBuilder* out); 176 bool ConsumeStringRaw(StringBuilder* out);
174 // Helper function for ConsumeStringRaw() that consumes the next four or 10 177 // Helper function for ConsumeStringRaw() that consumes the next four or 10
175 // bytes (parser is wound to the first character of a HEX sequence, with the 178 // bytes (parser is wound to the first character of a HEX sequence, with the
176 // potential for consuming another \uXXXX for a surrogate). Returns true on 179 // potential for consuming another \uXXXX for a surrogate). Returns true on
177 // success and places the UTF8 code units in |dest_string|, and false on 180 // success and places the UTF8 code units in |dest_string|, and false on
178 // failure. 181 // failure.
179 bool DecodeUTF16(std::string* dest_string); 182 bool DecodeUTF16(std::string* dest_string);
180 // Helper function for ConsumeStringRaw() that takes a single code point, 183 // Helper function for ConsumeStringRaw() that takes a single code point,
181 // decodes it into UTF-8 units, and appends it to the given builder. The 184 // decodes it into UTF-8 units, and appends it to the given builder. The
182 // point must be valid. 185 // point must be valid.
183 void DecodeUTF8(const int32& point, StringBuilder* dest); 186 void DecodeUTF8(const int32_t& point, StringBuilder* dest);
184 187
185 // Assuming that the parser is wound to the start of a valid JSON number, 188 // Assuming that the parser is wound to the start of a valid JSON number,
186 // this parses and converts it to either an int or double value. 189 // this parses and converts it to either an int or double value.
187 Value* ConsumeNumber(); 190 Value* ConsumeNumber();
188 // Helper that reads characters that are ints. Returns true if a number was 191 // Helper that reads characters that are ints. Returns true if a number was
189 // read and false on error. 192 // read and false on error.
190 bool ReadInt(bool allow_leading_zeros); 193 bool ReadInt(bool allow_leading_zeros);
191 194
192 // Consumes the literal values of |true|, |false|, and |null|, assuming the 195 // Consumes the literal values of |true|, |false|, and |null|, assuming the
193 // parser is wound to the first character of any of those. 196 // parser is wound to the first character of any of those.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ConsumeNumbers); 248 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ConsumeNumbers);
246 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ErrorMessages); 249 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ErrorMessages);
247 250
248 DISALLOW_COPY_AND_ASSIGN(JSONParser); 251 DISALLOW_COPY_AND_ASSIGN(JSONParser);
249 }; 252 };
250 253
251 } // namespace internal 254 } // namespace internal
252 } // namespace base 255 } // namespace base
253 256
254 #endif // BASE_JSON_JSON_PARSER_H_ 257 #endif // BASE_JSON_JSON_PARSER_H_
OLDNEW
« no previous file with comments | « base/json/json_file_value_serializer.cc ('k') | base/json/json_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698