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

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

Issue 10834060: base: Add missing "virtual" keyword and OVERRIDE to some methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | « base/files/file_path_watcher_linux.cc ('k') | base/message_pump_glib_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_parser.h" 5 #include "base/json/json_parser.h"
6 6
7 #include "base/float_util.h" 7 #include "base/float_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 // A variant on StringValue that uses StringPiece instead of copying the string 133 // A variant on StringValue that uses StringPiece instead of copying the string
134 // into the Value. This can only be stored in a child of hidden root (above), 134 // into the Value. This can only be stored in a child of hidden root (above),
135 // otherwise the referenced string will not be guaranteed to outlive it. 135 // otherwise the referenced string will not be guaranteed to outlive it.
136 class JSONStringValue : public base::Value { 136 class JSONStringValue : public base::Value {
137 public: 137 public:
138 explicit JSONStringValue(const base::StringPiece& piece) 138 explicit JSONStringValue(const base::StringPiece& piece)
139 : Value(TYPE_STRING), 139 : Value(TYPE_STRING),
140 string_piece_(piece) { 140 string_piece_(piece) {
141 } 141 }
142 142
143 // Value: 143 // Overridden from base::Value:
144 bool GetAsString(std::string* out_value) const OVERRIDE { 144 virtual bool GetAsString(std::string* out_value) const OVERRIDE {
145 string_piece_.CopyToString(out_value); 145 string_piece_.CopyToString(out_value);
146 return true; 146 return true;
147 } 147 }
148 bool GetAsString(string16* out_value) const OVERRIDE { 148 virtual bool GetAsString(string16* out_value) const OVERRIDE {
149 *out_value = UTF8ToUTF16(string_piece_); 149 *out_value = UTF8ToUTF16(string_piece_);
150 return true; 150 return true;
151 } 151 }
152 virtual Value* DeepCopy() const OVERRIDE { 152 virtual Value* DeepCopy() const OVERRIDE {
153 return Value::CreateStringValue(string_piece_.as_string()); 153 return Value::CreateStringValue(string_piece_.as_string());
154 } 154 }
155 virtual bool Equals(const Value* other) const OVERRIDE { 155 virtual bool Equals(const Value* other) const OVERRIDE {
156 std::string other_string; 156 std::string other_string;
157 return other->IsType(TYPE_STRING) && other->GetAsString(&other_string) && 157 return other->IsType(TYPE_STRING) && other->GetAsString(&other_string) &&
158 StringPiece(other_string) == string_piece_; 158 StringPiece(other_string) == string_piece_;
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 const std::string& description) { 961 const std::string& description) {
962 if (line || column) { 962 if (line || column) {
963 return StringPrintf("Line: %i, column: %i, %s", 963 return StringPrintf("Line: %i, column: %i, %s",
964 line, column, description.c_str()); 964 line, column, description.c_str());
965 } 965 }
966 return description; 966 return description;
967 } 967 }
968 968
969 } // namespace internal 969 } // namespace internal
970 } // namespace base 970 } // namespace base
OLDNEW
« no previous file with comments | « base/files/file_path_watcher_linux.cc ('k') | base/message_pump_glib_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698