mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-19 21:57:08 +00:00
[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.
|
||||
*/
|
||||
@@ -57,25 +57,25 @@ web::json::value ModelBase::toJson( std::shared_ptr<HttpContent> content )
|
||||
return value;
|
||||
}
|
||||
|
||||
std::shared_ptr<HttpContent> ModelBase::fileFromJson(web::json::value& val)
|
||||
std::shared_ptr<HttpContent> ModelBase::fileFromJson(const web::json::value& val)
|
||||
{
|
||||
std::shared_ptr<HttpContent> content(new HttpContent);
|
||||
|
||||
if(val.has_field(utility::conversions::to_string_t("ContentDisposition")))
|
||||
{
|
||||
content->setContentDisposition( ModelBase::stringFromJson(val[utility::conversions::to_string_t("ContentDisposition")]) );
|
||||
content->setContentDisposition( ModelBase::stringFromJson(val.at(utility::conversions::to_string_t("ContentDisposition"))) );
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("ContentType")))
|
||||
{
|
||||
content->setContentType( ModelBase::stringFromJson(val[utility::conversions::to_string_t("ContentType")]) );
|
||||
content->setContentType( ModelBase::stringFromJson(val.at(utility::conversions::to_string_t("ContentType"))) );
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("FileName")))
|
||||
{
|
||||
content->setFileName( ModelBase::stringFromJson(val[utility::conversions::to_string_t("FileName")]) );
|
||||
content->setFileName( ModelBase::stringFromJson(val.at(utility::conversions::to_string_t("FileName"))) );
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("InputStream")))
|
||||
{
|
||||
content->setData( ModelBase::fromBase64( ModelBase::stringFromJson(val[utility::conversions::to_string_t("InputStream")]) ) );
|
||||
content->setData( ModelBase::fromBase64( ModelBase::stringFromJson(val.at(utility::conversions::to_string_t("InputStream")))) );
|
||||
}
|
||||
|
||||
return content;
|
||||
@@ -274,32 +274,32 @@ std::shared_ptr<std::istream> ModelBase::fromBase64( const utility::string_t& en
|
||||
return result;
|
||||
}
|
||||
|
||||
int64_t ModelBase::int64_tFromJson(web::json::value& val)
|
||||
int64_t ModelBase::int64_tFromJson(const web::json::value& val)
|
||||
{
|
||||
return val.as_number().to_int64();
|
||||
}
|
||||
int32_t ModelBase::int32_tFromJson(web::json::value& val)
|
||||
int32_t ModelBase::int32_tFromJson(const web::json::value& val)
|
||||
{
|
||||
return val.as_integer();
|
||||
}
|
||||
float ModelBase::floatFromJson(web::json::value& val)
|
||||
float ModelBase::floatFromJson(const web::json::value& val)
|
||||
{
|
||||
return static_cast<float>(val.as_double());
|
||||
}
|
||||
utility::string_t ModelBase::stringFromJson(web::json::value& val)
|
||||
utility::string_t ModelBase::stringFromJson(const web::json::value& val)
|
||||
{
|
||||
return val.is_string() ? val.as_string() : utility::conversions::to_string_t("");
|
||||
}
|
||||
|
||||
utility::datetime ModelBase::dateFromJson(web::json::value& val)
|
||||
utility::datetime ModelBase::dateFromJson(const web::json::value& val)
|
||||
{
|
||||
return utility::datetime::from_string(val.as_string(), utility::datetime::ISO_8601);
|
||||
}
|
||||
bool ModelBase::boolFromJson(web::json::value& val)
|
||||
bool ModelBase::boolFromJson(const web::json::value& val)
|
||||
{
|
||||
return val.as_bool();
|
||||
}
|
||||
double ModelBase::doubleFromJson(web::json::value& val)
|
||||
double ModelBase::doubleFromJson(const web::json::value& val)
|
||||
{
|
||||
return val.as_double();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user