MCPcopy Create free account
hub / github.com/cinder/Cinder / isConvertibleTo

Method isConvertibleTo

src/jsoncpp/jsoncpp.cpp:2213–2244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2211}
2212
2213bool Value::isConvertibleTo(ValueType other) const {
2214 switch (other) {
2215 case nullValue:
2216 return (isNumeric() && asDouble() == 0.0) ||
2217 (type_ == booleanValue && value_.bool_ == false) ||
2218 (type_ == stringValue && asString() == "") ||
2219 (type_ == arrayValue && value_.map_->size() == 0) ||
2220 (type_ == objectValue && value_.map_->size() == 0) ||
2221 type_ == nullValue;
2222 case intValue:
2223 return isInt() ||
2224 (type_ == realValue && InRange(value_.real_, minInt, maxInt)) ||
2225 type_ == booleanValue || type_ == nullValue;
2226 case uintValue:
2227 return isUInt() ||
2228 (type_ == realValue && InRange(value_.real_, 0, maxUInt)) ||
2229 type_ == booleanValue || type_ == nullValue;
2230 case realValue:
2231 return isNumeric() || type_ == booleanValue || type_ == nullValue;
2232 case booleanValue:
2233 return isNumeric() || type_ == booleanValue || type_ == nullValue;
2234 case stringValue:
2235 return isNumeric() || type_ == booleanValue || type_ == stringValue ||
2236 type_ == nullValue;
2237 case arrayValue:
2238 return type_ == arrayValue || type_ == nullValue;
2239 case objectValue:
2240 return type_ == objectValue || type_ == nullValue;
2241 }
2242 JSON_ASSERT_UNREACHABLE;
2243 return false;
2244}
2245
2246/// Number of values in array or object
2247ArrayIndex Value::size() const {

Callers

nothing calls this directly

Calls 3

isNumericFunction · 0.85
InRangeFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected