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

Method asUInt

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

Source from the content-addressed store, hash-verified

745}
746
747Value::UInt
748Value::asUInt() const
749{
750 switch ( type_ )
751 {
752 case nullValue:
753 return 0;
754 case intValue:
755 //JSON_ASSERT_MESSAGE( value_.int_ >= 0, "Negative integer can not be converted to unsigned integer" );
756 JSON_ASSERT( value_.int_ >= 0 );
757 return value_.int_;
758 case uintValue:
759 return value_.uint_;
760 case realValue:
761 //JSON_ASSERT_MESSAGE( value_.real_ >= 0 && value_.real_ <= maxUInt, "Real out of unsigned integer range" );
762 JSON_ASSERT( value_.real_ >= 0 && value_.real_ <= maxUInt );
763 return UInt( value_.real_ );
764 case booleanValue:
765 return value_.bool_ ? 1 : 0;
766 case stringValue:
767 case arrayValue:
768 case objectValue:
769 //JSON_ASSERT_MESSAGE( false, "Type is not convertible to uint" );
770 JSON_ASSERT( false );
771 default:
772 JSON_ASSERT_UNREACHABLE;
773 }
774 return 0; // unreachable;
775}
776
777double
778Value::asDouble() const

Callers 1

writeValueMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected