[cpp rest-sdk] Constness (#1295)

* Improve method signatures to use const when the value won't change

* Update PetStore

* Change setters for non-primitive types to receive const reference parameters

* Update PetStore
This commit is contained in:
Juan Eugenio Abadie
2018-10-28 04:01:52 -03:00
committed by sunn
parent 107467497c
commit d80f3a6197
42 changed files with 270 additions and 208 deletions

View File

@@ -4,7 +4,7 @@
*
* OpenAPI spec version: 1.0.0
*
* NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 3.3.0-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -87,11 +87,11 @@ web::json::value User::toJson() const
return val;
}
void User::fromJson(web::json::value& val)
void User::fromJson(const web::json::value& val)
{
if(val.has_field(utility::conversions::to_string_t("id")))
{
web::json::value& fieldValue = val[utility::conversions::to_string_t("id")];
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("id"));
if(!fieldValue.is_null())
{
setId(ModelBase::int64_tFromJson(fieldValue));
@@ -99,7 +99,7 @@ void User::fromJson(web::json::value& val)
}
if(val.has_field(utility::conversions::to_string_t("username")))
{
web::json::value& fieldValue = val[utility::conversions::to_string_t("username")];
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("username"));
if(!fieldValue.is_null())
{
setUsername(ModelBase::stringFromJson(fieldValue));
@@ -107,7 +107,7 @@ void User::fromJson(web::json::value& val)
}
if(val.has_field(utility::conversions::to_string_t("firstName")))
{
web::json::value& fieldValue = val[utility::conversions::to_string_t("firstName")];
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("firstName"));
if(!fieldValue.is_null())
{
setFirstName(ModelBase::stringFromJson(fieldValue));
@@ -115,7 +115,7 @@ void User::fromJson(web::json::value& val)
}
if(val.has_field(utility::conversions::to_string_t("lastName")))
{
web::json::value& fieldValue = val[utility::conversions::to_string_t("lastName")];
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("lastName"));
if(!fieldValue.is_null())
{
setLastName(ModelBase::stringFromJson(fieldValue));
@@ -123,7 +123,7 @@ void User::fromJson(web::json::value& val)
}
if(val.has_field(utility::conversions::to_string_t("email")))
{
web::json::value& fieldValue = val[utility::conversions::to_string_t("email")];
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("email"));
if(!fieldValue.is_null())
{
setEmail(ModelBase::stringFromJson(fieldValue));
@@ -131,7 +131,7 @@ void User::fromJson(web::json::value& val)
}
if(val.has_field(utility::conversions::to_string_t("password")))
{
web::json::value& fieldValue = val[utility::conversions::to_string_t("password")];
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("password"));
if(!fieldValue.is_null())
{
setPassword(ModelBase::stringFromJson(fieldValue));
@@ -139,7 +139,7 @@ void User::fromJson(web::json::value& val)
}
if(val.has_field(utility::conversions::to_string_t("phone")))
{
web::json::value& fieldValue = val[utility::conversions::to_string_t("phone")];
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("phone"));
if(!fieldValue.is_null())
{
setPhone(ModelBase::stringFromJson(fieldValue));
@@ -147,7 +147,7 @@ void User::fromJson(web::json::value& val)
}
if(val.has_field(utility::conversions::to_string_t("userStatus")))
{
web::json::value& fieldValue = val[utility::conversions::to_string_t("userStatus")];
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("userStatus"));
if(!fieldValue.is_null())
{
setUserStatus(ModelBase::int32_tFromJson(fieldValue));
@@ -244,12 +244,12 @@ int64_t User::getId() const
return m_Id;
}
void User::setId(int64_t value)
{
m_Id = value;
m_IdIsSet = true;
}
bool User::idIsSet() const
{
return m_IdIsSet;
@@ -265,12 +265,12 @@ utility::string_t User::getUsername() const
return m_Username;
}
void User::setUsername(utility::string_t value)
void User::setUsername(const utility::string_t& value)
{
m_Username = value;
m_UsernameIsSet = true;
}
bool User::usernameIsSet() const
{
return m_UsernameIsSet;
@@ -286,12 +286,12 @@ utility::string_t User::getFirstName() const
return m_FirstName;
}
void User::setFirstName(utility::string_t value)
void User::setFirstName(const utility::string_t& value)
{
m_FirstName = value;
m_FirstNameIsSet = true;
}
bool User::firstNameIsSet() const
{
return m_FirstNameIsSet;
@@ -307,12 +307,12 @@ utility::string_t User::getLastName() const
return m_LastName;
}
void User::setLastName(utility::string_t value)
void User::setLastName(const utility::string_t& value)
{
m_LastName = value;
m_LastNameIsSet = true;
}
bool User::lastNameIsSet() const
{
return m_LastNameIsSet;
@@ -328,12 +328,12 @@ utility::string_t User::getEmail() const
return m_Email;
}
void User::setEmail(utility::string_t value)
void User::setEmail(const utility::string_t& value)
{
m_Email = value;
m_EmailIsSet = true;
}
bool User::emailIsSet() const
{
return m_EmailIsSet;
@@ -349,12 +349,12 @@ utility::string_t User::getPassword() const
return m_Password;
}
void User::setPassword(utility::string_t value)
void User::setPassword(const utility::string_t& value)
{
m_Password = value;
m_PasswordIsSet = true;
}
bool User::passwordIsSet() const
{
return m_PasswordIsSet;
@@ -370,12 +370,12 @@ utility::string_t User::getPhone() const
return m_Phone;
}
void User::setPhone(utility::string_t value)
void User::setPhone(const utility::string_t& value)
{
m_Phone = value;
m_PhoneIsSet = true;
}
bool User::phoneIsSet() const
{
return m_PhoneIsSet;
@@ -391,12 +391,12 @@ int32_t User::getUserStatus() const
return m_UserStatus;
}
void User::setUserStatus(int32_t value)
{
m_UserStatus = value;
m_UserStatusIsSet = true;
}
bool User::userStatusIsSet() const
{
return m_UserStatusIsSet;