Skip to content

Commit

Permalink
Update HttpRequest.cpp.mustache - use stable 4-parameter connect (#18893
Browse files Browse the repository at this point in the history
)

* Update HttpRequest.cpp.mustache

Use stable 4-parameter connect

* add generated files

* Revert "add generated files"

This reverts commit 1d4e78a.

* changed from 3- to 4-parameter connect for api-body for stable connection (see warning [clazy-connect-3arg-lambda])

* ran step 3 from Linux

* fixed missing braces and additional 3par issues

* add step 3 generated file

* activate trace for more info about link issue

* Update .github/workflows/samples-cpp-qt-client.yaml

Co-authored-by: Martin Delille <[email protected]>

* Update .github/workflows/samples-cpp-qt-client.yaml

Co-authored-by: Martin Delille <[email protected]>

* Update samples/client/petstore/cpp-qt/client/PFXPetApi.cpp

Co-authored-by: Martin Delille <[email protected]>

* Update modules/openapi-generator/src/main/resources/cpp-qt-client/HttpRequest.cpp.mustache

Co-authored-by: Martin Delille <[email protected]>

* Update modules/openapi-generator/src/main/resources/cpp-qt-client/HttpRequest.cpp.mustache

Co-authored-by: Martin Delille <[email protected]>

* Update modules/openapi-generator/src/main/resources/cpp-qt-client/api-body.mustache

Co-authored-by: Martin Delille <[email protected]>

* Update modules/openapi-generator/src/main/resources/cpp-qt-client/api-body.mustache

Co-authored-by: Martin Delille <[email protected]>

* Update modules/openapi-generator/src/main/resources/cpp-qt-client/api-body.mustache

Co-authored-by: Martin Delille <[email protected]>

* Update samples/client/petstore/cpp-qt/client/PFXPetApi.cpp

Co-authored-by: Martin Delille <[email protected]>

* Update samples/client/petstore/cpp-qt/client/PFXPetApi.cpp

Co-authored-by: Martin Delille <[email protected]>

* Update samples/client/petstore/cpp-qt/client/PFXPetApi.cpp

Co-authored-by: Martin Delille <[email protected]>

* Update samples/client/petstore/cpp-qt/client/PFXPetApi.cpp

Co-authored-by: Martin Delille <[email protected]>

* rebuild examples

* Update modules/openapi-generator/src/main/resources/cpp-qt-client/api-body.mustache

Co-authored-by: Martin Delille <[email protected]>

* removed braces and updated examples

* rebuild samples

* remove false generated changes

---------

Co-authored-by: Martin Delille <[email protected]>
  • Loading branch information
Jazzco and MartinDelille authored Oct 15, 2024
1 parent 4ddfb6f commit 1214ad7
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -353,12 +353,12 @@ void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) {
if (reply != nullptr) {
reply->setParent(this);
connect(reply, &QNetworkReply::downloadProgress, this, &{{prefix}}HttpRequestWorker::downloadProgress);
connect(reply, &QNetworkReply::finished, [this, reply] {
connect(reply, &QNetworkReply::finished, this, [this, reply] {
on_reply_finished(reply);
});
}
if (timeOutTimer.interval() > 0) {
QObject::connect(&timeOutTimer, &QTimer::timeout, [this, reply] {
QObject::connect(&timeOutTimer, &QTimer::timeout, this, [this, reply] {
on_reply_timeout(reply);
});
timeOutTimer.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
connect(worker, &{{prefix}}HttpRequestWorker::downloadProgress, this, &{{classname}}::{{nickname}}Progress);{{/addDownloadProgress}}
connect(worker, &{{prefix}}HttpRequestWorker::on_execution_finished, this, &{{classname}}::{{nickname}}Callback);
connect(this, &{{classname}}::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
connect(worker, &QObject::destroyed, this, [this] {
if (findChildren<{{prefix}}HttpRequestWorker*>().count() == 0) {
Q_EMIT allPendingRequestsCompleted();
}
Expand All @@ -690,7 +690,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}

connect(_latestWorker, &{{prefix}}HttpRequestWorker::on_execution_finished, this, &{{classname}}::{{nickname}}Callback);
connect(this, &{{classname}}::abortRequestsSignal, _latestWorker, &QObject::deleteLater);
connect(_latestWorker, &QObject::destroyed, [this](){
connect(_latestWorker, &QObject::destroyed, this, [this] {
if(findChildren<{{prefix}}HttpRequestWorker*>().count() == 0){
Q_EMIT allPendingRequestsCompleted();
}
Expand Down Expand Up @@ -720,7 +720,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}

connect(_latestWorker, &{{prefix}}HttpRequestWorker::on_execution_finished, this, &{{classname}}::{{nickname}}Callback);
connect(this, &{{classname}}::abortRequestsSignal, _latestWorker, &QObject::deleteLater);
connect(_latestWorker, &QObject::destroyed, [this](){
connect(_latestWorker, &QObject::destroyed, this, [this] {
if(findChildren<{{prefix}}HttpRequestWorker*>().count() == 0){
Q_EMIT allPendingRequestsCompleted();
}
Expand Down Expand Up @@ -750,7 +750,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}

connect(_latestWorker, &{{prefix}}HttpRequestWorker::on_execution_finished, this, &{{classname}}::{{nickname}}Callback);
connect(this, &{{classname}}::abortRequestsSignal, _latestWorker, &QObject::deleteLater);
connect(_latestWorker, &QObject::destroyed, [this](){
connect(_latestWorker, &QObject::destroyed, this, [this] {
if(findChildren<{{prefix}}HttpRequestWorker*>().count() == 0){
Q_EMIT allPendingRequestsCompleted();
}
Expand Down Expand Up @@ -780,7 +780,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}

connect(_latestWorker, &{{prefix}}HttpRequestWorker::on_execution_finished, this, &{{classname}}::{{nickname}}Callback);
connect(this, &{{classname}}::abortRequestsSignal, _latestWorker, &QObject::deleteLater);
connect(_latestWorker, &QObject::destroyed, [this](){
connect(_latestWorker, &QObject::destroyed, this, [this] {
if(findChildren<{{prefix}}HttpRequestWorker*>().count() == 0){
Q_EMIT allPendingRequestsCompleted();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,12 @@ void PFXHttpRequestWorker::execute(PFXHttpRequestInput *input) {
if (reply != nullptr) {
reply->setParent(this);
connect(reply, &QNetworkReply::downloadProgress, this, &PFXHttpRequestWorker::downloadProgress);
connect(reply, &QNetworkReply::finished, [this, reply] {
connect(reply, &QNetworkReply::finished, this, [this, reply] {
on_reply_finished(reply);
});
}
if (timeOutTimer.interval() > 0) {
QObject::connect(&timeOutTimer, &QTimer::timeout, [this, reply] {
QObject::connect(&timeOutTimer, &QTimer::timeout, this, [this, reply] {
on_reply_timeout(reply);
});
timeOutTimer.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ void PFXPetApi::addPet(const PFXPet &pfx_pet) {
connect(worker, &PFXHttpRequestWorker::downloadProgress, this, &PFXPetApi::addPetProgress);
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::addPetCallback);
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
connect(worker, &QObject::destroyed, this, [this] {
if (findChildren<PFXHttpRequestWorker*>().count() == 0) {
Q_EMIT allPendingRequestsCompleted();
}
Expand All @@ -266,7 +266,7 @@ void PFXPetApi::addPet(const PFXPet &pfx_pet) {

connect(_latestWorker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::addPetCallback);
connect(this, &PFXPetApi::abortRequestsSignal, _latestWorker, &QObject::deleteLater);
connect(_latestWorker, &QObject::destroyed, [this](){
connect(_latestWorker, &QObject::destroyed, this, [this] {
if(findChildren<PFXHttpRequestWorker*>().count() == 0){
Q_EMIT allPendingRequestsCompleted();
}
Expand Down Expand Up @@ -352,7 +352,7 @@ void PFXPetApi::allPets() {
connect(worker, &PFXHttpRequestWorker::downloadProgress, this, &PFXPetApi::allPetsProgress);
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::allPetsCallback);
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
connect(worker, &QObject::destroyed, this, [this] {
if (findChildren<PFXHttpRequestWorker*>().count() == 0) {
Q_EMIT allPendingRequestsCompleted();
}
Expand Down Expand Up @@ -451,7 +451,7 @@ void PFXPetApi::deletePet(const qint64 &pet_id, const ::test_namespace::Optional
connect(worker, &PFXHttpRequestWorker::downloadProgress, this, &PFXPetApi::deletePetProgress);
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::deletePetCallback);
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
connect(worker, &QObject::destroyed, this, [this] {
if (findChildren<PFXHttpRequestWorker*>().count() == 0) {
Q_EMIT allPendingRequestsCompleted();
}
Expand All @@ -474,7 +474,7 @@ void PFXPetApi::deletePet(const qint64 &pet_id, const ::test_namespace::Optional

connect(_latestWorker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::deletePetCallback);
connect(this, &PFXPetApi::abortRequestsSignal, _latestWorker, &QObject::deleteLater);
connect(_latestWorker, &QObject::destroyed, [this](){
connect(_latestWorker, &QObject::destroyed, this, [this] {
if(findChildren<PFXHttpRequestWorker*>().count() == 0){
Q_EMIT allPendingRequestsCompleted();
}
Expand Down Expand Up @@ -646,7 +646,7 @@ void PFXPetApi::findPetsByStatus(const QList<QString> &status) {
connect(worker, &PFXHttpRequestWorker::downloadProgress, this, &PFXPetApi::findPetsByStatusProgress);
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::findPetsByStatusCallback);
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
connect(worker, &QObject::destroyed, this, [this] {
if (findChildren<PFXHttpRequestWorker*>().count() == 0) {
Q_EMIT allPendingRequestsCompleted();
}
Expand All @@ -669,7 +669,7 @@ void PFXPetApi::findPetsByStatus(const QList<QString> &status) {

connect(_latestWorker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::findPetsByStatusCallback);
connect(this, &PFXPetApi::abortRequestsSignal, _latestWorker, &QObject::deleteLater);
connect(_latestWorker, &QObject::destroyed, [this](){
connect(_latestWorker, &QObject::destroyed, this, [this] {
if(findChildren<PFXHttpRequestWorker*>().count() == 0){
Q_EMIT allPendingRequestsCompleted();
}
Expand Down Expand Up @@ -851,7 +851,7 @@ void PFXPetApi::findPetsByTags(const QList<QString> &tags) {
connect(worker, &PFXHttpRequestWorker::downloadProgress, this, &PFXPetApi::findPetsByTagsProgress);
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::findPetsByTagsCallback);
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
connect(worker, &QObject::destroyed, this, [this] {
if (findChildren<PFXHttpRequestWorker*>().count() == 0) {
Q_EMIT allPendingRequestsCompleted();
}
Expand All @@ -874,7 +874,7 @@ void PFXPetApi::findPetsByTags(const QList<QString> &tags) {

connect(_latestWorker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::findPetsByTagsCallback);
connect(this, &PFXPetApi::abortRequestsSignal, _latestWorker, &QObject::deleteLater);
connect(_latestWorker, &QObject::destroyed, [this](){
connect(_latestWorker, &QObject::destroyed, this, [this] {
if(findChildren<PFXHttpRequestWorker*>().count() == 0){
Q_EMIT allPendingRequestsCompleted();
}
Expand Down Expand Up @@ -988,7 +988,7 @@ void PFXPetApi::getPetById(const qint64 &pet_id) {
connect(worker, &PFXHttpRequestWorker::downloadProgress, this, &PFXPetApi::getPetByIdProgress);
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::getPetByIdCallback);
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
connect(worker, &QObject::destroyed, this, [this] {
if (findChildren<PFXHttpRequestWorker*>().count() == 0) {
Q_EMIT allPendingRequestsCompleted();
}
Expand Down Expand Up @@ -1063,7 +1063,7 @@ void PFXPetApi::updatePet(const PFXPet &pfx_pet) {
connect(worker, &PFXHttpRequestWorker::downloadProgress, this, &PFXPetApi::updatePetProgress);
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::updatePetCallback);
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
connect(worker, &QObject::destroyed, this, [this] {
if (findChildren<PFXHttpRequestWorker*>().count() == 0) {
Q_EMIT allPendingRequestsCompleted();
}
Expand All @@ -1086,7 +1086,7 @@ void PFXPetApi::updatePet(const PFXPet &pfx_pet) {

connect(_latestWorker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::updatePetCallback);
connect(this, &PFXPetApi::abortRequestsSignal, _latestWorker, &QObject::deleteLater);
connect(_latestWorker, &QObject::destroyed, [this](){
connect(_latestWorker, &QObject::destroyed, this, [this] {
if(findChildren<PFXHttpRequestWorker*>().count() == 0){
Q_EMIT allPendingRequestsCompleted();
}
Expand Down Expand Up @@ -1194,7 +1194,7 @@ void PFXPetApi::updatePetWithForm(const qint64 &pet_id, const ::test_namespace::
connect(worker, &PFXHttpRequestWorker::downloadProgress, this, &PFXPetApi::updatePetWithFormProgress);
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::updatePetWithFormCallback);
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
connect(worker, &QObject::destroyed, this, [this] {
if (findChildren<PFXHttpRequestWorker*>().count() == 0) {
Q_EMIT allPendingRequestsCompleted();
}
Expand All @@ -1217,7 +1217,7 @@ void PFXPetApi::updatePetWithForm(const qint64 &pet_id, const ::test_namespace::

connect(_latestWorker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::updatePetWithFormCallback);
connect(this, &PFXPetApi::abortRequestsSignal, _latestWorker, &QObject::deleteLater);
connect(_latestWorker, &QObject::destroyed, [this](){
connect(_latestWorker, &QObject::destroyed, this, [this] {
if(findChildren<PFXHttpRequestWorker*>().count() == 0){
Q_EMIT allPendingRequestsCompleted();
}
Expand Down Expand Up @@ -1325,7 +1325,7 @@ void PFXPetApi::uploadFile(const qint64 &pet_id, const ::test_namespace::Optiona
connect(worker, &PFXHttpRequestWorker::downloadProgress, this, &PFXPetApi::uploadFileProgress);
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::uploadFileCallback);
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
connect(worker, &QObject::destroyed, this, [this] {
if (findChildren<PFXHttpRequestWorker*>().count() == 0) {
Q_EMIT allPendingRequestsCompleted();
}
Expand All @@ -1348,7 +1348,7 @@ void PFXPetApi::uploadFile(const qint64 &pet_id, const ::test_namespace::Optiona

connect(_latestWorker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::uploadFileCallback);
connect(this, &PFXPetApi::abortRequestsSignal, _latestWorker, &QObject::deleteLater);
connect(_latestWorker, &QObject::destroyed, [this](){
connect(_latestWorker, &QObject::destroyed, this, [this] {
if(findChildren<PFXHttpRequestWorker*>().count() == 0){
Q_EMIT allPendingRequestsCompleted();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ void PFXPrimitivesApi::primitivesIntegerPost(const ::test_namespace::OptionalPar
connect(worker, &PFXHttpRequestWorker::downloadProgress, this, &PFXPrimitivesApi::primitivesIntegerPostProgress);
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPrimitivesApi::primitivesIntegerPostCallback);
connect(this, &PFXPrimitivesApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
connect(worker, &QObject::destroyed, this, [this] {
if (findChildren<PFXHttpRequestWorker*>().count() == 0) {
Q_EMIT allPendingRequestsCompleted();
}
Expand Down Expand Up @@ -301,7 +301,7 @@ void PFXPrimitivesApi::primitivesNumberPut(const ::test_namespace::OptionalParam
connect(worker, &PFXHttpRequestWorker::downloadProgress, this, &PFXPrimitivesApi::primitivesNumberPutProgress);
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPrimitivesApi::primitivesNumberPutCallback);
connect(this, &PFXPrimitivesApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
connect(worker, &QObject::destroyed, this, [this] {
if (findChildren<PFXHttpRequestWorker*>().count() == 0) {
Q_EMIT allPendingRequestsCompleted();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ void PFXStoreApi::deleteOrder(const QString &order_id) {
connect(worker, &PFXHttpRequestWorker::downloadProgress, this, &PFXStoreApi::deleteOrderProgress);
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::deleteOrderCallback);
connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
connect(worker, &QObject::destroyed, this, [this] {
if (findChildren<PFXHttpRequestWorker*>().count() == 0) {
Q_EMIT allPendingRequestsCompleted();
}
Expand Down Expand Up @@ -315,7 +315,7 @@ void PFXStoreApi::getInventory() {
connect(worker, &PFXHttpRequestWorker::downloadProgress, this, &PFXStoreApi::getInventoryProgress);
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::getInventoryCallback);
connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
connect(worker, &QObject::destroyed, this, [this] {
if (findChildren<PFXHttpRequestWorker*>().count() == 0) {
Q_EMIT allPendingRequestsCompleted();
}
Expand Down Expand Up @@ -408,7 +408,7 @@ void PFXStoreApi::getOrderById(const qint64 &order_id) {
connect(worker, &PFXHttpRequestWorker::downloadProgress, this, &PFXStoreApi::getOrderByIdProgress);
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::getOrderByIdCallback);
connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
connect(worker, &QObject::destroyed, this, [this] {
if (findChildren<PFXHttpRequestWorker*>().count() == 0) {
Q_EMIT allPendingRequestsCompleted();
}
Expand Down Expand Up @@ -483,7 +483,7 @@ void PFXStoreApi::placeOrder(const PFXOrder &pfx_order) {
connect(worker, &PFXHttpRequestWorker::downloadProgress, this, &PFXStoreApi::placeOrderProgress);
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::placeOrderCallback);
connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater);
connect(worker, &QObject::destroyed, this, [this]() {
connect(worker, &QObject::destroyed, this, [this] {
if (findChildren<PFXHttpRequestWorker*>().count() == 0) {
Q_EMIT allPendingRequestsCompleted();
}
Expand Down
Loading

0 comments on commit 1214ad7

Please sign in to comment.