MCPcopy Create free account
hub / github.com/PlayFab/gsdk / isConvertibleTo

Method isConvertibleTo

cpp/cppsdk/jsoncpp.cpp:3324–3355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3322}
3323
3324bool Value::isConvertibleTo(ValueType other) const {
3325 switch (other) {
3326 case nullValue:
3327 return (isNumeric() && asDouble() == 0.0) ||
3328 (type_ == booleanValue && value_.bool_ == false) ||
3329 (type_ == stringValue && asString().empty()) ||
3330 (type_ == arrayValue && value_.map_->size() == 0) ||
3331 (type_ == objectValue && value_.map_->size() == 0) ||
3332 type_ == nullValue;
3333 case intValue:
3334 return isInt() ||
3335 (type_ == realValue && InRange(value_.real_, minInt, maxInt)) ||
3336 type_ == booleanValue || type_ == nullValue;
3337 case uintValue:
3338 return isUInt() ||
3339 (type_ == realValue && InRange(value_.real_, 0, maxUInt)) ||
3340 type_ == booleanValue || type_ == nullValue;
3341 case realValue:
3342 return isNumeric() || type_ == booleanValue || type_ == nullValue;
3343 case booleanValue:
3344 return isNumeric() || type_ == booleanValue || type_ == nullValue;
3345 case stringValue:
3346 return isNumeric() || type_ == booleanValue || type_ == stringValue ||
3347 type_ == nullValue;
3348 case arrayValue:
3349 return type_ == arrayValue || type_ == nullValue;
3350 case objectValue:
3351 return type_ == objectValue || type_ == nullValue;
3352 }
3353 JSON_ASSERT_UNREACHABLE;
3354 return false;
3355}
3356
3357/// Number of values in array or object
3358ArrayIndex Value::size() const {

Callers

nothing calls this directly

Calls 3

InRangeFunction · 0.85
emptyMethod · 0.80
sizeMethod · 0.80

Tested by

no test coverage detected