MCPcopy Create free account
hub / github.com/EQEmu/EQEmu / asInt

Method asInt

common/json/jsoncpp.cpp:3156–3176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3154#endif
3155
3156Value::Int Value::asInt() const {
3157 switch (type_) {
3158 case intValue:
3159 JSON_ASSERT_MESSAGE(isInt(), "LargestInt out of Int range");
3160 return Int(value_.int_);
3161 case uintValue:
3162 JSON_ASSERT_MESSAGE(isInt(), "LargestUInt out of Int range");
3163 return Int(value_.uint_);
3164 case realValue:
3165 JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt, maxInt),
3166 "double out of Int range");
3167 return Int(value_.real_);
3168 case nullValue:
3169 return 0;
3170 case booleanValue:
3171 return value_.bool_ ? 1 : 0;
3172 default:
3173 break;
3174 }
3175 JSON_FAIL_MESSAGE("Value is not convertible to Int.");
3176}
3177
3178Value::UInt Value::asUInt() const {
3179 switch (type_) {

Callers 7

mainFunction · 0.80
RegisterRoutesFunction · 0.80
ApiSetLoggingLevelFunction · 0.80
GetVariableIntMethod · 0.80
SubscribeMethod · 0.80
UnsubscribeMethod · 0.80
newCharReaderMethod · 0.80

Calls 1

InRangeFunction · 0.85

Tested by

no test coverage detected