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

Method asInt

src/jsoncpp/jsoncpp.cpp:2046–2066  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2044#endif
2045
2046Value::Int Value::asInt() const {
2047 switch (type_) {
2048 case intValue:
2049 JSON_ASSERT_MESSAGE(isInt(), "LargestInt out of Int range");
2050 return Int(value_.int_);
2051 case uintValue:
2052 JSON_ASSERT_MESSAGE(isInt(), "LargestUInt out of Int range");
2053 return Int(value_.uint_);
2054 case realValue:
2055 JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt, maxInt),
2056 "double out of Int range");
2057 return Int(value_.real_);
2058 case nullValue:
2059 return 0;
2060 case booleanValue:
2061 return value_.bool_ ? 1 : 0;
2062 default:
2063 break;
2064 }
2065 JSON_FAIL_MESSAGE("Value is not convertible to Int.");
2066}
2067
2068Value::UInt Value::asUInt() const {
2069 switch (type_) {

Callers 1

prepareSettingsFunction · 0.80

Calls 1

InRangeFunction · 0.85

Tested by

no test coverage detected