diff --git a/.gitignore b/.gitignore index 68d73096230..728a1667834 100644 --- a/.gitignore +++ b/.gitignore @@ -62,14 +62,17 @@ samples/server-generator/node/output/node_modules samples/server/petstore/nodejs/node_modules samples/server/petstore/nodejs-server/node_modules -# qt5 cpp -*.pro.user -samples/client/petstore/qt5cpp/PetStore/moc_* -samples/client/petstore/qt5cpp/PetStore/*.o -samples/client/petstore/qt5cpp/build-* -samples/client/petstore/qt5cpp/PetStore/PetStore -samples/client/petstore/qt5cpp/PetStore/Makefile -samples/client/petstore/qt5cpp/PetStore/PetStore.pro.user +# qt cpp +samples/client/build +samples/client/petstore/build +samples/client/petstore/cpp-qt/PetStore/moc_* +samples/client/petstore/cpp-qt/PetStore/*.o +samples/client/petstore/cpp-qt/build-* +samples/client/petstore/cpp-qt/build-* +samples/client/petstore/cpp-qt/PetStore/PetStore +samples/client/petstore/cpp-qt/PetStore/Makefile +samples/client/petstore/cpp-qt/PetStore/PetStore.pro.user +samples/client/petstore/cpp-qt/CMakeLists.txt.user # cpprestsdk samples/client/petstore/cpp-restsdk/CMakeCache.txt diff --git a/modules/openapi-generator/src/main/resources/cpp-qt-client/ServerConfiguration.mustache b/modules/openapi-generator/src/main/resources/cpp-qt-client/ServerConfiguration.mustache index 7c2beff520b..f4e36bb4a81 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt-client/ServerConfiguration.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt-client/ServerConfiguration.mustache @@ -4,9 +4,11 @@ */ #ifndef {{prefix}}_SERVERVCONFIGURATION_H #define {{prefix}}_SERVERVCONFIGURATION_H + #include #include #include +#include #include #include "{{prefix}}ServerVariable.h" 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 7fb010be106..3f7e5035d79 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,9 +129,15 @@ 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 } /** @@ -661,7 +667,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}} input.headers.insert(keyValueIt->first, keyValueIt->second); } #else - for (auto key = _defaultHeaders.keys()) { + for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif diff --git a/samples/client/petstore/cpp-qt/.gitignore b/samples/client/petstore/cpp-qt/.gitignore deleted file mode 100644 index 378eac25d31..00000000000 --- a/samples/client/petstore/cpp-qt/.gitignore +++ /dev/null @@ -1 +0,0 @@ -build diff --git a/samples/client/petstore/cpp-qt/PetStore/PetStore.pro b/samples/client/petstore/cpp-qt/PetStore/PetStore.pro index 88d64d63958..961daeeeffc 100644 --- a/samples/client/petstore/cpp-qt/PetStore/PetStore.pro +++ b/samples/client/petstore/cpp-qt/PetStore/PetStore.pro @@ -18,6 +18,8 @@ TEMPLATE = app include(../client/PFXclient.pri) +INCLUDEPATH += ../client + SOURCES += main.cpp \ PetApiTests.cpp \ StoreApiTests.cpp \ diff --git a/samples/client/petstore/cpp-qt/client/PFXPetApi.cpp b/samples/client/petstore/cpp-qt/client/PFXPetApi.cpp index a17deb8dfac..7c999d98687 100644 --- a/samples/client/petstore/cpp-qt/client/PFXPetApi.cpp +++ b/samples/client/petstore/cpp-qt/client/PFXPetApi.cpp @@ -126,9 +126,15 @@ 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 } /** @@ -238,7 +244,7 @@ void PFXPetApi::addPet(const PFXPet &body) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else - for (auto key = _defaultHeaders.keys()) { + for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif @@ -306,7 +312,7 @@ void PFXPetApi::deletePet(const qint64 &pet_id, const ::test_namespace::Optional input.headers.insert(keyValueIt->first, keyValueIt->second); } #else - for (auto key = _defaultHeaders.keys()) { + for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif @@ -440,7 +446,7 @@ void PFXPetApi::findPetsByStatus(const QList &status) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else - for (auto key = _defaultHeaders.keys()) { + for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif @@ -584,7 +590,7 @@ void PFXPetApi::findPetsByTags(const QList &tags) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else - for (auto key = _defaultHeaders.keys()) { + for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif @@ -660,7 +666,7 @@ void PFXPetApi::getPetById(const qint64 &pet_id) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else - for (auto key = _defaultHeaders.keys()) { + for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif @@ -713,7 +719,7 @@ void PFXPetApi::updatePet(const PFXPet &body) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else - for (auto key = _defaultHeaders.keys()) { + for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif @@ -783,7 +789,7 @@ void PFXPetApi::updatePetWithForm(const qint64 &pet_id, const ::test_namespace:: input.headers.insert(keyValueIt->first, keyValueIt->second); } #else - for (auto key = _defaultHeaders.keys()) { + for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif @@ -853,7 +859,7 @@ void PFXPetApi::uploadFile(const qint64 &pet_id, const ::test_namespace::Optiona input.headers.insert(keyValueIt->first, keyValueIt->second); } #else - for (auto key = _defaultHeaders.keys()) { + for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif diff --git a/samples/client/petstore/cpp-qt/client/PFXServerConfiguration.h b/samples/client/petstore/cpp-qt/client/PFXServerConfiguration.h index 72bd32a4f6e..42e7504dcaa 100644 --- a/samples/client/petstore/cpp-qt/client/PFXServerConfiguration.h +++ b/samples/client/petstore/cpp-qt/client/PFXServerConfiguration.h @@ -14,9 +14,11 @@ */ #ifndef PFX_SERVERVCONFIGURATION_H #define PFX_SERVERVCONFIGURATION_H + #include #include #include +#include #include #include "PFXServerVariable.h" diff --git a/samples/client/petstore/cpp-qt/client/PFXStoreApi.cpp b/samples/client/petstore/cpp-qt/client/PFXStoreApi.cpp index e0e9cc9281b..9ff025b0ad1 100644 --- a/samples/client/petstore/cpp-qt/client/PFXStoreApi.cpp +++ b/samples/client/petstore/cpp-qt/client/PFXStoreApi.cpp @@ -118,9 +118,15 @@ 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 } /** @@ -240,7 +246,7 @@ void PFXStoreApi::deleteOrder(const QString &order_id) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else - for (auto key = _defaultHeaders.keys()) { + for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif @@ -292,7 +298,7 @@ void PFXStoreApi::getInventory() { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else - for (auto key = _defaultHeaders.keys()) { + for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif @@ -364,7 +370,7 @@ void PFXStoreApi::getOrderById(const qint64 &order_id) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else - for (auto key = _defaultHeaders.keys()) { + for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif @@ -417,7 +423,7 @@ void PFXStoreApi::placeOrder(const PFXOrder &body) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else - for (auto key = _defaultHeaders.keys()) { + for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif diff --git a/samples/client/petstore/cpp-qt/client/PFXUserApi.cpp b/samples/client/petstore/cpp-qt/client/PFXUserApi.cpp index cc38ec0bb08..b2f4d4ff96d 100644 --- a/samples/client/petstore/cpp-qt/client/PFXUserApi.cpp +++ b/samples/client/petstore/cpp-qt/client/PFXUserApi.cpp @@ -126,9 +126,15 @@ 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 } /** @@ -238,7 +244,7 @@ void PFXUserApi::createUser(const PFXUser &body) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else - for (auto key = _defaultHeaders.keys()) { + for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif @@ -290,7 +296,7 @@ void PFXUserApi::createUsersWithArrayInput(const QList &body) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else - for (auto key = _defaultHeaders.keys()) { + for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif @@ -342,7 +348,7 @@ void PFXUserApi::createUsersWithListInput(const QList &body) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else - for (auto key = _defaultHeaders.keys()) { + for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif @@ -404,7 +410,7 @@ void PFXUserApi::deleteUser(const QString &username) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else - for (auto key = _defaultHeaders.keys()) { + for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif @@ -466,7 +472,7 @@ void PFXUserApi::getUserByName(const QString &username) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else - for (auto key = _defaultHeaders.keys()) { + for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif @@ -546,7 +552,7 @@ void PFXUserApi::loginUser(const QString &username, const QString &password) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else - for (auto key = _defaultHeaders.keys()) { + for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif @@ -596,7 +602,7 @@ void PFXUserApi::logoutUser() { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else - for (auto key = _defaultHeaders.keys()) { + for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif @@ -662,7 +668,7 @@ void PFXUserApi::updateUser(const QString &username, const PFXUser &body) { input.headers.insert(keyValueIt->first, keyValueIt->second); } #else - for (auto key = _defaultHeaders.keys()) { + for (auto key : _defaultHeaders.keys()) { input.headers.insert(key, _defaultHeaders[key]); } #endif