forked from loafle/openapi-generator-original
[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:
committed by
sunn
parent
107467497c
commit
d80f3a6197
@@ -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.
|
||||
*/
|
||||
@@ -78,11 +78,11 @@ web::json::value Pet::toJson() const
|
||||
return val;
|
||||
}
|
||||
|
||||
void Pet::fromJson(web::json::value& val)
|
||||
void Pet::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));
|
||||
@@ -90,7 +90,7 @@ void Pet::fromJson(web::json::value& val)
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("category")))
|
||||
{
|
||||
web::json::value& fieldValue = val[utility::conversions::to_string_t("category")];
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("category"));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
std::shared_ptr<Category> newItem(new Category());
|
||||
@@ -98,11 +98,11 @@ void Pet::fromJson(web::json::value& val)
|
||||
setCategory( newItem );
|
||||
}
|
||||
}
|
||||
setName(ModelBase::stringFromJson(val[utility::conversions::to_string_t("name")]));
|
||||
setName(ModelBase::stringFromJson(val.at(utility::conversions::to_string_t("name"))));
|
||||
{
|
||||
m_PhotoUrls.clear();
|
||||
std::vector<web::json::value> jsonArray;
|
||||
for( auto& item : val[utility::conversions::to_string_t("photoUrls")].as_array() )
|
||||
for( auto& item : val.at(utility::conversions::to_string_t("photoUrls")).as_array() )
|
||||
{
|
||||
m_PhotoUrls.push_back(ModelBase::stringFromJson(item));
|
||||
}
|
||||
@@ -112,7 +112,7 @@ void Pet::fromJson(web::json::value& val)
|
||||
std::vector<web::json::value> jsonArray;
|
||||
if(val.has_field(utility::conversions::to_string_t("tags")))
|
||||
{
|
||||
for( auto& item : val[utility::conversions::to_string_t("tags")].as_array() )
|
||||
for( auto& item : val.at(utility::conversions::to_string_t("tags")).as_array() )
|
||||
{
|
||||
if(item.is_null())
|
||||
{
|
||||
@@ -129,7 +129,7 @@ void Pet::fromJson(web::json::value& val)
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("status")))
|
||||
{
|
||||
web::json::value& fieldValue = val[utility::conversions::to_string_t("status")];
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("status"));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
setStatus(ModelBase::stringFromJson(fieldValue));
|
||||
@@ -246,12 +246,12 @@ int64_t Pet::getId() const
|
||||
return m_Id;
|
||||
}
|
||||
|
||||
|
||||
void Pet::setId(int64_t value)
|
||||
{
|
||||
m_Id = value;
|
||||
m_IdIsSet = true;
|
||||
}
|
||||
|
||||
bool Pet::idIsSet() const
|
||||
{
|
||||
return m_IdIsSet;
|
||||
@@ -267,12 +267,12 @@ std::shared_ptr<Category> Pet::getCategory() const
|
||||
return m_Category;
|
||||
}
|
||||
|
||||
|
||||
void Pet::setCategory(std::shared_ptr<Category> value)
|
||||
void Pet::setCategory(const std::shared_ptr<Category>& value)
|
||||
{
|
||||
m_Category = value;
|
||||
m_CategoryIsSet = true;
|
||||
}
|
||||
|
||||
bool Pet::categoryIsSet() const
|
||||
{
|
||||
return m_CategoryIsSet;
|
||||
@@ -288,32 +288,34 @@ utility::string_t Pet::getName() const
|
||||
return m_Name;
|
||||
}
|
||||
|
||||
|
||||
void Pet::setName(utility::string_t value)
|
||||
void Pet::setName(const utility::string_t& value)
|
||||
{
|
||||
m_Name = value;
|
||||
|
||||
}
|
||||
|
||||
std::vector<utility::string_t>& Pet::getPhotoUrls()
|
||||
{
|
||||
return m_PhotoUrls;
|
||||
}
|
||||
|
||||
void Pet::setPhotoUrls(std::vector<utility::string_t> value)
|
||||
void Pet::setPhotoUrls(const std::vector<utility::string_t>& value)
|
||||
{
|
||||
m_PhotoUrls = value;
|
||||
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<Tag>>& Pet::getTags()
|
||||
{
|
||||
return m_Tags;
|
||||
}
|
||||
|
||||
void Pet::setTags(std::vector<std::shared_ptr<Tag>> value)
|
||||
void Pet::setTags(const std::vector<std::shared_ptr<Tag>>& value)
|
||||
{
|
||||
m_Tags = value;
|
||||
m_TagsIsSet = true;
|
||||
}
|
||||
|
||||
bool Pet::tagsIsSet() const
|
||||
{
|
||||
return m_TagsIsSet;
|
||||
@@ -329,12 +331,12 @@ utility::string_t Pet::getStatus() const
|
||||
return m_Status;
|
||||
}
|
||||
|
||||
|
||||
void Pet::setStatus(utility::string_t value)
|
||||
void Pet::setStatus(const utility::string_t& value)
|
||||
{
|
||||
m_Status = value;
|
||||
m_StatusIsSet = true;
|
||||
}
|
||||
|
||||
bool Pet::statusIsSet() const
|
||||
{
|
||||
return m_StatusIsSet;
|
||||
|
||||
Reference in New Issue
Block a user