aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/gtad.yaml
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-06-23 19:50:09 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-06-23 19:50:09 +0900
commite083d327e6f6581210f8d077d8bbe1151e81e82c (patch)
treec9c925d9fed25cd138852340213c4be33b97f771 /lib/csapi/gtad.yaml
parent30004700fbfe84a51a651174105c5ae4391db159 (diff)
downloadlibquotient-e083d327e6f6581210f8d077d8bbe1151e81e82c.tar.gz
libquotient-e083d327e6f6581210f8d077d8bbe1151e81e82c.zip
csapi/: Make Mustache files more readable
Now that clang-format takes care of formatting, the template readability can be prioritised.
Diffstat (limited to 'lib/csapi/gtad.yaml')
-rw-r--r--lib/csapi/gtad.yaml12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/csapi/gtad.yaml b/lib/csapi/gtad.yaml
index a44f803a..301ee0b6 100644
--- a/lib/csapi/gtad.yaml
+++ b/lib/csapi/gtad.yaml
@@ -118,24 +118,32 @@ mustache:
# _rightQuote: '"'
# _joinChar: ',' # The character used by {{_join}} - not working yet
_comment: '//'
+ copyrightName: Kitsune Ral
+ copyrightEmail: <kitsune-ral@users.sf.net>
+
partials:
_typeRenderer: "{{#scope}}{{scopeCamelCase}}Job::{{/scope}}{{>name}}"
omittedValue: '{}' # default value to initialize omitted parameters with
initializer: '{{defaultValue}}'
cjoin: '{{#hasMore}}, {{/hasMore}}'
+
openOmittable: "{{^required?}}{{#useOmittable}}{{^defaultValue}}Omittable<{{/defaultValue}}{{/useOmittable}}{{/required?}}"
closeOmittable: "{{^required?}}{{#useOmittable}}{{^defaultValue}}>{{/defaultValue}}{{/useOmittable}}{{/required?}}"
+
maybeOmittableType: "{{>openOmittable}}{{dataType.name}}{{>closeOmittable}}"
qualifiedMaybeOmittableType: "{{>openOmittable}}{{dataType.qualifiedName}}{{>closeOmittable}}"
+
maybeCrefType: "{{#avoidCopy}}const {{/avoidCopy}}{{>maybeOmittableType}}{{#avoidCopy}}&{{/avoidCopy}}{{#moveOnly}}&&{{/moveOnly}}"
qualifiedMaybeCrefType:
"{{#avoidCopy}}const {{/avoidCopy}}{{>qualifiedMaybeOmittableType}}{{#avoidCopy}}&{{/avoidCopy}}{{#moveOnly}}&&{{/moveOnly}}"
+
+ maybeCrefJsonObject: "{{^propertyMap}}const QJsonObject&{{/propertyMap}}{{#propertyMap}}QJsonObject{{/propertyMap}}"
+ takeOrValue: "{{#propertyMap}}take{{/propertyMap}}{{^propertyMap}}value{{/propertyMap}}"
+
initializeDefaultValue: "{{#defaultValue}}{{>initializer}}{{/defaultValue}}{{^defaultValue}}{{>omittedValue}}{{/defaultValue}}"
joinedParamDecl: '{{>maybeCrefType}} {{paramName}}{{^required?}} = {{>initializeDefaultValue}}{{/required?}}{{>cjoin}}'
joinedParamDef: '{{>maybeCrefType}} {{paramName}}{{>cjoin}}'
passQueryParams: '{{#queryParams}}{{paramName}}{{>cjoin}}{{/queryParams}}'
- copyrightName: Kitsune Ral
- copyrightEmail: <kitsune-ral@users.sf.net>
templates:
- "{{base}}.h.mustache"