mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-04 23:36:09 +00:00
[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:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user