[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

@@ -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;
}
}