mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-20 15:37:10 +00:00
[C++][Pistache] Fix optional error and wrong function signatures (#264)
* Added missing includes for optional * Removed shared pointer from pistache generator * Changed Net namespace to Pistache Namespace * Clean up code and removed unnecessary lines in mustache files * Removed remaining shared pointer syntax * Code review fixes + updated samples * Added const to all model setter functions, and reference to all params in setters that are not primitives * Refactored modelbase * Removed const * Updated samples
This commit is contained in:
@@ -23,41 +23,41 @@ ModelBase::~ModelBase()
|
||||
{
|
||||
}
|
||||
|
||||
std::string ModelBase::toJson( const std::string& value )
|
||||
std::string ModelBase::toJson( std::string const& value )
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
std::string ModelBase::toJson( const std::time_t& value )
|
||||
std::string ModelBase::toJson( std::time_t const& value )
|
||||
{
|
||||
char buf[sizeof "2011-10-08T07:07:09Z"];
|
||||
strftime(buf, sizeof buf, "%FT%TZ", gmtime(&value));
|
||||
return buf;
|
||||
}
|
||||
|
||||
int32_t ModelBase::toJson( int32_t value )
|
||||
int32_t ModelBase::toJson( int32_t const value )
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
int64_t ModelBase::toJson( int64_t value )
|
||||
int64_t ModelBase::toJson( int64_t const value )
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
double ModelBase::toJson( double value )
|
||||
double ModelBase::toJson( double const value )
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
bool ModelBase::toJson( bool value )
|
||||
bool ModelBase::toJson( bool const value )
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
nlohmann::json ModelBase::toJson( std::shared_ptr<ModelBase> content )
|
||||
nlohmann::json ModelBase::toJson(ModelBase content )
|
||||
{
|
||||
return content.get() ? content->toJson() : nlohmann::json();
|
||||
return content.toJson();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user