OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 | 10 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 bool FundamentalValue::GetAsInteger(int* out_value) const { | 173 bool FundamentalValue::GetAsInteger(int* out_value) const { |
174 if (out_value && IsType(TYPE_INTEGER)) | 174 if (out_value && IsType(TYPE_INTEGER)) |
175 *out_value = integer_value_; | 175 *out_value = integer_value_; |
176 return (IsType(TYPE_INTEGER)); | 176 return (IsType(TYPE_INTEGER)); |
177 } | 177 } |
178 | 178 |
179 bool FundamentalValue::GetAsDouble(double* out_value) const { | 179 bool FundamentalValue::GetAsDouble(double* out_value) const { |
180 if (out_value && IsType(TYPE_DOUBLE)) | 180 if (out_value && IsType(TYPE_DOUBLE)) |
181 *out_value = double_value_; | 181 *out_value = double_value_; |
182 return (IsType(TYPE_DOUBLE)); | 182 else if (out_value && IsType(TYPE_INTEGER)) |
| 183 *out_value = integer_value_; |
| 184 return (IsType(TYPE_DOUBLE) || IsType(TYPE_INTEGER)); |
183 } | 185 } |
184 | 186 |
185 FundamentalValue* FundamentalValue::DeepCopy() const { | 187 FundamentalValue* FundamentalValue::DeepCopy() const { |
186 switch (GetType()) { | 188 switch (GetType()) { |
187 case TYPE_BOOLEAN: | 189 case TYPE_BOOLEAN: |
188 return CreateBooleanValue(boolean_value_); | 190 return CreateBooleanValue(boolean_value_); |
189 | 191 |
190 case TYPE_INTEGER: | 192 case TYPE_INTEGER: |
191 return CreateIntegerValue(integer_value_); | 193 return CreateIntegerValue(integer_value_); |
192 | 194 |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 return false; | 889 return false; |
888 } | 890 } |
889 if (lhs_it != end() || rhs_it != other_list->end()) | 891 if (lhs_it != end() || rhs_it != other_list->end()) |
890 return false; | 892 return false; |
891 | 893 |
892 return true; | 894 return true; |
893 } | 895 } |
894 | 896 |
895 ValueSerializer::~ValueSerializer() { | 897 ValueSerializer::~ValueSerializer() { |
896 } | 898 } |
OLD | NEW |