aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-06-11 12:47:36 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-06-11 12:47:36 +0900
commit886d8c585fbd3efe6fd298f8d5b5f980c752deae (patch)
tree3b7a4c8d238e244728d2cfbfc4085f4a8b1ff83c /lib/csapi
parent4fc03b25639df302f4a1dc02666d785ba4dfcade (diff)
downloadlibquotient-886d8c585fbd3efe6fd298f8d5b5f980c752deae.tar.gz
libquotient-886d8c585fbd3efe6fd298f8d5b5f980c752deae.zip
gtad.yaml: More concise list joining
Diffstat (limited to 'lib/csapi')
-rw-r--r--lib/csapi/gtad.yaml7
-rw-r--r--lib/csapi/{{base}}.cpp.mustache2
-rw-r--r--lib/csapi/{{base}}.h.mustache4
3 files changed, 7 insertions, 6 deletions
diff --git a/lib/csapi/gtad.yaml b/lib/csapi/gtad.yaml
index 55932378..48e04477 100644
--- a/lib/csapi/gtad.yaml
+++ b/lib/csapi/gtad.yaml
@@ -113,6 +113,7 @@ mustache:
_literalQuote: '"'
omittedValue: '{}' # default value to initialize omitted parameters with
initializer: '{{defaultValue}}'
+ join,: '{{#@join}}, {{/@join}}'
openOmittable: "{{^required?}}{{#useOmittable}}{{^defaultValue}}Omittable<{{/defaultValue}}{{/useOmittable}}{{/required?}}"
closeOmittable: "{{^required?}}{{#useOmittable}}{{^defaultValue}}>{{/defaultValue}}{{/useOmittable}}{{/required?}}"
maybeOmittableType: "{{>openOmittable}}{{dataType.name}}{{>closeOmittable}}"
@@ -121,9 +122,9 @@ mustache:
qualifiedMaybeCrefType:
"{{#avoidCopy}}const {{/avoidCopy}}{{>qualifiedMaybeOmittableType}}{{#avoidCopy}}&{{/avoidCopy}}{{#moveOnly}}&&{{/moveOnly}}"
initializeDefaultValue: "{{#defaultValue}}{{>initializer}}{{/defaultValue}}{{^defaultValue}}{{>omittedValue}}{{/defaultValue}}"
- joinedParamDecl: '{{>maybeCrefType}} {{paramName}}{{^required?}} = {{>initializeDefaultValue}}{{/required?}}{{#@join}}, {{/@join}}'
- joinedParamDef: '{{>maybeCrefType}} {{paramName}}{{#@join}}, {{/@join}}'
- passQueryParams: '{{#queryParams}}{{paramName}}{{#@join}}, {{/@join}}{{/queryParams}}'
+ joinedParamDecl: '{{>maybeCrefType}} {{paramName}}{{^required?}} = {{>initializeDefaultValue}}{{/required?}}{{>join,}}'
+ joinedParamDef: '{{>maybeCrefType}} {{paramName}}{{>join,}}'
+ passQueryParams: '{{#queryParams}}{{paramName}}{{>join,}}{{/queryParams}}'
# preamble: preamble.mustache
copyrightName: Kitsune Ral
copyrightEmail: <kitsune-ral@users.sf.net>
diff --git a/lib/csapi/{{base}}.cpp.mustache b/lib/csapi/{{base}}.cpp.mustache
index 0800fef7..4526bc79 100644
--- a/lib/csapi/{{base}}.cpp.mustache
+++ b/lib/csapi/{{base}}.cpp.mustache
@@ -89,7 +89,7 @@ QUrl {{camelCaseOperationId}}Job::makeRequestUrl(QUrl baseUrl{{#allParams?}}, {{
}}{{^inlineBody}} QJsonObject _data;{{#bodyParams}}
addParam<{{^required?}}IfNotEmpty{{/required?}}>(_data, "{{baseName}}", {{paramName}});{{/bodyParams}}
setRequestData(_data);{{/inlineBody}}
-{{/bodyParams?}}{{#producesNonJson?}} setExpectedContentTypes({ {{#produces}}"{{_}}"{{#@join}}, {{/@join}}{{/produces}} });
+{{/bodyParams?}}{{#producesNonJson?}} setExpectedContentTypes({ {{#produces}}"{{_}}"{{#@join,}}{{/produces}} });
{{/producesNonJson?}}}{{!<- mind the actual brace}}
{{# responses}}{{#normalResponse?}}{{#allProperties?}}
{{camelCaseOperationId}}Job::~{{camelCaseOperationId}}Job() = default;
diff --git a/lib/csapi/{{base}}.h.mustache b/lib/csapi/{{base}}.h.mustache
index 80d8bbac..23d001cb 100644
--- a/lib/csapi/{{base}}.h.mustache
+++ b/lib/csapi/{{base}}.h.mustache
@@ -11,7 +11,7 @@ namespace QMatrixClient
{
{{#models}} // Data structures
{{# model}}
- struct {{name}}{{#parents?}} : {{#parents}}{{name}}{{#@join}}, {{/@join}}{{/parents}}{{/parents?}}
+ struct {{name}}{{#parents?}} : {{#parents}}{{name}}{{>join,}}{{/parents}}{{/parents?}}
{
{{#vars}} {{>maybeOmittableType}} {{nameCamelCase}};
{{/vars}} };
@@ -30,7 +30,7 @@ namespace QMatrixClient
public:{{#models}}
// Inner data structures
{{# model}}
- struct {{name}}{{#parents?}} : {{#parents}}{{name}}{{#@join}}, {{/@join}}{{/parents}}{{/parents?}}
+ struct {{name}}{{#parents?}} : {{#parents}}{{name}}{{>join,}}{{/parents}}{{/parents?}}
{
{{#vars}} {{>maybeOmittableType}} {{nameCamelCase}};
{{/vars}} };