diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-06-02 13:32:47 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-06-02 13:32:47 +0900 |
commit | 0dd491fbd189baaabadcab2344a05e3cf3898287 (patch) | |
tree | 13b8ebe63ba8b156ddd6ddab8b0ad2845d7c9c42 /lib/csapi/{{base}}.cpp.mustache | |
parent | e7ac6f3480358fd989c8a3090590d665d18e1cec (diff) | |
download | libquotient-0dd491fbd189baaabadcab2344a05e3cf3898287.tar.gz libquotient-0dd491fbd189baaabadcab2344a05e3cf3898287.zip |
csapi: Use Omittable<> container instead of intrusive 'omitted' field
Also: use the latest feature of GTAD, +set/+on, to make gtad.yaml more compact.
Diffstat (limited to 'lib/csapi/{{base}}.cpp.mustache')
-rw-r--r-- | lib/csapi/{{base}}.cpp.mustache | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/csapi/{{base}}.cpp.mustache b/lib/csapi/{{base}}.cpp.mustache index c6504f42..4abe38eb 100644 --- a/lib/csapi/{{base}}.cpp.mustache +++ b/lib/csapi/{{base}}.cpp.mustache @@ -10,10 +10,7 @@ using namespace QMatrixClient; {{#models.model}}{{#in?}} QJsonObject QMatrixClient::toJson(const {{qualifiedName}}& pod) { - QJsonObject _json; - if (pod.omitted) - return _json; -{{#vars}} + QJsonObject _json;{{#vars}} addToJson<{{^required?}}IfNotEmpty{{/required?}}>(_json, "{{baseName}}", pod.{{nameCamelCase}});{{/vars}} return _json; } @@ -36,10 +33,7 @@ namespace QMatrixClient {{#model}}{{#in?}} QJsonObject toJson(const {{qualifiedName}}& pod) { - QJsonObject _json; - if (pod.omitted) - return _json; -{{#vars}} + QJsonObject _json;{{#vars}} addToJson<{{^required?}}IfNotEmpty{{/required?}}>(_json, "{{baseName}}", pod.{{nameCamelCase}});{{/vars}} return _json; } @@ -61,7 +55,7 @@ namespace QMatrixClient class {{camelCaseOperationId}}Job::Private { public:{{#allProperties}} - {{dataType.name}} {{paramName}};{{/allProperties}} + {{>maybeOmittableType}} {{paramName}};{{/allProperties}} }; {{/ allProperties?}}{{/normalResponse?}}{{/responses}}{{#queryParams?}} BaseJob::Query queryTo{{camelCaseOperationId}}({{#queryParams}}{{>joinedParamDef}}{{/queryParams}}) |