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

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

Issue 7756022: base/json: Get rid of static initializer in JSONReader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/json/json_reader.cc » ('j') | base/json/json_reader.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 // false. 186 // false.
187 bool EatComment(); 187 bool EatComment();
188 188
189 // Checks if |json_pos_| matches str. 189 // Checks if |json_pos_| matches str.
190 bool NextStringMatch(const wchar_t* str, size_t length); 190 bool NextStringMatch(const wchar_t* str, size_t length);
191 191
192 // Sets the error code that will be returned to the caller. The current 192 // Sets the error code that will be returned to the caller. The current
193 // line and column are determined and added into the final message. 193 // line and column are determined and added into the final message.
194 void SetErrorCode(const JsonParseError error, const wchar_t* error_pos); 194 void SetErrorCode(const JsonParseError error, const wchar_t* error_pos);
195 195
196 const Token* kInvalidToken;
197
196 // Pointer to the starting position in the input string. 198 // Pointer to the starting position in the input string.
197 const wchar_t* start_pos_; 199 const wchar_t* start_pos_;
198 200
199 // Pointer to the current position in the input string. 201 // Pointer to the current position in the input string.
200 const wchar_t* json_pos_; 202 const wchar_t* json_pos_;
201 203
202 // Used to keep track of how many nested lists/dicts there are. 204 // Used to keep track of how many nested lists/dicts there are.
203 int stack_depth_; 205 int stack_depth_;
204 206
205 // A parser flag that allows trailing commas in objects and arrays. 207 // A parser flag that allows trailing commas in objects and arrays.
206 bool allow_trailing_comma_; 208 bool allow_trailing_comma_;
207 209
208 // Contains the error code for the last call to JsonToValue(), if any. 210 // Contains the error code for the last call to JsonToValue(), if any.
209 JsonParseError error_code_; 211 JsonParseError error_code_;
210 int error_line_; 212 int error_line_;
211 int error_col_; 213 int error_col_;
212 214
213 DISALLOW_COPY_AND_ASSIGN(JSONReader); 215 DISALLOW_COPY_AND_ASSIGN(JSONReader);
214 }; 216 };
215 217
216 } // namespace base 218 } // namespace base
217 219
218 #endif // BASE_JSON_JSON_READER_H_ 220 #endif // BASE_JSON_JSON_READER_H_
OLDNEW
« no previous file with comments | « no previous file | base/json/json_reader.cc » ('j') | base/json/json_reader.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698