openapi-generator/samples/server/petstore/cpp-pistache/model/Order.cpp
stkrwork 23ab5177b3 [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
2018-06-22 09:12:35 +08:00

220 lines
3.6 KiB
C++

/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "Order.h"
namespace org {
namespace openapitools {
namespace server {
namespace model {
Order::Order()
{
m_Id = 0L;
m_IdIsSet = false;
m_PetId = 0L;
m_PetIdIsSet = false;
m_Quantity = 0;
m_QuantityIsSet = false;
m_ShipDate = "";
m_ShipDateIsSet = false;
m_Status = "";
m_StatusIsSet = false;
m_Complete = false;
m_CompleteIsSet = false;
}
Order::~Order()
{
}
void Order::validate()
{
// TODO: implement validation
}
nlohmann::json Order::toJson() const
{
nlohmann::json val = nlohmann::json::object();
if(m_IdIsSet)
{
val["id"] = m_Id;
}
if(m_PetIdIsSet)
{
val["petId"] = m_PetId;
}
if(m_QuantityIsSet)
{
val["quantity"] = m_Quantity;
}
if(m_ShipDateIsSet)
{
val["shipDate"] = ModelBase::toJson(m_ShipDate);
}
if(m_StatusIsSet)
{
val["status"] = ModelBase::toJson(m_Status);
}
if(m_CompleteIsSet)
{
val["complete"] = m_Complete;
}
return val;
}
void Order::fromJson(nlohmann::json& val)
{
if(val.find("id") != val.end())
{
setId(val.at("id"));
}
if(val.find("petId") != val.end())
{
setPetId(val.at("petId"));
}
if(val.find("quantity") != val.end())
{
setQuantity(val.at("quantity"));
}
if(val.find("shipDate") != val.end())
{
setShipDate(val.at("shipDate"));
}
if(val.find("status") != val.end())
{
setStatus(val.at("status"));
}
if(val.find("complete") != val.end())
{
setComplete(val.at("complete"));
}
}
int64_t Order::getId() const
{
return m_Id;
}
void Order::setId(int64_t const value)
{
m_Id = value;
m_IdIsSet = true;
}
bool Order::idIsSet() const
{
return m_IdIsSet;
}
void Order::unsetId()
{
m_IdIsSet = false;
}
int64_t Order::getPetId() const
{
return m_PetId;
}
void Order::setPetId(int64_t const value)
{
m_PetId = value;
m_PetIdIsSet = true;
}
bool Order::petIdIsSet() const
{
return m_PetIdIsSet;
}
void Order::unsetPetId()
{
m_PetIdIsSet = false;
}
int32_t Order::getQuantity() const
{
return m_Quantity;
}
void Order::setQuantity(int32_t const value)
{
m_Quantity = value;
m_QuantityIsSet = true;
}
bool Order::quantityIsSet() const
{
return m_QuantityIsSet;
}
void Order::unsetQuantity()
{
m_QuantityIsSet = false;
}
std::string Order::getShipDate() const
{
return m_ShipDate;
}
void Order::setShipDate(std::string const& value)
{
m_ShipDate = value;
m_ShipDateIsSet = true;
}
bool Order::shipDateIsSet() const
{
return m_ShipDateIsSet;
}
void Order::unsetShipDate()
{
m_ShipDateIsSet = false;
}
std::string Order::getStatus() const
{
return m_Status;
}
void Order::setStatus(std::string const& value)
{
m_Status = value;
m_StatusIsSet = true;
}
bool Order::statusIsSet() const
{
return m_StatusIsSet;
}
void Order::unsetStatus()
{
m_StatusIsSet = false;
}
bool Order::isComplete() const
{
return m_Complete;
}
void Order::setComplete(bool const value)
{
m_Complete = value;
m_CompleteIsSet = true;
}
bool Order::completeIsSet() const
{
return m_CompleteIsSet;
}
void Order::unsetComplete()
{
m_CompleteIsSet = false;
}
}
}
}
}