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

Method asUInt

src/jsoncpp.cpp:3124–3146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3122}
3123
3124Value::UInt Value::asUInt() const {
3125 switch (type_) {
3126 case intValue:
3127 JSON_ASSERT_MESSAGE(isUInt(), "LargestInt out of UInt range");
3128 return UInt(value_.int_);
3129 case uintValue:
3130 JSON_ASSERT_MESSAGE(isUInt(), "LargestUInt out of UInt range");
3131 return UInt(value_.uint_);
3132 case realValue:
3133 JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt),
3134 "double out of UInt range");
3135 return UInt(value_.real_);
3136 case nullValue:
3137 return 0;
3138 case booleanValue:
3139 return value_.bool_ ? 1 : 0;
3140 default:
3141 if ( default_value_ )
3142 return default_value_->asUInt();
3143 else
3144 return 0u;
3145 }
3146}
3147
3148#if defined(JSON_HAS_INT64)
3149

Callers 1

newStreamWriterMethod · 0.80

Calls 1

InRangeFunction · 0.85

Tested by

no test coverage detected