Improve templates for C++ Restbed (#10543)

* Improve templates for C++ Restbed

The templates now generate classes which have virtual functions that can
be overridden to implement handlers.

* Fix missing HTTP methods in generated restbed C++ code

There was a wrong handling of "x-codegen-other-methods".

Change-Id: If6526d2672434beb5ebb0871d84cb80d84c34c38
This commit is contained in:
Lukas Woodtli
2021-10-13 07:57:40 +02:00
committed by GitHub
parent 80c3a0e4c3
commit 0023f3b7ce
24 changed files with 3569 additions and 1511 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 5.0.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 <vector>
#include <boost/property_tree/ptree.hpp>
namespace org {
@@ -36,8 +37,9 @@ namespace model {
class User
{
public:
User();
virtual ~User();
User() = default;
explicit User(boost::property_tree::ptree const& pt);
virtual ~User() = default;
std::string toJsonString(bool prettyJson = false);
void fromJsonString(std::string const& jsonString);
@@ -94,17 +96,31 @@ public:
/// </summary>
int32_t getUserStatus() const;
void setUserStatus(int32_t value);
protected:
int64_t m_Id;
std::string m_Username;
std::string m_FirstName;
std::string m_LastName;
std::string m_Email;
std::string m_Password;
std::string m_Phone;
int32_t m_UserStatus;
//////////////////////////////////////
// Override these for customization //
//////////////////////////////////////
virtual std::string toJsonString_internal(bool prettyJson = false);
virtual void fromJsonString_internal(std::string const& jsonString);
virtual boost::property_tree::ptree toPropertyTree_internal();
virtual void fromPropertyTree_internal(boost::property_tree::ptree const& pt);
protected:
int64_t m_Id = 0L;
std::string m_Username = "";
std::string m_FirstName = "";
std::string m_LastName = "";
std::string m_Email = "";
std::string m_Password = "";
std::string m_Phone = "";
int32_t m_UserStatus = 0;
};
std::vector<User> createUserVectorFromJsonString(const std::string& json);
}
}
}