mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-20 08:07:10 +00:00
[C++ server] Adjust the names (script, sample folder, generator) to lang option (#250)
* Renamce C++ server scripts * Change output folder * Rename sample folder: pistache-server -> cpp-pistache * Rename sample folder: restbed -> cpp-restbed
This commit is contained in:
committed by
William Cheng
parent
f5f00069bd
commit
2392a09eeb
117
samples/server/petstore/cpp-restbed/model/Pet.cpp
Normal file
117
samples/server/petstore/cpp-restbed/model/Pet.cpp
Normal file
@@ -0,0 +1,117 @@
|
||||
/**
|
||||
* 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 3.0.0-SNAPSHOT.
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "Pet.h"
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/property_tree/json_parser.hpp>
|
||||
|
||||
using boost::property_tree::ptree;
|
||||
using boost::property_tree::read_json;
|
||||
using boost::property_tree::write_json;
|
||||
|
||||
namespace org {
|
||||
namespace openapitools {
|
||||
namespace server {
|
||||
namespace model {
|
||||
|
||||
Pet::Pet()
|
||||
{
|
||||
m_Id = 0L;
|
||||
m_Name = "";
|
||||
m_Status = "";
|
||||
|
||||
}
|
||||
|
||||
Pet::~Pet()
|
||||
{
|
||||
}
|
||||
|
||||
std::string Pet::toJsonString()
|
||||
{
|
||||
std::stringstream ss;
|
||||
ptree pt;
|
||||
pt.put("Id", m_Id);
|
||||
pt.put("Name", m_Name);
|
||||
pt.put("Status", m_Status);
|
||||
write_json(ss, pt, false);
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
void Pet::fromJsonString(std::string const& jsonString)
|
||||
{
|
||||
std::stringstream ss(jsonString);
|
||||
ptree pt;
|
||||
read_json(ss,pt);
|
||||
m_Id = pt.get("Id", 0L);
|
||||
m_Name = pt.get("Name", "");
|
||||
m_Status = pt.get("Status", "");
|
||||
}
|
||||
|
||||
int64_t Pet::getId() const
|
||||
{
|
||||
return m_Id;
|
||||
}
|
||||
void Pet::setId(int64_t value)
|
||||
{
|
||||
m_Id = value;
|
||||
}
|
||||
std::shared_ptr<Category> Pet::getCategory() const
|
||||
{
|
||||
return m_Category;
|
||||
}
|
||||
void Pet::setCategory(std::shared_ptr<Category> value)
|
||||
{
|
||||
m_Category = value;
|
||||
}
|
||||
std::string Pet::getName() const
|
||||
{
|
||||
return m_Name;
|
||||
}
|
||||
void Pet::setName(std::string value)
|
||||
{
|
||||
m_Name = value;
|
||||
}
|
||||
std::vector<std::string> Pet::getPhotoUrls() const
|
||||
{
|
||||
return m_PhotoUrls;
|
||||
}
|
||||
void Pet::setPhotoUrls(std::vector<std::string> value)
|
||||
{
|
||||
m_PhotoUrls = value;
|
||||
}
|
||||
std::vector<std::shared_ptr<Tag>> Pet::getTags() const
|
||||
{
|
||||
return m_Tags;
|
||||
}
|
||||
void Pet::setTags(std::vector<std::shared_ptr<Tag>> value)
|
||||
{
|
||||
m_Tags = value;
|
||||
}
|
||||
std::string Pet::getStatus() const
|
||||
{
|
||||
return m_Status;
|
||||
}
|
||||
void Pet::setStatus(std::string value)
|
||||
{
|
||||
m_Status = value;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user