From 93cb0e5897cc94d8cc691bbe62f5b0093dd0a00f Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Tue, 9 Jan 2018 10:57:03 +0900 Subject: Job template: Use QIODevice instead of QByteArray to store byte streams This allows smooth pipelining of files to and from the network. --- jobs/gtad.yaml | 17 +++++++---------- jobs/{{base}}.cpp.mustache | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'jobs') diff --git a/jobs/gtad.yaml b/jobs/gtad.yaml index 54f70cdb..f79ce9b6 100644 --- a/jobs/gtad.yaml +++ b/jobs/gtad.yaml @@ -27,12 +27,12 @@ types: - //: double boolean: bool string: - - byte: &QByteArray - type: QByteArray - initializer: '"{{defaultValue}}"' - string?: true - imports: - - binary: *QByteArray + - byte: &ByteStream + type: QIODevice* + #initializer: '"{{defaultValue}}"' + #string?: true + imports: + - binary: *ByteStream - date: type: QDate initializer: QDate::fromString("{{defaultValue}}") @@ -48,10 +48,7 @@ types: initializer: QStringLiteral("{{defaultValue}}") string?: true avoidCopy?: true - imports: - file: - type: QByteArray - imports: + file: *ByteStream object: type: QJsonObject avoidCopy?: true diff --git a/jobs/{{base}}.cpp.mustache b/jobs/{{base}}.cpp.mustache index 0726d523..34e7faf3 100644 --- a/jobs/{{base}}.cpp.mustache +++ b/jobs/{{base}}.cpp.mustache @@ -88,7 +88,7 @@ class {{camelCaseOperationId}}Job::Private BaseJob::Status {{camelCaseOperationId}}Job::parseReply(QNetworkReply* reply) { {{#headers}}d->{{paramName}} = reply->rawHeader("{{baseName}}"); {{! We don't check for required headers yet }} - {{/headers}}{{#properties}}d->{{paramName}} = reply->readAll();{{/properties}} + {{/headers}}{{#properties}}d->{{paramName}} = reply;{{/properties}} return Success; }{{/ producesNotJson?}}{{^producesNotJson?}} BaseJob::Status {{camelCaseOperationId}}Job::parseJson(const QJsonDocument& data) -- cgit v1.2.3