Request: Minor code cleanup

This commit is contained in:
tt2468 2021-06-16 02:41:13 -07:00
parent 3400bfdc9a
commit 55755ae066

View File

@ -37,9 +37,8 @@ const bool Request::ValidateBasic(const std::string keyName, RequestStatus::Requ
const bool Request::ValidateNumber(const std::string keyName, RequestStatus::RequestStatus &statusCode, std::string &comment, const double minValue, const double maxValue) const
{
if (!ValidateBasic(keyName, statusCode, comment)) {
if (!ValidateBasic(keyName, statusCode, comment))
return false;
}
if (!RequestData[keyName].is_number()) {
statusCode = RequestStatus::InvalidRequestParameterDataType;
@ -64,9 +63,8 @@ const bool Request::ValidateNumber(const std::string keyName, RequestStatus::Req
const bool Request::ValidateString(const std::string keyName, RequestStatus::RequestStatus &statusCode, std::string &comment, const bool allowEmpty) const
{
if (!ValidateBasic(keyName, statusCode, comment)) {
if (!ValidateBasic(keyName, statusCode, comment))
return false;
}
if (!RequestData[keyName].is_string()) {
statusCode = RequestStatus::InvalidRequestParameterDataType;
@ -85,9 +83,8 @@ const bool Request::ValidateString(const std::string keyName, RequestStatus::Req
const bool Request::ValidateBoolean(const std::string keyName, RequestStatus::RequestStatus &statusCode, std::string &comment) const
{
if (!ValidateBasic(keyName, statusCode, comment)) {
if (!ValidateBasic(keyName, statusCode, comment))
return false;
}
if (!RequestData[keyName].is_boolean()) {
statusCode = RequestStatus::InvalidRequestParameterDataType;
@ -100,9 +97,8 @@ const bool Request::ValidateBoolean(const std::string keyName, RequestStatus::Re
const bool Request::ValidateObject(const std::string keyName, RequestStatus::RequestStatus &statusCode, std::string &comment, const bool allowEmpty) const
{
if (!ValidateBasic(keyName, statusCode, comment)) {
if (!ValidateBasic(keyName, statusCode, comment))
return false;
}
if (!RequestData[keyName].is_object()) {
statusCode = RequestStatus::InvalidRequestParameterDataType;
@ -121,9 +117,8 @@ const bool Request::ValidateObject(const std::string keyName, RequestStatus::Req
const bool Request::ValidateArray(const std::string keyName, RequestStatus::RequestStatus &statusCode, std::string &comment, const bool allowEmpty) const
{
if (!ValidateBasic(keyName, statusCode, comment)) {
if (!ValidateBasic(keyName, statusCode, comment))
return false;
}
if (!RequestData[keyName].is_array()) {
statusCode = RequestStatus::InvalidRequestParameterDataType;