MCPcopy Create free account
hub / github.com/Kitware/VTK / asInt

Method asInt

ThirdParty/jsoncpp/vtkjsoncpp/jsoncpp.cpp:3092–3112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3090}
3091
3092Value::Int Value::asInt() const {
3093 switch (type()) {
3094 case intValue:
3095 JSON_ASSERT_MESSAGE(isInt(), "LargestInt out of Int range");
3096 return Int(value_.int_);
3097 case uintValue:
3098 JSON_ASSERT_MESSAGE(isInt(), "LargestUInt out of Int range");
3099 return Int(value_.uint_);
3100 case realValue:
3101 JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt, maxInt),
3102 "double out of Int range");
3103 return Int(value_.real_);
3104 case nullValue:
3105 return 0;
3106 case booleanValue:
3107 return value_.bool_ ? 1 : 0;
3108 default:
3109 break;
3110 }
3111 JSON_FAIL_MESSAGE("Value is not convertible to Int.");
3112}
3113
3114Value::UInt Value::asUInt() const {
3115 switch (type()) {

Callers 6

GetIntValueFunction · 0.80
GetIntArrayFunction · 0.80
ExtractGeoJSONFeatureMethod · 0.80
SetPrecisionMethod · 0.80
AddFunctionsMethod · 0.80

Calls 2

InRangeFunction · 0.85
typeEnum · 0.50

Tested by

no test coverage detected