| OLD | NEW |
| 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 Loading... |
| 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 void Value::operator=(const Value& that) { |
| 182 type_ = that.type_; |
| 178 } | 183 } |
| 179 | 184 |
| 180 ///////////////////// FundamentalValue //////////////////// | 185 ///////////////////// FundamentalValue //////////////////// |
| 181 | 186 |
| 182 FundamentalValue::FundamentalValue(bool in_value) | 187 FundamentalValue::FundamentalValue(bool in_value) |
| 183 : Value(TYPE_BOOLEAN), boolean_value_(in_value) { | 188 : Value(TYPE_BOOLEAN), boolean_value_(in_value) { |
| 184 } | 189 } |
| 185 | 190 |
| 186 FundamentalValue::FundamentalValue(int in_value) | 191 FundamentalValue::FundamentalValue(int in_value) |
| 187 : Value(TYPE_INTEGER), integer_value_(in_value) { | 192 : Value(TYPE_INTEGER), integer_value_(in_value) { |
| (...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 | 1134 |
| 1130 std::ostream& operator<<(std::ostream& out, const Value& value) { | 1135 std::ostream& operator<<(std::ostream& out, const Value& value) { |
| 1131 std::string json; | 1136 std::string json; |
| 1132 JSONWriter::WriteWithOptions(&value, | 1137 JSONWriter::WriteWithOptions(&value, |
| 1133 JSONWriter::OPTIONS_PRETTY_PRINT, | 1138 JSONWriter::OPTIONS_PRETTY_PRINT, |
| 1134 &json); | 1139 &json); |
| 1135 return out << json; | 1140 return out << json; |
| 1136 } | 1141 } |
| 1137 | 1142 |
| 1138 } // namespace base | 1143 } // namespace base |
| OLD | NEW |