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

Method asInt

src/jsoncpp.cpp:3100–3122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

newCharReaderMethod · 0.80

Calls 1

InRangeFunction · 0.85

Tested by

no test coverage detected