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

Side by Side Diff: base/values.cc

Issue 11418048: Add copy and assignment to FundamentalValue and StringValue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month 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/values.h ('k') | chrome/browser/chromeos/cros/cros_network_functions.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/values.h" 5 #include "base/values.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <ostream> 8 #include <ostream>
9 9
10 #include "base/float_util.h" 10 #include "base/float_util.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 return other->IsType(TYPE_NULL); 167 return other->IsType(TYPE_NULL);
168 } 168 }
169 169
170 // static 170 // static
171 bool Value::Equals(const Value* a, const Value* b) { 171 bool Value::Equals(const Value* a, const Value* b) {
172 if ((a == NULL) && (b == NULL)) return true; 172 if ((a == NULL) && (b == NULL)) return true;
173 if ((a == NULL) ^ (b == NULL)) return false; 173 if ((a == NULL) ^ (b == NULL)) return false;
174 return a->Equals(b); 174 return a->Equals(b);
175 } 175 }
176 176
177 Value::Value(Type type) : type_(type) { 177 Value::Value(Type type) : type_(type) {}
178
179 Value::Value(const Value& that) : type_(that.type_) {}
180
181 Value& Value::operator=(const Value& that) {
182 type_ = that.type_;
183 return *this;
178 } 184 }
179 185
180 ///////////////////// FundamentalValue //////////////////// 186 ///////////////////// FundamentalValue ////////////////////
181 187
182 FundamentalValue::FundamentalValue(bool in_value) 188 FundamentalValue::FundamentalValue(bool in_value)
183 : Value(TYPE_BOOLEAN), boolean_value_(in_value) { 189 : Value(TYPE_BOOLEAN), boolean_value_(in_value) {
184 } 190 }
185 191
186 FundamentalValue::FundamentalValue(int in_value) 192 FundamentalValue::FundamentalValue(int in_value)
187 : Value(TYPE_INTEGER), integer_value_(in_value) { 193 : Value(TYPE_INTEGER), integer_value_(in_value) {
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 1135
1130 std::ostream& operator<<(std::ostream& out, const Value& value) { 1136 std::ostream& operator<<(std::ostream& out, const Value& value) {
1131 std::string json; 1137 std::string json;
1132 JSONWriter::WriteWithOptions(&value, 1138 JSONWriter::WriteWithOptions(&value,
1133 JSONWriter::OPTIONS_PRETTY_PRINT, 1139 JSONWriter::OPTIONS_PRETTY_PRINT,
1134 &json); 1140 &json);
1135 return out << json; 1141 return out << json;
1136 } 1142 }
1137 1143
1138 } // namespace base 1144 } // namespace base
OLDNEW
« no previous file with comments | « base/values.h ('k') | chrome/browser/chromeos/cros/cros_network_functions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698