[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.
*/
@@ -75,11 +75,11 @@ web::json::value Order::toJson() const
return val;
}
void Order::fromJson(web::json::value& val)
void Order::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));
@@ -87,7 +87,7 @@ void Order::fromJson(web::json::value& val)
}
if(val.has_field(utility::conversions::to_string_t("petId")))
{
web::json::value& fieldValue = val[utility::conversions::to_string_t("petId")];
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("petId"));
if(!fieldValue.is_null())
{
setPetId(ModelBase::int64_tFromJson(fieldValue));
@@ -95,7 +95,7 @@ void Order::fromJson(web::json::value& val)
}
if(val.has_field(utility::conversions::to_string_t("quantity")))
{
web::json::value& fieldValue = val[utility::conversions::to_string_t("quantity")];
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("quantity"));
if(!fieldValue.is_null())
{
setQuantity(ModelBase::int32_tFromJson(fieldValue));
@@ -103,7 +103,7 @@ void Order::fromJson(web::json::value& val)
}
if(val.has_field(utility::conversions::to_string_t("shipDate")))
{
web::json::value& fieldValue = val[utility::conversions::to_string_t("shipDate")];
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("shipDate"));
if(!fieldValue.is_null())
{
setShipDate(ModelBase::dateFromJson(fieldValue));
@@ -111,7 +111,7 @@ void Order::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));
@@ -119,7 +119,7 @@ void Order::fromJson(web::json::value& val)
}
if(val.has_field(utility::conversions::to_string_t("complete")))
{
web::json::value& fieldValue = val[utility::conversions::to_string_t("complete")];
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("complete"));
if(!fieldValue.is_null())
{
setComplete(ModelBase::boolFromJson(fieldValue));
@@ -200,12 +200,12 @@ int64_t Order::getId() const
return m_Id;
}
void Order::setId(int64_t value)
{
m_Id = value;
m_IdIsSet = true;
}
bool Order::idIsSet() const
{
return m_IdIsSet;
@@ -221,12 +221,12 @@ int64_t Order::getPetId() const
return m_PetId;
}
void Order::setPetId(int64_t value)
{
m_PetId = value;
m_PetIdIsSet = true;
}
bool Order::petIdIsSet() const
{
return m_PetIdIsSet;
@@ -242,12 +242,12 @@ int32_t Order::getQuantity() const
return m_Quantity;
}
void Order::setQuantity(int32_t value)
{
m_Quantity = value;
m_QuantityIsSet = true;
}
bool Order::quantityIsSet() const
{
return m_QuantityIsSet;
@@ -263,12 +263,12 @@ utility::datetime Order::getShipDate() const
return m_ShipDate;
}
void Order::setShipDate(utility::datetime value)
void Order::setShipDate(const utility::datetime& value)
{
m_ShipDate = value;
m_ShipDateIsSet = true;
}
bool Order::shipDateIsSet() const
{
return m_ShipDateIsSet;
@@ -284,12 +284,12 @@ utility::string_t Order::getStatus() const
return m_Status;
}
void Order::setStatus(utility::string_t value)
void Order::setStatus(const utility::string_t& value)
{
m_Status = value;
m_StatusIsSet = true;
}
bool Order::statusIsSet() const
{
return m_StatusIsSet;
@@ -305,12 +305,12 @@ bool Order::isComplete() const
return m_Complete;
}
void Order::setComplete(bool value)
{
m_Complete = value;
m_CompleteIsSet = true;
}
bool Order::completeIsSet() const
{
return m_CompleteIsSet;