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

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

Issue 10003001: Update JSONReader to take base::StringPiece instead of std::string (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Sync with Parser changes Created 8 years, 6 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 | « no previous file | 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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // of a token, such that the next iteration of the parser will be at the byte 59 // of a token, such that the next iteration of the parser will be at the byte
60 // immediately following the token, which would likely be the first byte of the 60 // immediately following the token, which would likely be the first byte of the
61 // next token. 61 // next token.
62 class BASE_EXPORT_PRIVATE JSONParser { 62 class BASE_EXPORT_PRIVATE JSONParser {
63 public: 63 public:
64 explicit JSONParser(int options); 64 explicit JSONParser(int options);
65 ~JSONParser(); 65 ~JSONParser();
66 66
67 // Parses the input string according to the set options and returns the 67 // Parses the input string according to the set options and returns the
68 // result as a Value owned by the caller. 68 // result as a Value owned by the caller.
69 Value* Parse(const std::string& input); 69 Value* Parse(const StringPiece& input);
70 70
71 // Returns the error code. 71 // Returns the error code.
72 JSONReader::JsonParseError error_code() const; 72 JSONReader::JsonParseError error_code() const;
73 73
74 // Returns the human-friendly error message. 74 // Returns the human-friendly error message.
75 std::string GetErrorMessage() const; 75 std::string GetErrorMessage() const;
76 76
77 private: 77 private:
78 enum Token { 78 enum Token {
79 T_OBJECT_BEGIN, // { 79 T_OBJECT_BEGIN, // {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ConsumeNumbers); 264 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ConsumeNumbers);
265 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ErrorMessages); 265 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ErrorMessages);
266 266
267 DISALLOW_COPY_AND_ASSIGN(JSONParser); 267 DISALLOW_COPY_AND_ASSIGN(JSONParser);
268 }; 268 };
269 269
270 } // namespace internal 270 } // namespace internal
271 } // namespace base 271 } // namespace base
272 272
273 #endif // BASE_JSON_JSON_PARSER_H_ 273 #endif // BASE_JSON_JSON_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | base/json/json_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698