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

Method asInt

lib/jsoncpp/src/lib_json/json_value.cpp:717–745  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

715# endif
716
717Value::Int
718Value::asInt() const
719{
720 switch ( type_ )
721 {
722 case nullValue:
723 return 0;
724 case intValue:
725 return value_.int_;
726 case uintValue:
727 //JSON_ASSERT_MESSAGE( value_.uint_ < (unsigned)maxInt, "integer out of signed integer range" );
728 JSON_ASSERT( value_.uint_ < (unsigned)maxInt );
729 return value_.uint_;
730 case realValue:
731 //JSON_ASSERT_MESSAGE( value_.real_ >= minInt && value_.real_ <= maxInt, "Real out of signed integer range" );
732 JSON_ASSERT( value_.real_ >= minInt && value_.real_ <= maxInt );
733 return Int( value_.real_ );
734 case booleanValue:
735 return value_.bool_ ? 1 : 0;
736 case stringValue:
737 case arrayValue:
738 case objectValue:
739 //JSON_ASSERT_MESSAGE( false, "Type is not convertible to int" );
740 JSON_ASSERT( false );
741 default:
742 JSON_ASSERT_UNREACHABLE;
743 }
744 return 0; // unreachable;
745}
746
747Value::UInt
748Value::asUInt() const

Callers 13

writeValueMethod · 0.80
FromJsonMethod · 0.80
LoadFromDiskMethod · 0.80
LoadFromJsonMethod · 0.80
LoadFromJsonMethod · 0.80
LoadFromJsonMethod · 0.80
LoadFromJsonMethod · 0.80
LoadFromJsonMethod · 0.80
LoadFromJsonMethod · 0.80
LoadFromJsonMethod · 0.80
LoadFromJsonMethod · 0.80
LoadFromJsonMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected