SalDiAngelus 89eb603c17 [C++][Pistache] Fixed #2643 (#2653)
* Fixed #2643

Refactored to/from json functions to use universal object serialization method.

* Code review found incorrect indenting and I forgot to remove unused mustache files.

* Removed helpers class because it is not needed anymore.

* Removed helpers package from docs.

* Reverted helper class removal.
2019-04-19 14:00:12 +02:00

165 lines
2.8 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 "Pet.h"
namespace org {
namespace openapitools {
namespace server {
namespace model {
Pet::Pet()
{
m_Id = 0L;
m_IdIsSet = false;
m_CategoryIsSet = false;
m_Name = "";
m_TagsIsSet = false;
m_Status = "";
m_StatusIsSet = false;
}
Pet::~Pet()
{
}
void Pet::validate()
{
// TODO: implement validation
}
void to_json(nlohmann::json& j, const Pet& o)
{
j = nlohmann::json();
if(o.idIsSet())
j["id"] = o.m_Id;
if(o.categoryIsSet())
j["category"] = o.m_Category;
j["name"] = o.m_Name;
j["photoUrls"] = o.m_PhotoUrls;
if(o.tagsIsSet())
j["tags"] = o.m_Tags;
if(o.statusIsSet())
j["status"] = o.m_Status;
}
void from_json(const nlohmann::json& j, Pet& o)
{
if(!j.at("id").is_null())
{
j.at("id").get_to(o.m_Id);
o.m_IdIsSet = true;
}
if(!j.at("category").is_null())
{
j.at("category").get_to(o.m_Category);
o.m_CategoryIsSet = true;
}
j.at("name").get_to(o.m_Name);
j.at("photoUrls").get_to(o.m_PhotoUrls);
if(!j.at("tags").is_null())
{
j.at("tags").get_to(o.m_Tags);
o.m_TagsIsSet = true;
}
if(!j.at("status").is_null())
{
j.at("status").get_to(o.m_Status);
o.m_StatusIsSet = true;
}
}
int64_t Pet::getId() const
{
return m_Id;
}
void Pet::setId(int64_t const value)
{
m_Id = value;
m_IdIsSet = true;
}
bool Pet::idIsSet() const
{
return m_IdIsSet;
}
void Pet::unsetId()
{
m_IdIsSet = false;
}
Category Pet::getCategory() const
{
return m_Category;
}
void Pet::setCategory(Category const& value)
{
m_Category = value;
m_CategoryIsSet = true;
}
bool Pet::categoryIsSet() const
{
return m_CategoryIsSet;
}
void Pet::unsetCategory()
{
m_CategoryIsSet = false;
}
std::string Pet::getName() const
{
return m_Name;
}
void Pet::setName(std::string const& value)
{
m_Name = value;
}
std::vector<std::string>& Pet::getPhotoUrls()
{
return m_PhotoUrls;
}
std::vector<Tag>& Pet::getTags()
{
return m_Tags;
}
bool Pet::tagsIsSet() const
{
return m_TagsIsSet;
}
void Pet::unsetTags()
{
m_TagsIsSet = false;
}
std::string Pet::getStatus() const
{
return m_Status;
}
void Pet::setStatus(std::string const& value)
{
m_Status = value;
m_StatusIsSet = true;
}
bool Pet::statusIsSet() const
{
return m_StatusIsSet;
}
void Pet::unsetStatus()
{
m_StatusIsSet = false;
}
}
}
}
}