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

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

Issue 632103004: Cleanup: Better constify some strings in base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bad refactoring Created 6 years, 2 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_reader.h ('k') | base/json/json_reader_unittest.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 #include "base/json/json_reader.h" 5 #include "base/json/json_reader.h"
6 6
7 #include "base/json/json_parser.h" 7 #include "base/json/json_parser.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 9
10 namespace base { 10 namespace base {
11 11
12 // Values 1000 and above are used by JSONFileValueSerializer::JsonFileError. 12 // Values 1000 and above are used by JSONFileValueSerializer::JsonFileError.
13 COMPILE_ASSERT(JSONReader::JSON_PARSE_ERROR_COUNT < 1000, 13 COMPILE_ASSERT(JSONReader::JSON_PARSE_ERROR_COUNT < 1000,
14 json_reader_error_out_of_bounds); 14 json_reader_error_out_of_bounds);
15 15
16 const char* JSONReader::kInvalidEscape = 16 const char JSONReader::kInvalidEscape[] =
17 "Invalid escape sequence."; 17 "Invalid escape sequence.";
18 const char* JSONReader::kSyntaxError = 18 const char JSONReader::kSyntaxError[] =
19 "Syntax error."; 19 "Syntax error.";
20 const char* JSONReader::kUnexpectedToken = 20 const char JSONReader::kUnexpectedToken[] =
21 "Unexpected token."; 21 "Unexpected token.";
22 const char* JSONReader::kTrailingComma = 22 const char JSONReader::kTrailingComma[] =
23 "Trailing comma not allowed."; 23 "Trailing comma not allowed.";
24 const char* JSONReader::kTooMuchNesting = 24 const char JSONReader::kTooMuchNesting[] =
25 "Too much nesting."; 25 "Too much nesting.";
26 const char* JSONReader::kUnexpectedDataAfterRoot = 26 const char JSONReader::kUnexpectedDataAfterRoot[] =
27 "Unexpected data after root element."; 27 "Unexpected data after root element.";
28 const char* JSONReader::kUnsupportedEncoding = 28 const char JSONReader::kUnsupportedEncoding[] =
29 "Unsupported encoding. JSON must be UTF-8."; 29 "Unsupported encoding. JSON must be UTF-8.";
30 const char* JSONReader::kUnquotedDictionaryKey = 30 const char JSONReader::kUnquotedDictionaryKey[] =
31 "Dictionary keys must be quoted."; 31 "Dictionary keys must be quoted.";
32 32
33 JSONReader::JSONReader() 33 JSONReader::JSONReader()
34 : parser_(new internal::JSONParser(JSON_PARSE_RFC)) { 34 : parser_(new internal::JSONParser(JSON_PARSE_RFC)) {
35 } 35 }
36 36
37 JSONReader::JSONReader(int options) 37 JSONReader::JSONReader(int options)
38 : parser_(new internal::JSONParser(options)) { 38 : parser_(new internal::JSONParser(options)) {
39 } 39 }
40 40
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 JSONReader::JsonParseError JSONReader::error_code() const { 106 JSONReader::JsonParseError JSONReader::error_code() const {
107 return parser_->error_code(); 107 return parser_->error_code();
108 } 108 }
109 109
110 std::string JSONReader::GetErrorMessage() const { 110 std::string JSONReader::GetErrorMessage() const {
111 return parser_->GetErrorMessage(); 111 return parser_->GetErrorMessage();
112 } 112 }
113 113
114 } // namespace base 114 } // namespace base
OLDNEW
« no previous file with comments | « base/json/json_reader.h ('k') | base/json/json_reader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698