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

Side by Side Diff: base/values.cc

Issue 1076443002: Removed obsolete float_util.h as VS2013 supports standards well enough. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Fixed mistake in value converter. Created 5 years, 8 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
« no previous file with comments | « base/trace_event/trace_event_impl.cc ('k') | cc/base/histograms.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 <string.h> 7 #include <string.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath>
10 #include <ostream> 11 #include <ostream>
11 12
12 #include "base/float_util.h"
13 #include "base/json/json_writer.h" 13 #include "base/json/json_writer.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/move.h" 15 #include "base/move.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 18
19 namespace base { 19 namespace base {
20 20
21 namespace { 21 namespace {
22 22
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 FundamentalValue::FundamentalValue(bool in_value) 168 FundamentalValue::FundamentalValue(bool in_value)
169 : Value(TYPE_BOOLEAN), boolean_value_(in_value) { 169 : Value(TYPE_BOOLEAN), boolean_value_(in_value) {
170 } 170 }
171 171
172 FundamentalValue::FundamentalValue(int in_value) 172 FundamentalValue::FundamentalValue(int in_value)
173 : Value(TYPE_INTEGER), integer_value_(in_value) { 173 : Value(TYPE_INTEGER), integer_value_(in_value) {
174 } 174 }
175 175
176 FundamentalValue::FundamentalValue(double in_value) 176 FundamentalValue::FundamentalValue(double in_value)
177 : Value(TYPE_DOUBLE), double_value_(in_value) { 177 : Value(TYPE_DOUBLE), double_value_(in_value) {
178 if (!IsFinite(double_value_)) { 178 if (!std::isfinite(double_value_)) {
179 NOTREACHED() << "Non-finite (i.e. NaN or positive/negative infinity) " 179 NOTREACHED() << "Non-finite (i.e. NaN or positive/negative infinity) "
180 << "values cannot be represented in JSON"; 180 << "values cannot be represented in JSON";
181 double_value_ = 0.0; 181 double_value_ = 0.0;
182 } 182 }
183 } 183 }
184 184
185 FundamentalValue::~FundamentalValue() { 185 FundamentalValue::~FundamentalValue() {
186 } 186 }
187 187
188 bool FundamentalValue::GetAsBoolean(bool* out_value) const { 188 bool FundamentalValue::GetAsBoolean(bool* out_value) const {
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 1148
1149 std::ostream& operator<<(std::ostream& out, const Value& value) { 1149 std::ostream& operator<<(std::ostream& out, const Value& value) {
1150 std::string json; 1150 std::string json;
1151 JSONWriter::WriteWithOptions(&value, 1151 JSONWriter::WriteWithOptions(&value,
1152 JSONWriter::OPTIONS_PRETTY_PRINT, 1152 JSONWriter::OPTIONS_PRETTY_PRINT,
1153 &json); 1153 &json);
1154 return out << json; 1154 return out << json;
1155 } 1155 }
1156 1156
1157 } // namespace base 1157 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/trace_event_impl.cc ('k') | cc/base/histograms.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698