From ad3394a53cf2ea60913be8bfc7b2a1f9918c8ffb Mon Sep 17 00:00:00 2001 From: Martin Delille Date: Mon, 15 Jul 2024 12:28:57 +0200 Subject: [PATCH] [qt-cpp] Remove Qt support before Qt 5.15.2 --- .../HttpFileElement.cpp.mustache | 8 --- .../cpp-qt-client/HttpRequest.cpp.mustache | 18 +++--- .../cpp-qt-client/HttpRequest.h.mustache | 6 +- .../resources/cpp-qt-client/api-body.mustache | 12 ---- .../cpp-qt/client/PFXHttpFileElement.cpp | 8 --- .../petstore/cpp-qt/client/PFXHttpRequest.cpp | 18 +++--- .../petstore/cpp-qt/client/PFXHttpRequest.h | 6 +- .../petstore/cpp-qt/client/PFXPetApi.cpp | 60 ------------------- .../cpp-qt/client/PFXPrimitivesApi.cpp | 18 ------ .../petstore/cpp-qt/client/PFXStoreApi.cpp | 30 ---------- .../petstore/cpp-qt/client/PFXUserApi.cpp | 54 ----------------- 11 files changed, 16 insertions(+), 222 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/cpp-qt-client/HttpFileElement.cpp.mustache b/modules/openapi-generator/src/main/resources/cpp-qt-client/HttpFileElement.cpp.mustache index a1348541e918..a3aac7067f6e 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt-client/HttpFileElement.cpp.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt-client/HttpFileElement.cpp.mustache @@ -57,11 +57,7 @@ QJsonValue {{prefix}}HttpFileElement::asJsonValue() const { if (!result) { qDebug() << "Error opening file " << local_filename; } -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) return QJsonDocument::fromJson(bArray.data()).object(); -#else - return QJsonDocument::fromBinaryData(bArray.data()).object(); -#endif } bool {{prefix}}HttpFileElement::fromStringValue(const QString &instr) { @@ -86,11 +82,7 @@ bool {{prefix}}HttpFileElement::fromJsonValue(const QJsonValue &jval) { file.remove(); } result = file.open(QIODevice::WriteOnly); -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) file.write(QJsonDocument(jval.toObject()).toJson()); -#else - file.write(QJsonDocument(jval.toObject()).toBinaryData()); -#endif file.close(); if (!result) { qDebug() << "Error creating file " << local_filename; diff --git a/modules/openapi-generator/src/main/resources/cpp-qt-client/HttpRequest.cpp.mustache b/modules/openapi-generator/src/main/resources/cpp-qt-client/HttpRequest.cpp.mustache index a241ce842c3e..d5aa5f863e63 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt-client/HttpRequest.cpp.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt-client/HttpRequest.cpp.mustache @@ -7,11 +7,7 @@ #include #include #include -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - #define SKIP_EMPTY_PARTS Qt::SkipEmptyParts -#else - #define SKIP_EMPTY_PARTS QString::SkipEmptyParts -#endif{{#contentCompression}} +{{#contentCompression}} #include {{/contentCompression}} #include "{{prefix}}HttpRequest.h" @@ -440,14 +436,14 @@ void {{prefix}}HttpRequestWorker::process_response(QNetworkReply *reply) { } if (!contentDispositionHdr.isEmpty()) { - auto contentDisposition = contentDispositionHdr.split(QString(";"), SKIP_EMPTY_PARTS); + auto contentDisposition = contentDispositionHdr.split(QString(";"), Qt::SkipEmptyParts); auto contentType = - !contentTypeHdr.isEmpty() ? contentTypeHdr.split(QString(";"), SKIP_EMPTY_PARTS).first() : QString(); + !contentTypeHdr.isEmpty() ? contentTypeHdr.split(QString(";"), Qt::SkipEmptyParts).first() : QString(); if ((contentDisposition.count() > 0) && (contentDisposition.first() == QString("attachment"))) { QString filename = QUuid::createUuid().toString(); for (const auto &file : contentDisposition) { if (file.contains(QString("filename"))) { - filename = file.split(QString("="), SKIP_EMPTY_PARTS).at(1); + filename = file.split(QString("="), Qt::SkipEmptyParts).at(1); break; } } @@ -457,14 +453,14 @@ void {{prefix}}HttpRequestWorker::process_response(QNetworkReply *reply) { } } else if (!contentTypeHdr.isEmpty()) { - auto contentType = contentTypeHdr.split(QString(";"), SKIP_EMPTY_PARTS); + auto contentType = contentTypeHdr.split(QString(";"), Qt::SkipEmptyParts); if ((contentType.count() > 0) && (contentType.first() == QString("multipart/form-data"))) { // TODO : Handle Multipart responses } else { if(!contentEncodingHdr.isEmpty()){ - auto encoding = contentEncodingHdr.split(QString(";"), SKIP_EMPTY_PARTS); + auto encoding = contentEncodingHdr.split(QString(";"), Qt::SkipEmptyParts); if(encoding.count() > 0){ - auto compressionTypes = encoding.first().split(',', SKIP_EMPTY_PARTS); + auto compressionTypes = encoding.first().split(',', Qt::SkipEmptyParts); if(compressionTypes.contains("gzip", Qt::CaseInsensitive) || compressionTypes.contains("deflate", Qt::CaseInsensitive)){ response = decompress(reply->readAll()); } else if(compressionTypes.contains("identity", Qt::CaseInsensitive)){ diff --git a/modules/openapi-generator/src/main/resources/cpp-qt-client/HttpRequest.h.mustache b/modules/openapi-generator/src/main/resources/cpp-qt-client/HttpRequest.h.mustache index 84220c68db19..660ef7590503 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt-client/HttpRequest.h.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt-client/HttpRequest.h.mustache @@ -14,9 +14,7 @@ #include #include #include -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - #include -#endif +#include #include "{{prefix}}HttpFileElement.h" @@ -89,9 +87,7 @@ private: bool isResponseCompressionEnabled; bool isRequestCompressionEnabled; int httpResponseCode; -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) QRandomGenerator randomGenerator; -#endif void on_reply_timeout(QNetworkReply *reply); void on_reply_finished(QNetworkReply *reply); diff --git a/modules/openapi-generator/src/main/resources/cpp-qt-client/api-body.mustache b/modules/openapi-generator/src/main/resources/cpp-qt-client/api-body.mustache index a53db5ba8c37..56e90e5c4799 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt-client/api-body.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt-client/api-body.mustache @@ -129,15 +129,9 @@ int {{classname}}::addServerConfiguration(const QString &operation, const QUrl & * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void {{classname}}::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } -#else - for (auto &e : _serverIndices.keys()) { - setServerIndex(e, addServerConfiguration(e, url, description, variables)); - } -#endif } /** @@ -662,15 +656,9 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}} } } {{/cookieParams}} -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &{{prefix}}HttpRequestWorker::on_execution_finished, this, &{{classname}}::{{nickname}}Callback); connect(this, &{{classname}}::abortRequestsSignal, worker, &QObject::deleteLater); diff --git a/samples/client/petstore/cpp-qt/client/PFXHttpFileElement.cpp b/samples/client/petstore/cpp-qt/client/PFXHttpFileElement.cpp index 60c6818c38b4..088836d16c74 100644 --- a/samples/client/petstore/cpp-qt/client/PFXHttpFileElement.cpp +++ b/samples/client/petstore/cpp-qt/client/PFXHttpFileElement.cpp @@ -65,11 +65,7 @@ QJsonValue PFXHttpFileElement::asJsonValue() const { if (!result) { qDebug() << "Error opening file " << local_filename; } -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) return QJsonDocument::fromJson(bArray.data()).object(); -#else - return QJsonDocument::fromBinaryData(bArray.data()).object(); -#endif } bool PFXHttpFileElement::fromStringValue(const QString &instr) { @@ -94,11 +90,7 @@ bool PFXHttpFileElement::fromJsonValue(const QJsonValue &jval) { file.remove(); } result = file.open(QIODevice::WriteOnly); -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) file.write(QJsonDocument(jval.toObject()).toJson()); -#else - file.write(QJsonDocument(jval.toObject()).toBinaryData()); -#endif file.close(); if (!result) { qDebug() << "Error creating file " << local_filename; diff --git a/samples/client/petstore/cpp-qt/client/PFXHttpRequest.cpp b/samples/client/petstore/cpp-qt/client/PFXHttpRequest.cpp index 4664b9a399b6..40d869cfaf6a 100644 --- a/samples/client/petstore/cpp-qt/client/PFXHttpRequest.cpp +++ b/samples/client/petstore/cpp-qt/client/PFXHttpRequest.cpp @@ -17,11 +17,7 @@ #include #include #include -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - #define SKIP_EMPTY_PARTS Qt::SkipEmptyParts -#else - #define SKIP_EMPTY_PARTS QString::SkipEmptyParts -#endif + #include "PFXHttpRequest.h" @@ -447,14 +443,14 @@ void PFXHttpRequestWorker::process_response(QNetworkReply *reply) { } if (!contentDispositionHdr.isEmpty()) { - auto contentDisposition = contentDispositionHdr.split(QString(";"), SKIP_EMPTY_PARTS); + auto contentDisposition = contentDispositionHdr.split(QString(";"), Qt::SkipEmptyParts); auto contentType = - !contentTypeHdr.isEmpty() ? contentTypeHdr.split(QString(";"), SKIP_EMPTY_PARTS).first() : QString(); + !contentTypeHdr.isEmpty() ? contentTypeHdr.split(QString(";"), Qt::SkipEmptyParts).first() : QString(); if ((contentDisposition.count() > 0) && (contentDisposition.first() == QString("attachment"))) { QString filename = QUuid::createUuid().toString(); for (const auto &file : contentDisposition) { if (file.contains(QString("filename"))) { - filename = file.split(QString("="), SKIP_EMPTY_PARTS).at(1); + filename = file.split(QString("="), Qt::SkipEmptyParts).at(1); break; } } @@ -464,14 +460,14 @@ void PFXHttpRequestWorker::process_response(QNetworkReply *reply) { } } else if (!contentTypeHdr.isEmpty()) { - auto contentType = contentTypeHdr.split(QString(";"), SKIP_EMPTY_PARTS); + auto contentType = contentTypeHdr.split(QString(";"), Qt::SkipEmptyParts); if ((contentType.count() > 0) && (contentType.first() == QString("multipart/form-data"))) { // TODO : Handle Multipart responses } else { if(!contentEncodingHdr.isEmpty()){ - auto encoding = contentEncodingHdr.split(QString(";"), SKIP_EMPTY_PARTS); + auto encoding = contentEncodingHdr.split(QString(";"), Qt::SkipEmptyParts); if(encoding.count() > 0){ - auto compressionTypes = encoding.first().split(',', SKIP_EMPTY_PARTS); + auto compressionTypes = encoding.first().split(',', Qt::SkipEmptyParts); if(compressionTypes.contains("gzip", Qt::CaseInsensitive) || compressionTypes.contains("deflate", Qt::CaseInsensitive)){ response = decompress(reply->readAll()); } else if(compressionTypes.contains("identity", Qt::CaseInsensitive)){ diff --git a/samples/client/petstore/cpp-qt/client/PFXHttpRequest.h b/samples/client/petstore/cpp-qt/client/PFXHttpRequest.h index 31e2ec823af2..8d9656ed8675 100644 --- a/samples/client/petstore/cpp-qt/client/PFXHttpRequest.h +++ b/samples/client/petstore/cpp-qt/client/PFXHttpRequest.h @@ -24,9 +24,7 @@ #include #include #include -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - #include -#endif +#include #include "PFXHttpFileElement.h" @@ -97,9 +95,7 @@ class PFXHttpRequestWorker : public QObject { bool isResponseCompressionEnabled; bool isRequestCompressionEnabled; int httpResponseCode; -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) QRandomGenerator randomGenerator; -#endif void on_reply_timeout(QNetworkReply *reply); void on_reply_finished(QNetworkReply *reply); diff --git a/samples/client/petstore/cpp-qt/client/PFXPetApi.cpp b/samples/client/petstore/cpp-qt/client/PFXPetApi.cpp index 3aad8a2e9e3f..298c9458a8e7 100644 --- a/samples/client/petstore/cpp-qt/client/PFXPetApi.cpp +++ b/samples/client/petstore/cpp-qt/client/PFXPetApi.cpp @@ -128,15 +128,9 @@ int PFXPetApi::addServerConfiguration(const QString &operation, const QUrl &url, * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void PFXPetApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } -#else - for (auto &e : _serverIndices.keys()) { - setServerIndex(e, addServerConfiguration(e, url, description, variables)); - } -#endif } /** @@ -242,15 +236,9 @@ void PFXPetApi::addPet(const PFXPet &pfx_pet) { QByteArray output = pfx_pet.asJson().toUtf8(); input.request_body.append(output); } -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::addPetCallback); connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater); @@ -356,15 +344,9 @@ void PFXPetApi::allPets() { PFXHttpRequestInput input(fullPath, "GET"); -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::allPetsCallback); connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater); @@ -460,15 +442,9 @@ void PFXPetApi::deletePet(const qint64 &pet_id, const ::test_namespace::Optional input.headers.insert("api_key", ::test_namespace::toStringValue(api_key.value())); } } -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::deletePetCallback); connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater); @@ -660,15 +636,9 @@ void PFXPetApi::findPetsByStatus(const QList &status) { PFXHttpRequestInput input(fullPath, "GET"); -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::findPetsByStatusCallback); connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater); @@ -870,15 +840,9 @@ void PFXPetApi::findPetsByTags(const QList &tags) { PFXHttpRequestInput input(fullPath, "GET"); -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::findPetsByTagsCallback); connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater); @@ -1012,15 +976,9 @@ void PFXPetApi::getPetById(const qint64 &pet_id) { PFXHttpRequestInput input(fullPath, "GET"); -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::getPetByIdCallback); connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater); @@ -1092,15 +1050,9 @@ void PFXPetApi::updatePet(const PFXPet &pfx_pet) { QByteArray output = pfx_pet.asJson().toUtf8(); input.request_body.append(output); } -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::updatePetCallback); connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater); @@ -1228,15 +1180,9 @@ void PFXPetApi::updatePetWithForm(const qint64 &pet_id, const ::test_namespace:: input.add_var("status", ::test_namespace::toStringValue(status.value())); } -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::updatePetWithFormCallback); connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater); @@ -1364,15 +1310,9 @@ void PFXPetApi::uploadFile(const qint64 &pet_id, const ::test_namespace::Optiona input.add_file("file", file.value().local_filename, file.value().request_filename, file.value().mime_type); } -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::uploadFileCallback); connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater); diff --git a/samples/client/petstore/cpp-qt/client/PFXPrimitivesApi.cpp b/samples/client/petstore/cpp-qt/client/PFXPrimitivesApi.cpp index 6badeb2c05f7..143ad71ca044 100644 --- a/samples/client/petstore/cpp-qt/client/PFXPrimitivesApi.cpp +++ b/samples/client/petstore/cpp-qt/client/PFXPrimitivesApi.cpp @@ -114,15 +114,9 @@ int PFXPrimitivesApi::addServerConfiguration(const QString &operation, const QUr * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void PFXPrimitivesApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } -#else - for (auto &e : _serverIndices.keys()) { - setServerIndex(e, addServerConfiguration(e, url, description, variables)); - } -#endif } /** @@ -227,15 +221,9 @@ void PFXPrimitivesApi::primitivesIntegerPost(const ::test_namespace::OptionalPar QByteArray output = QByteArray::number(body.value()); input.request_body.append(output); } -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPrimitivesApi::primitivesIntegerPostCallback); connect(this, &PFXPrimitivesApi::abortRequestsSignal, worker, &QObject::deleteLater); @@ -305,15 +293,9 @@ void PFXPrimitivesApi::primitivesNumberPut(const ::test_namespace::OptionalParam QByteArray output = QByteArray::number(body.value()); input.request_body.append(output); } -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPrimitivesApi::primitivesNumberPutCallback); connect(this, &PFXPrimitivesApi::abortRequestsSignal, worker, &QObject::deleteLater); diff --git a/samples/client/petstore/cpp-qt/client/PFXStoreApi.cpp b/samples/client/petstore/cpp-qt/client/PFXStoreApi.cpp index af5cdb421e01..646715359362 100644 --- a/samples/client/petstore/cpp-qt/client/PFXStoreApi.cpp +++ b/samples/client/petstore/cpp-qt/client/PFXStoreApi.cpp @@ -118,15 +118,9 @@ int PFXStoreApi::addServerConfiguration(const QString &operation, const QUrl &ur * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void PFXStoreApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } -#else - for (auto &e : _serverIndices.keys()) { - setServerIndex(e, addServerConfiguration(e, url, description, variables)); - } -#endif } /** @@ -241,15 +235,9 @@ void PFXStoreApi::deleteOrder(const QString &order_id) { PFXHttpRequestInput input(fullPath, "DELETE"); -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::deleteOrderCallback); connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater); @@ -319,15 +307,9 @@ void PFXStoreApi::getInventory() { PFXHttpRequestInput input(fullPath, "GET"); -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::getInventoryCallback); connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater); @@ -417,15 +399,9 @@ void PFXStoreApi::getOrderById(const qint64 &order_id) { PFXHttpRequestInput input(fullPath, "GET"); -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::getOrderByIdCallback); connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater); @@ -497,15 +473,9 @@ void PFXStoreApi::placeOrder(const PFXOrder &pfx_order) { QByteArray output = pfx_order.asJson().toUtf8(); input.request_body.append(output); } -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::placeOrderCallback); connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater); diff --git a/samples/client/petstore/cpp-qt/client/PFXUserApi.cpp b/samples/client/petstore/cpp-qt/client/PFXUserApi.cpp index 7949f0afa3a4..d404aeb17694 100644 --- a/samples/client/petstore/cpp-qt/client/PFXUserApi.cpp +++ b/samples/client/petstore/cpp-qt/client/PFXUserApi.cpp @@ -126,15 +126,9 @@ int PFXUserApi::addServerConfiguration(const QString &operation, const QUrl &url * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ void PFXUserApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap &variables) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) for (auto keyIt = _serverIndices.keyBegin(); keyIt != _serverIndices.keyEnd(); keyIt++) { setServerIndex(*keyIt, addServerConfiguration(*keyIt, url, description, variables)); } -#else - for (auto &e : _serverIndices.keys()) { - setServerIndex(e, addServerConfiguration(e, url, description, variables)); - } -#endif } /** @@ -240,15 +234,9 @@ void PFXUserApi::createUser(const PFXUser &pfx_user) { QByteArray output = pfx_user.asJson().toUtf8(); input.request_body.append(output); } -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::createUserCallback); connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater); @@ -318,15 +306,9 @@ void PFXUserApi::createUsersWithArrayInput(const QList &pfx_user) { QByteArray bytes = doc.toJson(); input.request_body.append(bytes); } -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::createUsersWithArrayInputCallback); connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater); @@ -396,15 +378,9 @@ void PFXUserApi::createUsersWithListInput(const QList &pfx_user) { QByteArray bytes = doc.toJson(); input.request_body.append(bytes); } -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::createUsersWithListInputCallback); connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater); @@ -484,15 +460,9 @@ void PFXUserApi::deleteUser(const QString &username) { PFXHttpRequestInput input(fullPath, "DELETE"); -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::deleteUserCallback); connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater); @@ -572,15 +542,9 @@ void PFXUserApi::getUserByName(const QString &username) { PFXHttpRequestInput input(fullPath, "GET"); -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::getUserByNameCallback); connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater); @@ -678,15 +642,9 @@ void PFXUserApi::loginUser(const QString &username, const QString &password) { PFXHttpRequestInput input(fullPath, "GET"); -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::loginUserCallback); connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater); @@ -754,15 +712,9 @@ void PFXUserApi::logoutUser() { PFXHttpRequestInput input(fullPath, "GET"); -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::logoutUserCallback); connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater); @@ -847,15 +799,9 @@ void PFXUserApi::updateUser(const QString &username, const PFXUser &pfx_user) { QByteArray output = pfx_user.asJson().toUtf8(); input.request_body.append(output); } -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) for (auto keyValueIt = _defaultHeaders.keyValueBegin(); keyValueIt != _defaultHeaders.keyValueEnd(); keyValueIt++) { input.headers.insert(keyValueIt->first, keyValueIt->second); } -#else - for (auto key : _defaultHeaders.keys()) { - input.headers.insert(key, _defaultHeaders[key]); - } -#endif connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::updateUserCallback); connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);