MCPcopy Create free account
hub / github.com/Samsung/UTopia / isConvertibleTo

Method isConvertibleTo

external/jsoncpp/jsoncpp.cpp:3230–3261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3228}
3229
3230bool Value::isConvertibleTo(ValueType other) const {
3231 switch (other) {
3232 case nullValue:
3233 return (isNumeric() && asDouble() == 0.0) ||
3234 (type() == booleanValue && value_.bool_ == false) ||
3235 (type() == stringValue && asString().empty()) ||
3236 (type() == arrayValue && value_.map_->empty()) ||
3237 (type() == objectValue && value_.map_->empty()) ||
3238 type() == nullValue;
3239 case intValue:
3240 return isInt() ||
3241 (type() == realValue && InRange(value_.real_, minInt, maxInt)) ||
3242 type() == booleanValue || type() == nullValue;
3243 case uintValue:
3244 return isUInt() ||
3245 (type() == realValue && InRange(value_.real_, 0, maxUInt)) ||
3246 type() == booleanValue || type() == nullValue;
3247 case realValue:
3248 return isNumeric() || type() == booleanValue || type() == nullValue;
3249 case booleanValue:
3250 return isNumeric() || type() == booleanValue || type() == nullValue;
3251 case stringValue:
3252 return isNumeric() || type() == booleanValue || type() == stringValue ||
3253 type() == nullValue;
3254 case arrayValue:
3255 return type() == arrayValue || type() == nullValue;
3256 case objectValue:
3257 return type() == objectValue || type() == nullValue;
3258 }
3259 JSON_ASSERT_UNREACHABLE;
3260 return false;
3261}
3262
3263/// Number of values in array or object
3264ArrayIndex Value::size() const {

Callers

nothing calls this directly

Calls 2

InRangeFunction · 0.85
emptyMethod · 0.80

Tested by

no test coverage detected