aboutsummaryrefslogtreecommitdiff
path: root/jobs/{{base}}.h.mustache
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-12-06 19:15:51 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-12-06 19:15:51 +0900
commit905263ceb5e2e13b862bec0a64f6d84eca3c2e9d (patch)
tree40ef6c56e1d72e215bf649928bfae9f82aa0b7a4 /jobs/{{base}}.h.mustache
parentea2dcf5d6c9329a14b4e0039bd2dc45ac3fd89d8 (diff)
downloadlibquotient-905263ceb5e2e13b862bec0a64f6d84eca3c2e9d.tar.gz
libquotient-905263ceb5e2e13b862bec0a64f6d84eca3c2e9d.zip
GTAD pre-0.4, with local data types and parametrised arrays; make avoidCopy? actually work
Along with this: - avoid copying of QStrings (unneeded convenience in our case) - even less empty lines
Diffstat (limited to 'jobs/{{base}}.h.mustache')
-rw-r--r--jobs/{{base}}.h.mustache50
1 files changed, 32 insertions, 18 deletions
diff --git a/jobs/{{base}}.h.mustache b/jobs/{{base}}.h.mustache
index a751df9d..f7124f97 100644
--- a/jobs/{{base}}.h.mustache
+++ b/jobs/{{base}}.h.mustache
@@ -4,37 +4,51 @@
{{#operations}}#include "../basejob.h"
{{/operations}}
-{{#imports}}#include {{.}}
+{{#imports}}#include {{_}}
{{/imports}}
-{{#models}}#include "converters.h"
-{{/models}}
+{{#allModels}}#include "converters.h"
+{{/allModels}}
namespace QMatrixClient
{
{{#models}} // Data structures
-{{# model}}
- struct {{classname}}{{#parents?}} : {{#parents}}{{.}}{{#last?}}, {{/last?}}{{/parents}}{{/parents?}}
+{{# model}}{{#trivial?}}
+ using {{name}} = {{parent.name}};
+{{/ trivial?}}{{^trivial?}}
+ struct {{name}}{{#parents?}} : {{#parents}}{{name}}{{#@join}}, {{/@join}}{{/parents}}{{/parents?}}
{
- {{#vars}}{{datatype}} {{name}};
+ {{#vars}}{{dataType.name}} {{nameCamelCase}};
{{/vars}}
operator QJsonValue() const;
};
- template <> struct FromJson<{{classname}}>
+ template <> struct FromJson<{{name}}>
{
- {{classname}} operator()(QJsonValue jv);
+ {{name}} operator()(QJsonValue jv);
};
-{{/ model}}
-{{/models}}
-{{#operations}} // Operations
+{{/ trivial?}}{{/model}}
+{{/models}}{{#operations}} // Operations
{{# operation}}
class {{camelCaseOperationId}}Job : public BaseJob
{
- public:
- explicit {{camelCaseOperationId}}Job({{#allParams}}{{#avoidCopy?}}const {{dataType}}&{{/avoidCopy?}}{{^avoidCopy?}}{{dataType}}{{/avoidCopy?}} {{paramName}}{{^required?}} = {{defaultValue}}{{^defaultValue}}{}{{/defaultValue}}{{/required?}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
-{{# responses}}{{#normalResponse?}}{{#properties?}}
+ public:{{# models}}
+ // Inner data structures
+{{# model}}{{#trivial?}}
+ using {{name}} = {{parent.name}};
+{{/ trivial?}}{{^trivial?}}
+ struct {{name}}{{#parents?}} : {{#parents}}{{name}}{{#@join}}, {{/@join}}{{/parents}}{{/parents?}}
+ {
+ {{#vars}}{{dataType.name}} {{nameCamelCase}};
+ {{/vars}}
+ operator QJsonValue() const;
+ };
+{{/ trivial?}}{{/model}}
+ // End of inner data structures
+{{/models}}
+ explicit {{camelCaseOperationId}}Job({{#allParams}}{{>maybeCrefType}} {{paramName}}{{^required?}} = {{defaultValue}}{{^defaultValue}}{}{{/defaultValue}}{{/required?}}{{#@join}}, {{/@join}}{{/allParams}});{{!skip EOL
+}}{{# responses}}{{#normalResponse?}}{{#properties?}}
~{{camelCaseOperationId}}Job() override;
- {{#properties}}const {{dataType}}& {{paramName}}() const;
+ {{#properties}}{{>maybeCrefType}} {{paramName}}() const;
{{/properties}}
protected:
{{^returnFile}}Status parseJson(const QJsonDocument& data) override;{{/returnFile}}
@@ -42,6 +56,6 @@ namespace QMatrixClient
private:
class Private;
Private* d;{{/properties?}}{{/normalResponse?}}{{/responses}}
- };{{/operation}}
-{{/operations}}
-} // namespace QMatrixClient
+ };
+{{/operation}}{{/operations}}{{!skip EOL
+}}} // namespace QMatrixClient