[cpp-restbed] Added "out-of-the-box" functionality (#4759)

* Added cpp-restbed "out-of-the-box" functionality
* handling class dependencies
* added method override to clean interfaces of ambiguity
* added default values for shared pointers
* fixed _name and name parameters generating the same getters and setters
* updated enum handling
* updated Petstore samples
* updated templates for automated object generation

* fix whitespace

* removed model initialisation

* added model brace initialisation
This commit is contained in:
AlexG
2020-01-02 13:36:22 +01:00
committed by William Cheng
parent 5cc5fbe76a
commit 1cb99e3497
24 changed files with 582 additions and 189 deletions

View File

@@ -26,6 +26,7 @@ import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.*;
import java.util.Map.Entry;
import static org.openapitools.codegen.utils.StringUtils.*;
@@ -100,6 +101,52 @@ public class CppRestbedServerCodegen extends AbstractCppCodegen {
importMapping.put("restbed::Bytes", "#include <corvusoft/restbed/byte.hpp>");
}
@Override
public Map<String, Object> updateAllModels(Map<String, Object> objs) {
// Index all CodegenModels by model name.
Map<String, CodegenModel> allModels = getAllModels(objs);
// Clean interfaces of ambiguity
for (Entry<String, CodegenModel> cm : allModels.entrySet()) {
if (cm.getValue().getInterfaces() != null && !cm.getValue().getInterfaces().isEmpty()) {
List<String> newIntf = new ArrayList<String>(cm.getValue().getInterfaces());
for (String intf : allModels.get(cm.getKey()).getInterfaces()) {
if (allModels.get(intf).getInterfaces() != null && !allModels.get(intf).getInterfaces().isEmpty()) {
for (String intfInner : allModels.get(intf).getInterfaces()) {
newIntf.remove(intfInner);
}
}
}
cm.getValue().setInterfaces(newIntf);
}
}
objs = super.updateAllModels(objs);
return objs;
}
/**
* Camelize the method name of the getter and setter, but keep underscores at the front
*
* @param name string to be camelized
* @return Camelized string
*/
@Override
public String getterAndSetterCapitalize(String name) {
if (name == null || name.length() == 0) {
return name;
}
name = toVarName(name);
if (name.startsWith("_")) {
return "_" + camelize(name);
}
return camelize(name);
}
/**
* Configures the type of generator.
*
@@ -187,11 +234,13 @@ public class CppRestbedServerCodegen extends AbstractCppCodegen {
codegenModel.imports.add(newImp);
}
}
// Import vector if an enum is present
if (codegenModel.hasEnums) {
codegenModel.imports.add("#include <vector>");
}
return codegenModel;
}
@Override
public String toModelFilename(String name) {
return toModelName(name);
@@ -355,7 +404,7 @@ public class CppRestbedServerCodegen extends AbstractCppCodegen {
}
return "std::vector<" + inner + ">()";
} else if (!StringUtils.isEmpty(p.get$ref())) {
return "new " + toModelName(ModelUtils.getSimpleRef(p.get$ref())) + "()";
return "std::make_shared<" + toModelName(ModelUtils.getSimpleRef(p.get$ref())) + ">()";
}
return "nullptr";
@@ -371,6 +420,7 @@ public class CppRestbedServerCodegen extends AbstractCppCodegen {
if (!isPrimitiveType && !isListContainer && !isString && !parameter.dataType.startsWith("std::shared_ptr")) {
parameter.dataType = "std::shared_ptr<" + parameter.dataType + ">";
parameter.defaultValue = "std::make_shared<" + parameter.dataType + ">()";
}
}
@@ -393,4 +443,12 @@ public class CppRestbedServerCodegen extends AbstractCppCodegen {
type = openAPIType;
return toModelName(type);
}
@Override
public void updateCodegenPropertyEnum(CodegenProperty var) {
// Remove prefix added by DefaultCodegen
String originalDefaultValue = var.defaultValue;
super.updateCodegenPropertyEnum(var);
var.defaultValue = originalDefaultValue;
}
}

View File

@@ -76,6 +76,10 @@ private:
{{#allParams}}{{{dataType}}} const &{{#hasMore}}, {{/hasMore}}{{/allParams}}
)> handler_{{httpMethod}}_;
{{/vendorExtensions.x-codegen-otherMethods}}
{{#allParams}}
{{{dataType}}} {{paramName}}{};
{{/allParams}}
};
{{/operation}}

View File

@@ -18,7 +18,7 @@ using namespace {{modelNamespace}};
{{#operation}}
std::shared_ptr<{{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource> sp{{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource = std::make_shared<{{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource>();
this->publish(sp{{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource);
{{/operation}}
}

View File

@@ -13,6 +13,7 @@
{{#imports}}{{{this}}}
{{/imports}}
#include <memory>
#include <boost/property_tree/ptree.hpp>
{{#modelNamespaceDeclarations}}
namespace {{this}} {
@@ -21,30 +22,39 @@ namespace {{this}} {
/// <summary>
/// {{description}}
/// </summary>
class {{declspec}} {{classname}}
{{#circularReferences}}
class {{{this}}};
{{/circularReferences}}
class {{declspec}} {{classname}} {{#interfaces}}{{#-first}}:{{/-first}}{{^-first}},{{/-first}} public {{{this}}}{{/interfaces}}
{
public:
{{classname}}();
virtual ~{{classname}}();
std::string toJsonString();
std::string toJsonString(bool prettyJson = false);
void fromJsonString(std::string const& jsonString);
boost::property_tree::ptree toPropertyTree();
void fromPropertyTree(boost::property_tree::ptree const& pt);
/////////////////////////////////////////////
/// {{classname}} members
{{#vars}}
/// <summary>
/// {{description}}
/// </summary>
{{{dataType}}} {{getter}}() const;
void {{setter}}({{{dataType}}} value);
{{/vars}}
protected:
{{#vars}}
{{{dataType}}} m_{{name}};
{{/vars}}
{{#vars}}
{{#isEnum}}
std::vector<{{{dataType}}}> m_{{enumName}};
{{/isEnum}}
{{/vars}}
};
{{#modelNamespaceDeclarations}}

View File

@@ -5,6 +5,9 @@
#include <string>
#include <sstream>
{{#hasEnums}}
#include <algorithm>
{{/hasEnums}}
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
@@ -18,36 +21,37 @@ namespace {{this}} {
{{classname}}::{{classname}}()
{
{{#vars}}{{^isContainer}}{{#isPrimitiveType}}m_{{name}} = {{{defaultValue}}};
{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isString}}m_{{name}} = {{{defaultValue}}};
{{/isString}}{{#isDateTime}}m_{{name}} = {{{defaultValue}}};
{{/isDateTime}}{{/isPrimitiveType}}{{/isContainer}}{{/vars}}
{{#vars}}
{{^isContainer}}
{{#isPrimitiveType}}
m_{{name}} = {{{defaultValue}}};
{{/isPrimitiveType}}
{{^isPrimitiveType}}
{{#isString}}
m_{{name}} = {{{defaultValue}}};
{{/isString}}
{{#isDate}}
m_{{name}} = {{{defaultValue}}};
{{/isDate}}
{{#isDateTime}}
m_{{name}} = {{{defaultValue}}};
{{/isDateTime}}
{{#isEnum}}
m_{{enumName}} = { {{#allowableValues}}{{#enumVars}}{{^-first}}, {{/-first}}{{{value}}}{{/enumVars}}{{/allowableValues}} };
{{/isEnum}}
{{/isPrimitiveType}}
{{/isContainer}}
{{/vars}}
}
{{classname}}::~{{classname}}()
{
}
std::string {{classname}}::toJsonString()
std::string {{classname}}::toJsonString(bool prettyJson)
{
std::stringstream ss;
ptree pt;
{{#vars}}
{{^isContainer}}
{{#isPrimitiveType}}
pt.put("{{baseName}}", m_{{name}});
{{/isPrimitiveType}}
{{^isPrimitiveType}}
{{#isString}}
pt.put("{{baseName}}", m_{{name}});
{{/isString}}
{{#isDateTime}}
pt.put("{{baseName}}", m_{{name}});
{{/isDateTime}}
{{/isPrimitiveType}}
{{/isContainer}}
{{/vars}}
write_json(ss, pt, false);
write_json(ss, this->toPropertyTree(), prettyJson);
return ss.str();
}
@@ -56,19 +60,116 @@ void {{classname}}::fromJsonString(std::string const& jsonString)
std::stringstream ss(jsonString);
ptree pt;
read_json(ss,pt);
this->fromPropertyTree(pt);
}
ptree {{classname}}::toPropertyTree()
{
ptree pt;
ptree tmp_node;
{{#vars}}
{{^isContainer}}
{{#isPrimitiveType}}
pt.put("{{baseName}}", m_{{name}});
{{/isPrimitiveType}}
{{^isPrimitiveType}}
{{#isString}}
pt.put("{{baseName}}", m_{{name}});
{{/isString}}
{{#isDate}}
pt.put("{{baseName}}", m_{{name}});
{{/isDate}}
{{#isDateTime}}
pt.put("{{baseName}}", m_{{name}});
{{/isDateTime}}
{{#isModel}}
if (m_{{name}} != nullptr) {
pt.add_child("{{baseName}}", m_{{name}}->toPropertyTree());
}
{{/isModel}}
{{/isPrimitiveType}}
{{/isContainer}}
{{#isContainer}}
{{^isModelContainer}}
// generate tree for {{name}}
if (!m_{{name}}.empty()) {
for (const auto &childEntry : m_{{name}}) {
ptree {{name}}_node;
{{name}}_node.put("", childEntry);
tmp_node.push_back(std::make_pair("", {{name}}_node));
}
pt.add_child("{{baseName}}", tmp_node);
tmp_node.clear();
}
{{/isModelContainer}}
{{#isModelContainer}}
// generate tree for vector of pointers of {{name}}
if (!m_{{name}}.empty()) {
for (const auto &childEntry : m_{{name}}) {
tmp_node.push_back(std::make_pair("", childEntry->toPropertyTree()));
}
pt.add_child("{{baseName}}", tmp_node);
tmp_node.clear();
}
{{/isModelContainer}}
{{/isContainer}}
{{/vars}}
return pt;
}
void {{classname}}::fromPropertyTree(ptree const &pt)
{
ptree tmp_node;
{{#vars}}
{{^isContainer}}
{{^isEnum}}
{{#isPrimitiveType}}
m_{{name}} = pt.get("{{baseName}}", {{{defaultValue}}});
{{/isPrimitiveType}}
{{^isPrimitiveType}}
{{#isString}}
m_{{name}} = pt.get("{{baseName}}", {{{defaultValue}}});
{{/isString}}
{{#isDate}}
m_{{name}} = pt.get("{{baseName}}", {{{defaultValue}}});
{{/isDate}}
{{#isDateTime}}
m_{{name}} = pt.get("{{baseName}}", {{{defaultValue}}});
{{/isDateTime}}
{{/isPrimitiveType}}
{{/isEnum}}
{{#isEnum}}
{{setter}}(pt.get("{{baseName}}", {{{defaultValue}}}));
{{/isEnum}}
{{#isModel}}
if (pt.get_child_optional("{{baseName}}")) {
m_{{name}} = {{{defaultValue}}};
m_{{name}}->fromPropertyTree(pt.get_child("{{baseName}}"));
}
{{/isModel}}
{{/isContainer}}
{{#isContainer}}
{{^isModelContainer}}
// push all items of {{name}} into member vector
if (pt.get_child_optional("{{baseName}}")) {
for (const auto &childTree : pt.get_child("{{baseName}}")) {
{{#mostInnerItems}}
m_{{name}}.emplace_back({{#isNumeric}}{{^isFloat}}{{^isLong}}{{^isInteger}}std::stod{{/isInteger}}{{/isLong}}{{/isFloat}}{{#isDouble}}std::stod{{/isDouble}}{{#isFloat}}std::stof{{/isFloat}}{{#isInteger}}std::stoi{{/isInteger}}{{#isLong}}std::stol{{/isLong}}({{/isNumeric}}childTree.second.data()){{#isNumeric}}){{/isNumeric}};
{{/mostInnerItems}}
}
}
{{/isModelContainer}}
{{#isModelContainer}}
// generate new {{complexType}} Object for each item and assign it to the current
if (pt.get_child_optional("{{baseName}}")) {
for (const auto &childTree : pt.get_child("{{baseName}}")) {
{{#mostInnerItems}}
m_{{name}}.emplace_back({{{defaultValue}}});
m_{{name}}.back()->fromPropertyTree(childTree.second);
{{/mostInnerItems}}
}
}
{{/isModelContainer}}
{{/isContainer}}
{{/vars}}
}
@@ -80,7 +181,9 @@ void {{classname}}::fromJsonString(std::string const& jsonString)
}
void {{classname}}::{{setter}}({{{dataType}}} value)
{
m_{{name}} = value;
{{#isEnum}}if (std::find(m_{{enumName}}.begin(), m_{{enumName}}.end(), value) != m_{{enumName}}.end()) {
{{/isEnum}}m_{{name}} = value;{{#isEnum}}
}{{/isEnum}}
}
{{/vars}}

View File

@@ -1 +1 @@
4.2.0-SNAPSHOT
unset

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -28,19 +28,19 @@ using namespace org::openapitools::server::model;
PetApi::PetApi() {
std::shared_ptr<PetApiPetResource> spPetApiPetResource = std::make_shared<PetApiPetResource>();
this->publish(spPetApiPetResource);
std::shared_ptr<PetApiPetPetIdResource> spPetApiPetPetIdResource = std::make_shared<PetApiPetPetIdResource>();
this->publish(spPetApiPetPetIdResource);
std::shared_ptr<PetApiPetFindByStatusResource> spPetApiPetFindByStatusResource = std::make_shared<PetApiPetFindByStatusResource>();
this->publish(spPetApiPetFindByStatusResource);
std::shared_ptr<PetApiPetFindByTagsResource> spPetApiPetFindByTagsResource = std::make_shared<PetApiPetFindByTagsResource>();
this->publish(spPetApiPetFindByTagsResource);
std::shared_ptr<PetApiPetPetIdUploadImageResource> spPetApiPetPetIdUploadImageResource = std::make_shared<PetApiPetPetIdUploadImageResource>();
this->publish(spPetApiPetPetIdUploadImageResource);
}
PetApi::~PetApi() {}
@@ -66,6 +66,9 @@ PetApiPetResource::PetApiPetResource()
this->set_method_handler("PUT",
std::bind(&PetApiPetResource::PUT_method_handler, this,
std::placeholders::_1));
body = std::make_shared<Pet>();
}
PetApiPetResource::~PetApiPetResource()
@@ -178,6 +181,10 @@ PetApiPetPetIdResource::PetApiPetPetIdResource()
this->set_method_handler("POST",
std::bind(&PetApiPetPetIdResource::POST_method_handler, this,
std::placeholders::_1));
petId = 0L;
apiKey = "";
}
PetApiPetPetIdResource::~PetApiPetPetIdResource()
@@ -302,6 +309,8 @@ PetApiPetFindByStatusResource::PetApiPetFindByStatusResource()
this->set_method_handler("GET",
std::bind(&PetApiPetFindByStatusResource::GET_method_handler, this,
std::placeholders::_1));
}
PetApiPetFindByStatusResource::~PetApiPetFindByStatusResource()
@@ -354,6 +363,8 @@ PetApiPetFindByTagsResource::PetApiPetFindByTagsResource()
this->set_method_handler("GET",
std::bind(&PetApiPetFindByTagsResource::GET_method_handler, this,
std::placeholders::_1));
}
PetApiPetFindByTagsResource::~PetApiPetFindByTagsResource()
@@ -406,6 +417,11 @@ PetApiPetPetIdUploadImageResource::PetApiPetPetIdUploadImageResource()
this->set_method_handler("POST",
std::bind(&PetApiPetPetIdUploadImageResource::POST_method_handler, this,
std::placeholders::_1));
petId = 0L;
additionalMetadata = "";
file = "";
}
PetApiPetPetIdUploadImageResource::~PetApiPetPetIdUploadImageResource()

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -82,6 +82,8 @@ private:
std::function<std::pair<int, std::string>(
std::shared_ptr<Pet> const &
)> handler_PUT_;
std::shared_ptr<Pet> body;
};
/// <summary>
@@ -127,6 +129,9 @@ private:
std::function<std::pair<int, std::string>(
int64_t const &, std::string const &, std::string const &
)> handler_POST_;
int64_t petId;
std::string apiKey;
};
/// <summary>
@@ -154,6 +159,8 @@ private:
std::vector<std::string> const &
)> handler_GET_;
std::vector<std::string> status;
};
/// <summary>
@@ -181,6 +188,8 @@ private:
std::vector<std::string> const &
)> handler_GET_;
std::vector<std::string> tags;
};
/// <summary>
@@ -208,6 +217,10 @@ private:
int64_t const &, std::string const &, std::string const &
)> handler_POST_;
int64_t petId;
std::string additionalMetadata;
std::string file;
};

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -28,13 +28,13 @@ using namespace org::openapitools::server::model;
StoreApi::StoreApi() {
std::shared_ptr<StoreApiStoreOrderOrderIdResource> spStoreApiStoreOrderOrderIdResource = std::make_shared<StoreApiStoreOrderOrderIdResource>();
this->publish(spStoreApiStoreOrderOrderIdResource);
std::shared_ptr<StoreApiStoreInventoryResource> spStoreApiStoreInventoryResource = std::make_shared<StoreApiStoreInventoryResource>();
this->publish(spStoreApiStoreInventoryResource);
std::shared_ptr<StoreApiStoreOrderResource> spStoreApiStoreOrderResource = std::make_shared<StoreApiStoreOrderResource>();
this->publish(spStoreApiStoreOrderResource);
}
StoreApi::~StoreApi() {}
@@ -60,6 +60,9 @@ StoreApiStoreOrderOrderIdResource::StoreApiStoreOrderOrderIdResource()
this->set_method_handler("GET",
std::bind(&StoreApiStoreOrderOrderIdResource::GET_method_handler, this,
std::placeholders::_1));
orderId = "";
}
StoreApiStoreOrderOrderIdResource::~StoreApiStoreOrderOrderIdResource()
@@ -154,6 +157,8 @@ StoreApiStoreInventoryResource::StoreApiStoreInventoryResource()
this->set_method_handler("GET",
std::bind(&StoreApiStoreInventoryResource::GET_method_handler, this,
std::placeholders::_1));
}
StoreApiStoreInventoryResource::~StoreApiStoreInventoryResource()
@@ -201,6 +206,9 @@ StoreApiStoreOrderResource::StoreApiStoreOrderResource()
this->set_method_handler("POST",
std::bind(&StoreApiStoreOrderResource::POST_method_handler, this,
std::placeholders::_1));
body = std::make_shared<Order>();
}
StoreApiStoreOrderResource::~StoreApiStoreOrderResource()

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -82,6 +82,8 @@ private:
std::function<std::pair<int, std::string>(
int64_t const &
)> handler_GET_;
std::string orderId;
};
/// <summary>
@@ -109,6 +111,7 @@ private:
)> handler_GET_;
};
/// <summary>
@@ -136,6 +139,8 @@ private:
std::shared_ptr<Order> const &
)> handler_POST_;
std::shared_ptr<Order> body;
};

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -28,22 +28,22 @@ using namespace org::openapitools::server::model;
UserApi::UserApi() {
std::shared_ptr<UserApiUserResource> spUserApiUserResource = std::make_shared<UserApiUserResource>();
this->publish(spUserApiUserResource);
std::shared_ptr<UserApiUserCreateWithArrayResource> spUserApiUserCreateWithArrayResource = std::make_shared<UserApiUserCreateWithArrayResource>();
this->publish(spUserApiUserCreateWithArrayResource);
std::shared_ptr<UserApiUserCreateWithListResource> spUserApiUserCreateWithListResource = std::make_shared<UserApiUserCreateWithListResource>();
this->publish(spUserApiUserCreateWithListResource);
std::shared_ptr<UserApiUserUsernameResource> spUserApiUserUsernameResource = std::make_shared<UserApiUserUsernameResource>();
this->publish(spUserApiUserUsernameResource);
std::shared_ptr<UserApiUserLoginResource> spUserApiUserLoginResource = std::make_shared<UserApiUserLoginResource>();
this->publish(spUserApiUserLoginResource);
std::shared_ptr<UserApiUserLogoutResource> spUserApiUserLogoutResource = std::make_shared<UserApiUserLogoutResource>();
this->publish(spUserApiUserLogoutResource);
}
UserApi::~UserApi() {}
@@ -66,6 +66,9 @@ UserApiUserResource::UserApiUserResource()
this->set_method_handler("POST",
std::bind(&UserApiUserResource::POST_method_handler, this,
std::placeholders::_1));
body = std::make_shared<User>();
}
UserApiUserResource::~UserApiUserResource()
@@ -125,6 +128,8 @@ UserApiUserCreateWithArrayResource::UserApiUserCreateWithArrayResource()
this->set_method_handler("POST",
std::bind(&UserApiUserCreateWithArrayResource::POST_method_handler, this,
std::placeholders::_1));
}
UserApiUserCreateWithArrayResource::~UserApiUserCreateWithArrayResource()
@@ -184,6 +189,8 @@ UserApiUserCreateWithListResource::UserApiUserCreateWithListResource()
this->set_method_handler("POST",
std::bind(&UserApiUserCreateWithListResource::POST_method_handler, this,
std::placeholders::_1));
}
UserApiUserCreateWithListResource::~UserApiUserCreateWithListResource()
@@ -249,6 +256,9 @@ UserApiUserUsernameResource::UserApiUserUsernameResource()
this->set_method_handler("PUT",
std::bind(&UserApiUserUsernameResource::PUT_method_handler, this,
std::placeholders::_1));
username = "";
}
UserApiUserUsernameResource::~UserApiUserUsernameResource()
@@ -388,6 +398,10 @@ UserApiUserLoginResource::UserApiUserLoginResource()
this->set_method_handler("GET",
std::bind(&UserApiUserLoginResource::GET_method_handler, this,
std::placeholders::_1));
username = "";
password = "";
}
UserApiUserLoginResource::~UserApiUserLoginResource()
@@ -446,6 +460,8 @@ UserApiUserLogoutResource::UserApiUserLogoutResource()
this->set_method_handler("GET",
std::bind(&UserApiUserLogoutResource::GET_method_handler, this,
std::placeholders::_1));
}
UserApiUserLogoutResource::~UserApiUserLogoutResource()

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -73,6 +73,8 @@ private:
std::shared_ptr<User> const &
)> handler_POST_;
std::shared_ptr<User> body;
};
/// <summary>
@@ -100,6 +102,8 @@ private:
std::vector<std::shared_ptr<User>> const &
)> handler_POST_;
std::vector<std::shared_ptr<User>> body;
};
/// <summary>
@@ -127,6 +131,8 @@ private:
std::vector<std::shared_ptr<User>> const &
)> handler_POST_;
std::vector<std::shared_ptr<User>> body;
};
/// <summary>
@@ -172,6 +178,8 @@ private:
std::function<std::pair<int, std::string>(
std::string const &, std::shared_ptr<User> const &
)> handler_PUT_;
std::string username;
};
/// <summary>
@@ -199,6 +207,9 @@ private:
std::string const &, std::string const &
)> handler_GET_;
std::string username;
std::string password;
};
/// <summary>
@@ -226,6 +237,7 @@ private:
)> handler_GET_;
};

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -30,24 +30,19 @@ namespace model {
ApiResponse::ApiResponse()
{
m_Code = 0;
m_Type = "";
m_Message = "";
m_Code = 0;
m_Type = "";
m_Message = "";
}
ApiResponse::~ApiResponse()
{
}
std::string ApiResponse::toJsonString()
std::string ApiResponse::toJsonString(bool prettyJson)
{
std::stringstream ss;
ptree pt;
pt.put("code", m_Code);
pt.put("type", m_Type);
pt.put("message", m_Message);
write_json(ss, pt, false);
write_json(ss, this->toPropertyTree(), prettyJson);
return ss.str();
}
@@ -56,6 +51,22 @@ void ApiResponse::fromJsonString(std::string const& jsonString)
std::stringstream ss(jsonString);
ptree pt;
read_json(ss,pt);
this->fromPropertyTree(pt);
}
ptree ApiResponse::toPropertyTree()
{
ptree pt;
ptree tmp_node;
pt.put("code", m_Code);
pt.put("type", m_Type);
pt.put("message", m_Message);
return pt;
}
void ApiResponse::fromPropertyTree(ptree const &pt)
{
ptree tmp_node;
m_Code = pt.get("code", 0);
m_Type = pt.get("type", "");
m_Message = pt.get("message", "");
@@ -67,7 +78,7 @@ int32_t ApiResponse::getCode() const
}
void ApiResponse::setCode(int32_t value)
{
m_Code = value;
m_Code = value;
}
std::string ApiResponse::getType() const
{
@@ -75,7 +86,7 @@ std::string ApiResponse::getType() const
}
void ApiResponse::setType(std::string value)
{
m_Type = value;
m_Type = value;
}
std::string ApiResponse::getMessage() const
{
@@ -83,7 +94,7 @@ std::string ApiResponse::getMessage() const
}
void ApiResponse::setMessage(std::string value)
{
m_Message = value;
m_Message = value;
}
}

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -23,6 +23,7 @@
#include <string>
#include <memory>
#include <boost/property_tree/ptree.hpp>
namespace org {
namespace openapitools {
@@ -32,34 +33,37 @@ namespace model {
/// <summary>
/// Describes the result of uploading an image resource
/// </summary>
class ApiResponse
class ApiResponse
{
public:
ApiResponse();
virtual ~ApiResponse();
std::string toJsonString();
std::string toJsonString(bool prettyJson = false);
void fromJsonString(std::string const& jsonString);
boost::property_tree::ptree toPropertyTree();
void fromPropertyTree(boost::property_tree::ptree const& pt);
/////////////////////////////////////////////
/// ApiResponse members
/// <summary>
///
/// </summary>
int32_t getCode() const;
void setCode(int32_t value);
/// <summary>
///
/// </summary>
std::string getType() const;
void setType(std::string value);
/// <summary>
///
/// </summary>
std::string getMessage() const;
void setMessage(std::string value);
protected:
int32_t m_Code;
std::string m_Type;

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -30,22 +30,18 @@ namespace model {
Category::Category()
{
m_Id = 0L;
m_Name = "";
m_Id = 0L;
m_Name = "";
}
Category::~Category()
{
}
std::string Category::toJsonString()
std::string Category::toJsonString(bool prettyJson)
{
std::stringstream ss;
ptree pt;
pt.put("id", m_Id);
pt.put("name", m_Name);
write_json(ss, pt, false);
write_json(ss, this->toPropertyTree(), prettyJson);
return ss.str();
}
@@ -54,6 +50,21 @@ void Category::fromJsonString(std::string const& jsonString)
std::stringstream ss(jsonString);
ptree pt;
read_json(ss,pt);
this->fromPropertyTree(pt);
}
ptree Category::toPropertyTree()
{
ptree pt;
ptree tmp_node;
pt.put("id", m_Id);
pt.put("name", m_Name);
return pt;
}
void Category::fromPropertyTree(ptree const &pt)
{
ptree tmp_node;
m_Id = pt.get("id", 0L);
m_Name = pt.get("name", "");
}
@@ -64,7 +75,7 @@ int64_t Category::getId() const
}
void Category::setId(int64_t value)
{
m_Id = value;
m_Id = value;
}
std::string Category::getName() const
{
@@ -72,7 +83,7 @@ std::string Category::getName() const
}
void Category::setName(std::string value)
{
m_Name = value;
m_Name = value;
}
}

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -23,6 +23,7 @@
#include <string>
#include <memory>
#include <boost/property_tree/ptree.hpp>
namespace org {
namespace openapitools {
@@ -32,29 +33,31 @@ namespace model {
/// <summary>
/// A category for a pet
/// </summary>
class Category
class Category
{
public:
Category();
virtual ~Category();
std::string toJsonString();
std::string toJsonString(bool prettyJson = false);
void fromJsonString(std::string const& jsonString);
boost::property_tree::ptree toPropertyTree();
void fromPropertyTree(boost::property_tree::ptree const& pt);
/////////////////////////////////////////////
/// Category members
/// <summary>
///
/// </summary>
int64_t getId() const;
void setId(int64_t value);
/// <summary>
///
/// </summary>
std::string getName() const;
void setName(std::string value);
protected:
int64_t m_Id;
std::string m_Name;

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -16,6 +16,7 @@
#include <string>
#include <sstream>
#include <algorithm>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
@@ -30,30 +31,23 @@ namespace model {
Order::Order()
{
m_Id = 0L;
m_PetId = 0L;
m_Quantity = 0;
m_ShipDate = "";
m_Status = "";
m_Complete = false;
m_Id = 0L;
m_PetId = 0L;
m_Quantity = 0;
m_ShipDate = "";
m_Status = "";
m_StatusEnum = { "placed", "approved", "delivered" };
m_Complete = false;
}
Order::~Order()
{
}
std::string Order::toJsonString()
std::string Order::toJsonString(bool prettyJson)
{
std::stringstream ss;
ptree pt;
pt.put("id", m_Id);
pt.put("petId", m_PetId);
pt.put("quantity", m_Quantity);
pt.put("shipDate", m_ShipDate);
pt.put("status", m_Status);
pt.put("complete", m_Complete);
write_json(ss, pt, false);
write_json(ss, this->toPropertyTree(), prettyJson);
return ss.str();
}
@@ -62,11 +56,30 @@ void Order::fromJsonString(std::string const& jsonString)
std::stringstream ss(jsonString);
ptree pt;
read_json(ss,pt);
this->fromPropertyTree(pt);
}
ptree Order::toPropertyTree()
{
ptree pt;
ptree tmp_node;
pt.put("id", m_Id);
pt.put("petId", m_PetId);
pt.put("quantity", m_Quantity);
pt.put("shipDate", m_ShipDate);
pt.put("status", m_Status);
pt.put("complete", m_Complete);
return pt;
}
void Order::fromPropertyTree(ptree const &pt)
{
ptree tmp_node;
m_Id = pt.get("id", 0L);
m_PetId = pt.get("petId", 0L);
m_Quantity = pt.get("quantity", 0);
m_ShipDate = pt.get("shipDate", "");
m_Status = pt.get("status", "");
setStatus(pt.get("status", ""));
m_Complete = pt.get("complete", false);
}
@@ -76,7 +89,7 @@ int64_t Order::getId() const
}
void Order::setId(int64_t value)
{
m_Id = value;
m_Id = value;
}
int64_t Order::getPetId() const
{
@@ -84,7 +97,7 @@ int64_t Order::getPetId() const
}
void Order::setPetId(int64_t value)
{
m_PetId = value;
m_PetId = value;
}
int32_t Order::getQuantity() const
{
@@ -92,7 +105,7 @@ int32_t Order::getQuantity() const
}
void Order::setQuantity(int32_t value)
{
m_Quantity = value;
m_Quantity = value;
}
std::string Order::getShipDate() const
{
@@ -100,7 +113,7 @@ std::string Order::getShipDate() const
}
void Order::setShipDate(std::string value)
{
m_ShipDate = value;
m_ShipDate = value;
}
std::string Order::getStatus() const
{
@@ -108,7 +121,9 @@ std::string Order::getStatus() const
}
void Order::setStatus(std::string value)
{
m_Status = value;
if (std::find(m_StatusEnum.begin(), m_StatusEnum.end(), value) != m_StatusEnum.end()) {
m_Status = value;
}
}
bool Order::isComplete() const
{
@@ -116,7 +131,7 @@ bool Order::isComplete() const
}
void Order::setComplete(bool value)
{
m_Complete = value;
m_Complete = value;
}
}

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -22,7 +22,9 @@
#include <string>
#include <vector>
#include <memory>
#include <boost/property_tree/ptree.hpp>
namespace org {
namespace openapitools {
@@ -32,49 +34,55 @@ namespace model {
/// <summary>
/// An order for a pets from the pet store
/// </summary>
class Order
class Order
{
public:
Order();
virtual ~Order();
std::string toJsonString();
std::string toJsonString(bool prettyJson = false);
void fromJsonString(std::string const& jsonString);
boost::property_tree::ptree toPropertyTree();
void fromPropertyTree(boost::property_tree::ptree const& pt);
/////////////////////////////////////////////
/// Order members
/// <summary>
///
/// </summary>
int64_t getId() const;
void setId(int64_t value);
/// <summary>
///
/// </summary>
int64_t getPetId() const;
void setPetId(int64_t value);
/// <summary>
///
/// </summary>
int32_t getQuantity() const;
void setQuantity(int32_t value);
/// <summary>
///
/// </summary>
std::string getShipDate() const;
void setShipDate(std::string value);
/// <summary>
/// Order Status
/// </summary>
std::string getStatus() const;
void setStatus(std::string value);
/// <summary>
///
/// </summary>
bool isComplete() const;
void setComplete(bool value);
protected:
int64_t m_Id;
int64_t m_PetId;
@@ -82,6 +90,7 @@ protected:
std::string m_ShipDate;
std::string m_Status;
bool m_Complete;
std::vector<std::string> m_StatusEnum;
};
}

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -16,6 +16,7 @@
#include <string>
#include <sstream>
#include <algorithm>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
@@ -30,24 +31,20 @@ namespace model {
Pet::Pet()
{
m_Id = 0L;
m_Name = "";
m_Status = "";
m_Id = 0L;
m_Name = "";
m_Status = "";
m_StatusEnum = { "available", "pending", "sold" };
}
Pet::~Pet()
{
}
std::string Pet::toJsonString()
std::string Pet::toJsonString(bool prettyJson)
{
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);
write_json(ss, this->toPropertyTree(), prettyJson);
return ss.str();
}
@@ -56,9 +53,63 @@ void Pet::fromJsonString(std::string const& jsonString)
std::stringstream ss(jsonString);
ptree pt;
read_json(ss,pt);
this->fromPropertyTree(pt);
}
ptree Pet::toPropertyTree()
{
ptree pt;
ptree tmp_node;
pt.put("id", m_Id);
if (m_Category != nullptr) {
pt.add_child("category", m_Category->toPropertyTree());
}
pt.put("name", m_Name);
// generate tree for PhotoUrls
if (!m_PhotoUrls.empty()) {
for (const auto &childEntry : m_PhotoUrls) {
ptree PhotoUrls_node;
PhotoUrls_node.put("", childEntry);
tmp_node.push_back(std::make_pair("", PhotoUrls_node));
}
pt.add_child("photoUrls", tmp_node);
tmp_node.clear();
}
// generate tree for vector of pointers of Tags
if (!m_Tags.empty()) {
for (const auto &childEntry : m_Tags) {
tmp_node.push_back(std::make_pair("", childEntry->toPropertyTree()));
}
pt.add_child("tags", tmp_node);
tmp_node.clear();
}
pt.put("status", m_Status);
return pt;
}
void Pet::fromPropertyTree(ptree const &pt)
{
ptree tmp_node;
m_Id = pt.get("id", 0L);
if (pt.get_child_optional("category")) {
m_Category = std::make_shared<Category>();
m_Category->fromPropertyTree(pt.get_child("category"));
}
m_Name = pt.get("name", "");
m_Status = pt.get("status", "");
// push all items of PhotoUrls into member vector
if (pt.get_child_optional("photoUrls")) {
for (const auto &childTree : pt.get_child("photoUrls")) {
m_PhotoUrls.emplace_back(childTree.second.data());
}
}
// generate new Tag Object for each item and assign it to the current
if (pt.get_child_optional("tags")) {
for (const auto &childTree : pt.get_child("tags")) {
m_Tags.emplace_back(std::make_shared<Tag>());
m_Tags.back()->fromPropertyTree(childTree.second);
}
}
setStatus(pt.get("status", ""));
}
int64_t Pet::getId() const
@@ -67,7 +118,7 @@ int64_t Pet::getId() const
}
void Pet::setId(int64_t value)
{
m_Id = value;
m_Id = value;
}
std::shared_ptr<Category> Pet::getCategory() const
{
@@ -75,7 +126,7 @@ std::shared_ptr<Category> Pet::getCategory() const
}
void Pet::setCategory(std::shared_ptr<Category> value)
{
m_Category = value;
m_Category = value;
}
std::string Pet::getName() const
{
@@ -83,7 +134,7 @@ std::string Pet::getName() const
}
void Pet::setName(std::string value)
{
m_Name = value;
m_Name = value;
}
std::vector<std::string> Pet::getPhotoUrls() const
{
@@ -91,7 +142,7 @@ std::vector<std::string> Pet::getPhotoUrls() const
}
void Pet::setPhotoUrls(std::vector<std::string> value)
{
m_PhotoUrls = value;
m_PhotoUrls = value;
}
std::vector<std::shared_ptr<Tag>> Pet::getTags() const
{
@@ -99,7 +150,7 @@ std::vector<std::shared_ptr<Tag>> Pet::getTags() const
}
void Pet::setTags(std::vector<std::shared_ptr<Tag>> value)
{
m_Tags = value;
m_Tags = value;
}
std::string Pet::getStatus() const
{
@@ -107,7 +158,9 @@ std::string Pet::getStatus() const
}
void Pet::setStatus(std::string value)
{
m_Status = value;
if (std::find(m_StatusEnum.begin(), m_StatusEnum.end(), value) != m_StatusEnum.end()) {
m_Status = value;
}
}
}

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -26,6 +26,7 @@
#include "Category.h"
#include <vector>
#include <memory>
#include <boost/property_tree/ptree.hpp>
namespace org {
namespace openapitools {
@@ -35,49 +36,55 @@ namespace model {
/// <summary>
/// A pet for sale in the pet store
/// </summary>
class Pet
class Pet
{
public:
Pet();
virtual ~Pet();
std::string toJsonString();
std::string toJsonString(bool prettyJson = false);
void fromJsonString(std::string const& jsonString);
boost::property_tree::ptree toPropertyTree();
void fromPropertyTree(boost::property_tree::ptree const& pt);
/////////////////////////////////////////////
/// Pet members
/// <summary>
///
/// </summary>
int64_t getId() const;
void setId(int64_t value);
/// <summary>
///
/// </summary>
std::shared_ptr<Category> getCategory() const;
void setCategory(std::shared_ptr<Category> value);
/// <summary>
///
/// </summary>
std::string getName() const;
void setName(std::string value);
/// <summary>
///
/// </summary>
std::vector<std::string> getPhotoUrls() const;
void setPhotoUrls(std::vector<std::string> value);
/// <summary>
///
/// </summary>
std::vector<std::shared_ptr<Tag>> getTags() const;
void setTags(std::vector<std::shared_ptr<Tag>> value);
/// <summary>
/// pet status in the store
/// </summary>
std::string getStatus() const;
void setStatus(std::string value);
protected:
int64_t m_Id;
std::shared_ptr<Category> m_Category;
@@ -85,6 +92,7 @@ protected:
std::vector<std::string> m_PhotoUrls;
std::vector<std::shared_ptr<Tag>> m_Tags;
std::string m_Status;
std::vector<std::string> m_StatusEnum;
};
}

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -30,22 +30,18 @@ namespace model {
Tag::Tag()
{
m_Id = 0L;
m_Name = "";
m_Id = 0L;
m_Name = "";
}
Tag::~Tag()
{
}
std::string Tag::toJsonString()
std::string Tag::toJsonString(bool prettyJson)
{
std::stringstream ss;
ptree pt;
pt.put("id", m_Id);
pt.put("name", m_Name);
write_json(ss, pt, false);
write_json(ss, this->toPropertyTree(), prettyJson);
return ss.str();
}
@@ -54,6 +50,21 @@ void Tag::fromJsonString(std::string const& jsonString)
std::stringstream ss(jsonString);
ptree pt;
read_json(ss,pt);
this->fromPropertyTree(pt);
}
ptree Tag::toPropertyTree()
{
ptree pt;
ptree tmp_node;
pt.put("id", m_Id);
pt.put("name", m_Name);
return pt;
}
void Tag::fromPropertyTree(ptree const &pt)
{
ptree tmp_node;
m_Id = pt.get("id", 0L);
m_Name = pt.get("name", "");
}
@@ -64,7 +75,7 @@ int64_t Tag::getId() const
}
void Tag::setId(int64_t value)
{
m_Id = value;
m_Id = value;
}
std::string Tag::getName() const
{
@@ -72,7 +83,7 @@ std::string Tag::getName() const
}
void Tag::setName(std::string value)
{
m_Name = value;
m_Name = value;
}
}

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -23,6 +23,7 @@
#include <string>
#include <memory>
#include <boost/property_tree/ptree.hpp>
namespace org {
namespace openapitools {
@@ -32,29 +33,31 @@ namespace model {
/// <summary>
/// A tag for a pet
/// </summary>
class Tag
class Tag
{
public:
Tag();
virtual ~Tag();
std::string toJsonString();
std::string toJsonString(bool prettyJson = false);
void fromJsonString(std::string const& jsonString);
boost::property_tree::ptree toPropertyTree();
void fromPropertyTree(boost::property_tree::ptree const& pt);
/////////////////////////////////////////////
/// Tag members
/// <summary>
///
/// </summary>
int64_t getId() const;
void setId(int64_t value);
/// <summary>
///
/// </summary>
std::string getName() const;
void setName(std::string value);
protected:
int64_t m_Id;
std::string m_Name;

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -30,34 +30,24 @@ namespace model {
User::User()
{
m_Id = 0L;
m_Username = "";
m_FirstName = "";
m_LastName = "";
m_Email = "";
m_Password = "";
m_Phone = "";
m_UserStatus = 0;
m_Id = 0L;
m_Username = "";
m_FirstName = "";
m_LastName = "";
m_Email = "";
m_Password = "";
m_Phone = "";
m_UserStatus = 0;
}
User::~User()
{
}
std::string User::toJsonString()
std::string User::toJsonString(bool prettyJson)
{
std::stringstream ss;
ptree pt;
pt.put("id", m_Id);
pt.put("username", m_Username);
pt.put("firstName", m_FirstName);
pt.put("lastName", m_LastName);
pt.put("email", m_Email);
pt.put("password", m_Password);
pt.put("phone", m_Phone);
pt.put("userStatus", m_UserStatus);
write_json(ss, pt, false);
write_json(ss, this->toPropertyTree(), prettyJson);
return ss.str();
}
@@ -66,6 +56,27 @@ void User::fromJsonString(std::string const& jsonString)
std::stringstream ss(jsonString);
ptree pt;
read_json(ss,pt);
this->fromPropertyTree(pt);
}
ptree User::toPropertyTree()
{
ptree pt;
ptree tmp_node;
pt.put("id", m_Id);
pt.put("username", m_Username);
pt.put("firstName", m_FirstName);
pt.put("lastName", m_LastName);
pt.put("email", m_Email);
pt.put("password", m_Password);
pt.put("phone", m_Phone);
pt.put("userStatus", m_UserStatus);
return pt;
}
void User::fromPropertyTree(ptree const &pt)
{
ptree tmp_node;
m_Id = pt.get("id", 0L);
m_Username = pt.get("username", "");
m_FirstName = pt.get("firstName", "");
@@ -82,7 +93,7 @@ int64_t User::getId() const
}
void User::setId(int64_t value)
{
m_Id = value;
m_Id = value;
}
std::string User::getUsername() const
{
@@ -90,7 +101,7 @@ std::string User::getUsername() const
}
void User::setUsername(std::string value)
{
m_Username = value;
m_Username = value;
}
std::string User::getFirstName() const
{
@@ -98,7 +109,7 @@ std::string User::getFirstName() const
}
void User::setFirstName(std::string value)
{
m_FirstName = value;
m_FirstName = value;
}
std::string User::getLastName() const
{
@@ -106,7 +117,7 @@ std::string User::getLastName() const
}
void User::setLastName(std::string value)
{
m_LastName = value;
m_LastName = value;
}
std::string User::getEmail() const
{
@@ -114,7 +125,7 @@ std::string User::getEmail() const
}
void User::setEmail(std::string value)
{
m_Email = value;
m_Email = value;
}
std::string User::getPassword() const
{
@@ -122,7 +133,7 @@ std::string User::getPassword() const
}
void User::setPassword(std::string value)
{
m_Password = value;
m_Password = value;
}
std::string User::getPhone() const
{
@@ -130,7 +141,7 @@ std::string User::getPhone() const
}
void User::setPhone(std::string value)
{
m_Phone = value;
m_Phone = value;
}
int32_t User::getUserStatus() const
{
@@ -138,7 +149,7 @@ int32_t User::getUserStatus() const
}
void User::setUserStatus(int32_t value)
{
m_UserStatus = value;
m_UserStatus = value;
}
}

View File

@@ -5,7 +5,7 @@
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 4.2.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator unset.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -23,6 +23,7 @@
#include <string>
#include <memory>
#include <boost/property_tree/ptree.hpp>
namespace org {
namespace openapitools {
@@ -32,59 +33,67 @@ namespace model {
/// <summary>
/// A User who is purchasing from the pet store
/// </summary>
class User
class User
{
public:
User();
virtual ~User();
std::string toJsonString();
std::string toJsonString(bool prettyJson = false);
void fromJsonString(std::string const& jsonString);
boost::property_tree::ptree toPropertyTree();
void fromPropertyTree(boost::property_tree::ptree const& pt);
/////////////////////////////////////////////
/// User members
/// <summary>
///
/// </summary>
int64_t getId() const;
void setId(int64_t value);
/// <summary>
///
/// </summary>
std::string getUsername() const;
void setUsername(std::string value);
/// <summary>
///
/// </summary>
std::string getFirstName() const;
void setFirstName(std::string value);
/// <summary>
///
/// </summary>
std::string getLastName() const;
void setLastName(std::string value);
/// <summary>
///
/// </summary>
std::string getEmail() const;
void setEmail(std::string value);
/// <summary>
///
/// </summary>
std::string getPassword() const;
void setPassword(std::string value);
/// <summary>
///
/// </summary>
std::string getPhone() const;
void setPhone(std::string value);
/// <summary>
/// User Status
/// </summary>
int32_t getUserStatus() const;
void setUserStatus(int32_t value);
protected:
int64_t m_Id;
std::string m_Username;