diff options
Diffstat (limited to 'lib/csapi')
-rw-r--r-- | lib/csapi/gtad.yaml | 18 | ||||
-rw-r--r-- | lib/csapi/{{base}}.cpp.mustache | 8 | ||||
-rw-r--r-- | lib/csapi/{{base}}.h.mustache | 2 |
3 files changed, 14 insertions, 14 deletions
diff --git a/lib/csapi/gtad.yaml b/lib/csapi/gtad.yaml index 6f9750d0..d1bee0e6 100644 --- a/lib/csapi/gtad.yaml +++ b/lib/csapi/gtad.yaml @@ -40,7 +40,7 @@ analyzer: type: QIODevice* imports: <QtCore/QIODevice> - binary: *ByteStream - - +set: { "avoidCopy?": true } + - +set: { avoidCopy: } +on: - date: type: QDate @@ -53,14 +53,14 @@ analyzer: - //: type: QString initializer: QStringLiteral("{{defaultValue}}") - string?: true + isString: - file: *ByteStream - - +set: { "avoidCopy?": true } + - +set: { avoidCopy: } +on: - object: { type: QJsonObject, imports: <QtCore/QJsonObject> } - $ref: - /m\.room\.member$/: pass # This $ref is only used in an array, see below - - +set: { "noCopy?": true } + - +set: { moveOnly: } +on: - /state_event.yaml$/: { type: StateEventPtr, imports: '"events/event.h"' } @@ -70,7 +70,7 @@ analyzer: { type: EventPtr, imports: '"events/event.h"' } - array: - string: { type: QStringList, imports: <QtCore/QStringList> } - - +set: { "noCopy?": true} + - +set: { moveOnly: } +on: - /^Notification|Result$/: type: "std::vector<{{1}}>" @@ -90,7 +90,7 @@ analyzer: - map: - RoomState: type: "std::unordered_map<QString, {{1}}>" - noCopy?: true + moveOnly: imports: <unordered_map> - /.+/: type: "QHash<QString, {{1}}>" @@ -114,14 +114,14 @@ mustache: closeOmittable: "{{^required?}}{{#useOmittable}}>{{/useOmittable}}{{/required?}}" maybeOmittableType: "{{>openOmittable}}{{dataType.name}}{{>closeOmittable}}" qualifiedMaybeOmittableType: "{{>openOmittable}}{{dataType.qualifiedName}}{{>closeOmittable}}" - maybeCrefType: "{{#avoidCopy?}}const {{/avoidCopy?}}{{>maybeOmittableType}}{{#avoidCopy?}}&{{/avoidCopy?}}{{#noCopy?}}&&{{/noCopy?}}" + maybeCrefType: "{{#avoidCopy}}const {{/avoidCopy}}{{>maybeOmittableType}}{{#avoidCopy}}&{{/avoidCopy}}{{#moveOnly}}&&{{/moveOnly}}" qualifiedMaybeCrefType: - "{{#avoidCopy?}}const {{/avoidCopy?}}{{>qualifiedMaybeOmittableType}}{{#avoidCopy?}}&{{/avoidCopy?}}{{#noCopy?}}&&{{/noCopy?}}" + "{{#avoidCopy}}const {{/avoidCopy}}{{>qualifiedMaybeOmittableType}}{{#avoidCopy}}&{{/avoidCopy}}{{#moveOnly}}&&{{/moveOnly}}" initializeDefaultValue: "{{#defaultValue}}{{#initializer}}{{>initializer}}{{/initializer}}{{/defaultValue}}{{^defaultValue}}{{>omittedValue}}{{/defaultValue}}" joinedParamDecl: '{{>maybeCrefType}} {{paramName}}{{^required?}} = {{>initializeDefaultValue}}{{/required?}}{{#@join}}, {{/@join}}' joinedParamDef: '{{>maybeCrefType}} {{paramName}}{{#@join}}, {{/@join}}' passQueryParams: '{{#queryParams}}{{paramName}}{{#@join}}, {{/@join}}{{/queryParams}}' - paramToString: '{{#string?}}{{nameCamelCase}}{{/string?}}{{^string?}}QString("%1").arg({{nameCamelCase}}){{/string?}}' + paramToString: '{{#isString}}{{nameCamelCase}}{{/isString}}{{^isString}}QString("%1").arg({{nameCamelCase}}){{/isString}}' # 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 4abe38eb..f555761f 100644 --- a/lib/csapi/{{base}}.cpp.mustache +++ b/lib/csapi/{{base}}.cpp.mustache @@ -61,8 +61,8 @@ class {{camelCaseOperationId}}Job::Private BaseJob::Query queryTo{{camelCaseOperationId}}({{#queryParams}}{{>joinedParamDef}}{{/queryParams}}) { BaseJob::Query _q;{{#queryParams}} -{{^required?}}{{#string?}} if (!{{nameCamelCase}}.isEmpty()) - {{/string?}}{{/required?}} _q.addQueryItem("{{baseName}}", {{>paramToString}});{{/queryParams}} +{{^required?}}{{#isString}} if (!{{nameCamelCase}}.isEmpty()) + {{/isString}}{{/required?}} _q.addQueryItem("{{baseName}}", {{>paramToString}});{{/queryParams}} return _q; } {{/queryParams?}}{{^bodyParams}} @@ -95,9 +95,9 @@ QUrl {{camelCaseOperationId}}Job::makeRequestUrl(QUrl baseUrl{{#allParams?}}, {{ {{# responses}}{{#normalResponse?}}{{#allProperties?}} {{camelCaseOperationId}}Job::~{{camelCaseOperationId}}Job() = default; {{# allProperties}} -{{>qualifiedMaybeCrefType}} {{camelCaseOperationId}}Job::{{paramName}}(){{^noCopy?}} const{{/noCopy?}} +{{>qualifiedMaybeCrefType}} {{camelCaseOperationId}}Job::{{paramName}}(){{^moveOnly}} const{{/moveOnly}} { - return {{#noCopy?}}std::move({{/noCopy?}}d->{{paramName}}{{#noCopy?}}){{/noCopy?}}; + return {{#moveOnly}}std::move({{/moveOnly}}d->{{paramName}}{{#moveOnly}}){{/moveOnly}}; } {{/ allProperties}}{{#producesNonJson?}} BaseJob::Status {{camelCaseOperationId}}Job::parseReply(QNetworkReply* reply) diff --git a/lib/csapi/{{base}}.h.mustache b/lib/csapi/{{base}}.h.mustache index 1d24163f..80d8bbac 100644 --- a/lib/csapi/{{base}}.h.mustache +++ b/lib/csapi/{{base}}.h.mustache @@ -50,7 +50,7 @@ namespace QMatrixClient // Result properties {{#allProperties}} - {{>maybeCrefType}} {{paramName}}(){{^noCopy?}} const{{/noCopy?}};{{/allProperties}} + {{>maybeCrefType}} {{paramName}}(){{^moveOnly}} const{{/moveOnly}};{{/allProperties}} protected: Status {{#producesNonJson?}}parseReply(QNetworkReply* reply){{/producesNonJson?}}{{^producesNonJson?}}parseJson(const QJsonDocument& data){{/producesNonJson?}} override; |