aboutsummaryrefslogtreecommitdiff
path: root/jobs/{{base}}.h.mustache
diff options
context:
space:
mode:
Diffstat (limited to 'jobs/{{base}}.h.mustache')
-rw-r--r--jobs/{{base}}.h.mustache44
1 files changed, 24 insertions, 20 deletions
diff --git a/jobs/{{base}}.h.mustache b/jobs/{{base}}.h.mustache
index e19cf03d..08372b77 100644
--- a/jobs/{{base}}.h.mustache
+++ b/jobs/{{base}}.h.mustache
@@ -2,42 +2,46 @@
#pragma once
-{{#operations}}#include "../basejob.h"{{/operations}}
-{{#imports}}
-#include {{.}}
+{{#operations}}#include "../basejob.h"
+{{/operations}}
+{{#imports}}#include {{.}}
{{/imports}}
-{{#models}}#include <QtCore/QJsonValue>{{/models}}{{! FIXME: This should probably go inside imports }}
+{{#models}}#include "jobs/converters.h"
+{{/models}}
namespace QMatrixClient
{
{{#models}} // Data structures
- {{#model}}
+{{# model}}
struct {{classname}}
{
- {{#vars}}
- {{datatype}} {{name}};
+ {{#vars}}{{datatype}} {{name}};
{{/vars}}
- operator QJsonValue() const { return {}; }
- };{{/model}}
+ operator QJsonValue() const;
+ };
+
+ template <> struct FromJson<{{classname}}>
+ {
+ {{classname}} operator()(QJsonValue jv);
+ };
+{{/ model}}
{{/models}}
{{#operations}} // Operations
- {{#operation}}
- class {{#@cap}}{{operationId}}{{/@cap}}Job : public BaseJob
+{{# operation}}
+ class {{camelCaseOperationId}}Job : public BaseJob
{
public:
- {{#@cap}}{{operationId}}{{/@cap}}Job({{#allParams}}{{#avoidCopy?}}const {{dataType}}&{{/avoidCopy?}}{{^avoidCopy?}}{{dataType}}{{/avoidCopy?}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
- {{#returns?}}
- virtual {{className}}Job();
-
- {{#returns}}{{type}} {{name}}() const;{{/returns}}
+ explicit {{camelCaseOperationId}}Job({{#allParams}}{{#avoidCopy?}}const {{dataType}}&{{/avoidCopy?}}{{^avoidCopy?}}{{dataType}}{{/avoidCopy?}} {{paramName}}{{^required?}} = {{defaultValue}}{{^defaultValue}}{}{{/defaultValue}}{{/required?}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
+{{# responses}}{{#normalResponse?}}{{#properties?}}
+ virtual ~{{camelCaseOperationId}}Job();
+ {{#properties}}{{dataType}} {{paramName}}() const;
+ {{/properties}}
protected:
+ {{^returnFile}}Status parseJson(const QJsonDocument& data) override;{{/returnFile}}
{{#returnFile?}}Status parseReply(QByteArray data) override;{{/returnFile?}}
- {{^returnFile}}Status parseJson(const JsonDocument& data) override;{{/returnFile}}
-
private:
class Private;
- Private* d;
- {{/returns?}}
+ Private* d;{{/properties?}}{{/normalResponse?}}{{/responses}}
};{{/operation}}
{{/operations}}
} // namespace QMatrixClient