MCPcopy Create free account
hub / github.com/Illumina/paragraph / isConvertibleTo

Method isConvertibleTo

external/jsoncpp/jsoncpp.cpp:3370–3401  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3368}
3369
3370bool Value::isConvertibleTo(ValueType other) const {
3371 switch (other) {
3372 case nullValue:
3373 return (isNumeric() && asDouble() == 0.0) ||
3374 (type_ == booleanValue && value_.bool_ == false) ||
3375 (type_ == stringValue && asString().empty()) ||
3376 (type_ == arrayValue && value_.map_->size() == 0) ||
3377 (type_ == objectValue && value_.map_->size() == 0) ||
3378 type_ == nullValue;
3379 case intValue:
3380 return isInt() ||
3381 (type_ == realValue && InRange(value_.real_, minInt, maxInt)) ||
3382 type_ == booleanValue || type_ == nullValue;
3383 case uintValue:
3384 return isUInt() ||
3385 (type_ == realValue && InRange(value_.real_, 0, maxUInt)) ||
3386 type_ == booleanValue || type_ == nullValue;
3387 case realValue:
3388 return isNumeric() || type_ == booleanValue || type_ == nullValue;
3389 case booleanValue:
3390 return isNumeric() || type_ == booleanValue || type_ == nullValue;
3391 case stringValue:
3392 return isNumeric() || type_ == booleanValue || type_ == stringValue ||
3393 type_ == nullValue;
3394 case arrayValue:
3395 return type_ == arrayValue || type_ == nullValue;
3396 case objectValue:
3397 return type_ == objectValue || type_ == nullValue;
3398 }
3399 JSON_ASSERT_UNREACHABLE;
3400 return false;
3401}
3402
3403/// Number of values in array or object
3404ArrayIndex Value::size() const {

Callers

nothing calls this directly

Calls 3

InRangeFunction · 0.85
emptyMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected