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

Method asInt

external/jsoncpp/jsoncpp.cpp:3061–3081  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3059#endif
3060
3061Value::Int Value::asInt() const {
3062 switch (type()) {
3063 case intValue:
3064 JSON_ASSERT_MESSAGE(isInt(), "LargestInt out of Int range");
3065 return Int(value_.int_);
3066 case uintValue:
3067 JSON_ASSERT_MESSAGE(isInt(), "LargestUInt out of Int range");
3068 return Int(value_.uint_);
3069 case realValue:
3070 JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt, maxInt),
3071 "double out of Int range");
3072 return Int(value_.real_);
3073 case nullValue:
3074 return 0;
3075 case booleanValue:
3076 return value_.bool_ ? 1 : 0;
3077 default:
3078 break;
3079 }
3080 JSON_FAIL_MESSAGE("Value is not convertible to Int.");
3081}
3082
3083Value::UInt Value::asUInt() const {
3084 switch (type()) {

Callers 2

fromJsonMethod · 0.80
fromJsonMethod · 0.80

Calls 1

InRangeFunction · 0.85

Tested by

no test coverage detected