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

Unified Diff: base/json/json_reader.cc

Issue 6085015: Order function definitions in base/ according to the header. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: lrn2merge Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/json/json_reader.h ('k') | base/logging.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json/json_reader.cc
diff --git a/base/json/json_reader.cc b/base/json/json_reader.cc
index 391f58b3568620e0d461398d79ecea03c96901a6..dd5d08804c6757a709fc255a1665ce2d9bdec974 100644
--- a/base/json/json_reader.cc
+++ b/base/json/json_reader.cc
@@ -81,6 +81,11 @@ const char* JSONReader::kUnsupportedEncoding =
const char* JSONReader::kUnquotedDictionaryKey =
"Dictionary keys must be quoted.";
+JSONReader::JSONReader()
+ : start_pos_(NULL), json_pos_(NULL), stack_depth_(0),
+ allow_trailing_comma_(false),
+ error_code_(JSON_NO_ERROR), error_line_(0), error_col_(0) {}
+
/* static */
Value* JSONReader::Read(const std::string& json,
bool allow_trailing_comma) {
@@ -106,16 +111,6 @@ Value* JSONReader::ReadAndReturnError(const std::string& json,
}
/* static */
-std::string JSONReader::FormatErrorMessage(int line, int column,
- const std::string& description) {
- if (line || column) {
- return StringPrintf("Line: %i, column: %i, %s",
- line, column, description.c_str());
- }
- return description;
-}
-
-/* static */
std::string JSONReader::ErrorCodeToString(JsonParseError error_code) {
switch (error_code) {
case JSON_NO_ERROR:
@@ -147,11 +142,6 @@ std::string JSONReader::GetErrorMessage() const {
ErrorCodeToString(error_code_));
}
-JSONReader::JSONReader()
- : start_pos_(NULL), json_pos_(NULL), stack_depth_(0),
- allow_trailing_comma_(false),
- error_code_(JSON_NO_ERROR), error_line_(0), error_col_(0) {}
-
Value* JSONReader::JsonToValue(const std::string& json, bool check_root,
bool allow_trailing_comma) {
// The input must be in UTF-8.
@@ -195,6 +185,16 @@ Value* JSONReader::JsonToValue(const std::string& json, bool check_root,
return NULL;
}
+/* static */
+std::string JSONReader::FormatErrorMessage(int line, int column,
+ const std::string& description) {
+ if (line || column) {
+ return StringPrintf("Line: %i, column: %i, %s",
+ line, column, description.c_str());
+ }
+ return description;
+}
+
Value* JSONReader::BuildValue(bool is_root) {
++stack_depth_;
if (stack_depth_ > kStackLimit) {
@@ -580,16 +580,6 @@ JSONReader::Token JSONReader::ParseToken() {
return token;
}
-bool JSONReader::NextStringMatch(const std::wstring& str) {
- for (size_t i = 0; i < str.length(); ++i) {
- if ('\0' == *json_pos_)
- return false;
- if (*(json_pos_ + i) != str[i])
- return false;
- }
- return true;
-}
-
void JSONReader::EatWhitespaceAndComments() {
while ('\0' != *json_pos_) {
switch (*json_pos_) {
@@ -645,6 +635,16 @@ bool JSONReader::EatComment() {
return true;
}
+bool JSONReader::NextStringMatch(const std::wstring& str) {
+ for (size_t i = 0; i < str.length(); ++i) {
+ if ('\0' == *json_pos_)
+ return false;
+ if (*(json_pos_ + i) != str[i])
+ return false;
+ }
+ return true;
+}
+
void JSONReader::SetErrorCode(JsonParseError error,
const wchar_t* error_pos) {
int line_number = 1;
« no previous file with comments | « base/json/json_reader.h ('k') | base/logging.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698