From df5050f3b0a2dde6aff9d5d1bd8a9601fc26ae18 Mon Sep 17 00:00:00 2001 From: Martin Delille Date: Thu, 18 Feb 2021 04:54:10 +0100 Subject: [PATCH] [cpp-qt5-client] Fix qt5.15 check (#8711) * Fix qt5.15 check * Fix check fix --- .../resources/cpp-qt5-client/HttpFileElement.cpp.mustache | 8 ++++---- .../resources/cpp-qt5-client/HttpRequest.cpp.mustache | 8 ++++---- .../main/resources/cpp-qt5-client/HttpRequest.h.mustache | 4 ++-- .../client/petstore/cpp-qt5/client/PFXHttpFileElement.cpp | 8 ++++---- samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp | 8 ++++---- samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h | 4 ++-- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpFileElement.cpp.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpFileElement.cpp.mustache index 4163b8be316a..a1348541e918 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpFileElement.cpp.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpFileElement.cpp.mustache @@ -57,13 +57,13 @@ QJsonValue {{prefix}}HttpFileElement::asJsonValue() const { if (!result) { qDebug() << "Error opening file " << local_filename; } -#if QT_VERSION >= 0x051500 +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) return QJsonDocument::fromJson(bArray.data()).object(); #else - return QJsonDocument::fromBinaryData(bArray.data()).object(); + return QJsonDocument::fromBinaryData(bArray.data()).object(); #endif } - + bool {{prefix}}HttpFileElement::fromStringValue(const QString &instr) { QFile file(local_filename); bool result = false; @@ -86,7 +86,7 @@ bool {{prefix}}HttpFileElement::fromJsonValue(const QJsonValue &jval) { file.remove(); } result = file.open(QIODevice::WriteOnly); -#if QT_VERSION >= 0x051500 +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) file.write(QJsonDocument(jval.toObject()).toJson()); #else file.write(QJsonDocument(jval.toObject()).toBinaryData()); diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache index 4ce0cfb2d6d4..4c4cbbb6648b 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache @@ -7,7 +7,7 @@ #include #include #include -#if QT_VERSION >= 0x051500 +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) #define SKIP_EMPTY_PARTS Qt::SkipEmptyParts #else #define SKIP_EMPTY_PARTS QString::SkipEmptyParts @@ -52,7 +52,7 @@ void {{prefix}}HttpRequestInput::add_file(QString variable_name, QString local_f {{prefix}}HttpRequestWorker::{{prefix}}HttpRequestWorker(QObject *parent, QNetworkAccessManager *_manager) : QObject(parent), manager(_manager), timeOutTimer(this), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false), httpResponseCode(-1) { -#if QT_VERSION >= 0x051500 +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) randomGenerator = QRandomGenerator(QDateTime::currentDateTime().toSecsSinceEpoch()); #else qsrand(QDateTime::currentDateTime().toTime_t()); @@ -216,7 +216,7 @@ void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) { // variable layout is MULTIPART boundary = QString("__-----------------------%1%2") - #if QT_VERSION >= 0x051500 + #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) .arg(QDateTime::currentDateTime().toSecsSinceEpoch()) .arg(randomGenerator.generate()); #else @@ -546,7 +546,7 @@ QByteArray {{prefix}}HttpRequestWorker::compress(const QByteArray& input, int le return output;{{/contentCompression}}{{^contentCompression}} Q_UNUSED(input); Q_UNUSED(level); - Q_UNUSED(compressType); + Q_UNUSED(compressType); return QByteArray();{{/contentCompression}} } diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.h.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.h.mustache index a853306225d6..b9dec34915ef 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.h.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.h.mustache @@ -14,7 +14,7 @@ #include #include #include -#if QT_VERSION >= 0x051500 +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) #include #endif @@ -89,7 +89,7 @@ private: bool isResponseCompressionEnabled; bool isRequestCompressionEnabled; int httpResponseCode; -#if QT_VERSION >= 0x051500 +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) QRandomGenerator randomGenerator; #endif diff --git a/samples/client/petstore/cpp-qt5/client/PFXHttpFileElement.cpp b/samples/client/petstore/cpp-qt5/client/PFXHttpFileElement.cpp index 3bf0e7998540..60c6818c38b4 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXHttpFileElement.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXHttpFileElement.cpp @@ -65,13 +65,13 @@ QJsonValue PFXHttpFileElement::asJsonValue() const { if (!result) { qDebug() << "Error opening file " << local_filename; } -#if QT_VERSION >= 0x051500 +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) return QJsonDocument::fromJson(bArray.data()).object(); #else - return QJsonDocument::fromBinaryData(bArray.data()).object(); + return QJsonDocument::fromBinaryData(bArray.data()).object(); #endif } - + bool PFXHttpFileElement::fromStringValue(const QString &instr) { QFile file(local_filename); bool result = false; @@ -94,7 +94,7 @@ bool PFXHttpFileElement::fromJsonValue(const QJsonValue &jval) { file.remove(); } result = file.open(QIODevice::WriteOnly); -#if QT_VERSION >= 0x051500 +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) file.write(QJsonDocument(jval.toObject()).toJson()); #else file.write(QJsonDocument(jval.toObject()).toBinaryData()); diff --git a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp index e81f8b4e1ccc..ba022c02b91d 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp +++ b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.cpp @@ -17,7 +17,7 @@ #include #include #include -#if QT_VERSION >= 0x051500 +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) #define SKIP_EMPTY_PARTS Qt::SkipEmptyParts #else #define SKIP_EMPTY_PARTS QString::SkipEmptyParts @@ -59,7 +59,7 @@ void PFXHttpRequestInput::add_file(QString variable_name, QString local_filename PFXHttpRequestWorker::PFXHttpRequestWorker(QObject *parent, QNetworkAccessManager *_manager) : QObject(parent), manager(_manager), timeOutTimer(this), isResponseCompressionEnabled(false), isRequestCompressionEnabled(false), httpResponseCode(-1) { -#if QT_VERSION >= 0x051500 +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) randomGenerator = QRandomGenerator(QDateTime::currentDateTime().toSecsSinceEpoch()); #else qsrand(QDateTime::currentDateTime().toTime_t()); @@ -223,7 +223,7 @@ void PFXHttpRequestWorker::execute(PFXHttpRequestInput *input) { // variable layout is MULTIPART boundary = QString("__-----------------------%1%2") - #if QT_VERSION >= 0x051500 + #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) .arg(QDateTime::currentDateTime().toSecsSinceEpoch()) .arg(randomGenerator.generate()); #else @@ -480,7 +480,7 @@ QByteArray PFXHttpRequestWorker::compress(const QByteArray& input, int level, PF Q_UNUSED(input); Q_UNUSED(level); - Q_UNUSED(compressType); + Q_UNUSED(compressType); return QByteArray(); } diff --git a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h index cea7d43168c4..022d97adcb6a 100644 --- a/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h +++ b/samples/client/petstore/cpp-qt5/client/PFXHttpRequest.h @@ -24,7 +24,7 @@ #include #include #include -#if QT_VERSION >= 0x051500 +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) #include #endif @@ -97,7 +97,7 @@ private: bool isResponseCompressionEnabled; bool isRequestCompressionEnabled; int httpResponseCode; -#if QT_VERSION >= 0x051500 +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) QRandomGenerator randomGenerator; #endif