[C++] [Restbed] Reworked the model template for restbed to create generic models (#5873)

* - Added Restbed Generator

* - Added Json processing functions to model
- Removed unnused code from restbed codegen class
- Added response header processing to api template

* Changed it to respect alphabetical order

* Made the string joining java 7 compatible

* Added samples

* - Reworked the getter setter generation
This commit is contained in:
stkrwork 2017-06-19 16:56:01 +02:00 committed by wing328
parent 3a32857790
commit 981ad60050
4 changed files with 19 additions and 15 deletions

View File

@ -37,10 +37,8 @@ public:
/// <summary> /// <summary>
/// {{description}} /// {{description}}
/// </summary> /// </summary>
{{^isNotContainer}}{{{datatype}}}& {{getter}}(); {{{datatype}}} {{getter}}() const;
{{/isNotContainer}}{{#isNotContainer}}{{{datatype}}} {{getter}}() const;
void {{setter}}({{{datatype}}} value); void {{setter}}({{{datatype}}} value);
{{/isNotContainer}}
{{/vars}} {{/vars}}
protected: protected:

View File

@ -73,11 +73,8 @@ void {{classname}}::fromJsonString(std::string const& jsonString)
{{/vars}} {{/vars}}
} }
{{#vars}}{{^isNotContainer}}{{{datatype}}}& {{classname}}::{{getter}}() {{#vars}}
{ {{{datatype}}} {{classname}}::{{getter}}() const
return m_{{name}};
}
{{/isNotContainer}}{{#isNotContainer}}{{{datatype}}} {{classname}}::{{getter}}() const
{ {
return m_{{name}}; return m_{{name}};
} }
@ -85,7 +82,6 @@ void {{classname}}::{{setter}}({{{datatype}}} value)
{ {
m_{{name}} = value; m_{{name}} = value;
} }
{{/isNotContainer}}
{{/vars}} {{/vars}}
{{#modelNamespaceDeclarations}} {{#modelNamespaceDeclarations}}

View File

@ -85,14 +85,22 @@ void Pet::setName(std::string value)
{ {
m_Name = value; m_Name = value;
} }
std::vector<std::string>& Pet::getPhotoUrls() std::vector<std::string> Pet::getPhotoUrls() const
{ {
return m_PhotoUrls; return m_PhotoUrls;
} }
std::vector<std::shared_ptr<Tag>>& Pet::getTags() void Pet::setPhotoUrls(std::vector<std::string> value)
{
m_PhotoUrls = value;
}
std::vector<std::shared_ptr<Tag>> Pet::getTags() const
{ {
return m_Tags; return m_Tags;
} }
void Pet::setTags(std::vector<std::shared_ptr<Tag>> value)
{
m_Tags = value;
}
std::string Pet::getStatus() const std::string Pet::getStatus() const
{ {
return m_Status; return m_Status;

View File

@ -65,11 +65,13 @@ public:
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
std::vector<std::string>& getPhotoUrls(); std::vector<std::string> getPhotoUrls() const;
void setPhotoUrls(std::vector<std::string> value);
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
std::vector<std::shared_ptr<Tag>>& getTags(); std::vector<std::shared_ptr<Tag>> getTags() const;
void setTags(std::vector<std::shared_ptr<Tag>> value);
/// <summary> /// <summary>
/// pet status in the store /// pet status in the store
/// </summary> /// </summary>