MCPcopy Create free account
hub / github.com/ValveSoftware/Proton / asInt

Method asInt

vrclient_x64/jsoncpp.cpp:3099–3121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3097#endif
3098
3099Value::Int Value::asInt() const {
3100 switch (type_) {
3101 case intValue:
3102 JSON_ASSERT_MESSAGE(isInt(), "LargestInt out of Int range");
3103 return Int(value_.int_);
3104 case uintValue:
3105 JSON_ASSERT_MESSAGE(isInt(), "LargestUInt out of Int range");
3106 return Int(value_.uint_);
3107 case realValue:
3108 JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt, maxInt),
3109 "double out of Int range");
3110 return Int(value_.real_);
3111 case nullValue:
3112 return 0;
3113 case booleanValue:
3114 return value_.bool_ ? 1 : 0;
3115 default:
3116 if ( default_value_ )
3117 return default_value_->asInt();
3118 else
3119 return 0;
3120 }
3121}
3122
3123Value::UInt Value::asUInt() const {
3124 switch (type_) {

Callers 1

newCharReaderMethod · 0.80

Calls 1

InRangeFunction · 0.85

Tested by

no test coverage detected