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

Side by Side Diff: chrome/common/json_schema_validator.cc

Issue 7661009: base: Add Is* functions to Value class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tony review Created 9 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 | « chrome/common/json_pref_store.cc ('k') | chrome/common/json_schema_validator_unittest_base.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) 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 "chrome/common/json_schema_validator.h" 5 #include "chrome/common/json_schema_validator.h"
6 6
7 #include <cfloat> 7 #include <cfloat>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 switch (choice->GetType()) { 242 switch (choice->GetType()) {
243 case Value::TYPE_NULL: 243 case Value::TYPE_NULL:
244 case Value::TYPE_BOOLEAN: 244 case Value::TYPE_BOOLEAN:
245 case Value::TYPE_STRING: 245 case Value::TYPE_STRING:
246 if (instance->Equals(choice)) 246 if (instance->Equals(choice))
247 return; 247 return;
248 break; 248 break;
249 249
250 case Value::TYPE_INTEGER: 250 case Value::TYPE_INTEGER:
251 case Value::TYPE_DOUBLE: 251 case Value::TYPE_DOUBLE:
252 if (instance->IsType(Value::TYPE_INTEGER) || 252 if (instance->IsInteger() || instance->IsDouble()) {
253 instance->IsType(Value::TYPE_DOUBLE)) {
254 if (GetNumberValue(choice) == GetNumberValue(instance)) 253 if (GetNumberValue(choice) == GetNumberValue(instance))
255 return; 254 return;
256 } 255 }
257 break; 256 break;
258 257
259 default: 258 default:
260 CHECK(false) << "Unexpected type in enum: " << choice->GetType(); 259 CHECK(false) << "Unexpected type in enum: " << choice->GetType();
261 } 260 }
262 } 261 }
263 262
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 473
475 if (*additional_properties_schema) { 474 if (*additional_properties_schema) {
476 std::string additional_properties_type("any"); 475 std::string additional_properties_type("any");
477 CHECK((*additional_properties_schema)->GetString( 476 CHECK((*additional_properties_schema)->GetString(
478 "type", &additional_properties_type)); 477 "type", &additional_properties_type));
479 return additional_properties_type == "any"; 478 return additional_properties_type == "any";
480 } else { 479 } else {
481 return default_allow_additional_properties_; 480 return default_allow_additional_properties_;
482 } 481 }
483 } 482 }
OLDNEW
« no previous file with comments | « chrome/common/json_pref_store.cc ('k') | chrome/common/json_schema_validator_unittest_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698