MCPcopy Create free account
hub / github.com/Kitware/VTK / isConvertibleTo

Method isConvertibleTo

ThirdParty/jsoncpp/vtkjsoncpp/jsoncpp.cpp:3263–3294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3261}
3262
3263bool Value::isConvertibleTo(ValueType other) const {
3264 switch (other) {
3265 case nullValue:
3266 return (isNumeric() && asDouble() == 0.0) ||
3267 (type() == booleanValue && !value_.bool_) ||
3268 (type() == stringValue && asString().empty()) ||
3269 (type() == arrayValue && value_.map_->empty()) ||
3270 (type() == objectValue && value_.map_->empty()) ||
3271 type() == nullValue;
3272 case intValue:
3273 return isInt() ||
3274 (type() == realValue && InRange(value_.real_, minInt, maxInt)) ||
3275 type() == booleanValue || type() == nullValue;
3276 case uintValue:
3277 return isUInt() ||
3278 (type() == realValue && InRange(value_.real_, 0, maxUInt)) ||
3279 type() == booleanValue || type() == nullValue;
3280 case realValue:
3281 return isNumeric() || type() == booleanValue || type() == nullValue;
3282 case booleanValue:
3283 return isNumeric() || type() == booleanValue || type() == nullValue;
3284 case stringValue:
3285 return isNumeric() || type() == booleanValue || type() == stringValue ||
3286 type() == nullValue;
3287 case arrayValue:
3288 return type() == arrayValue || type() == nullValue;
3289 case objectValue:
3290 return type() == objectValue || type() == nullValue;
3291 }
3292 JSON_ASSERT_UNREACHABLE;
3293 return false;
3294}
3295
3296/// Number of values in array or object
3297ArrayIndex Value::size() const {

Callers

nothing calls this directly

Calls 4

asDoubleFunction · 0.85
InRangeFunction · 0.85
typeEnum · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected