From 36f69a034d2c6503b3e3cee00d10ab8944cc5be6 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 1 Feb 2018 13:35:09 +0800 Subject: [PATCH] remove trailing spaces in qt5 c++ templates (#7525) --- .../main/resources/qt5cpp/api-body.mustache | 18 ++-- .../main/resources/qt5cpp/model-body.mustache | 90 ++++++++++++++----- .../resources/qt5cpp/model-header.mustache | 4 +- .../src/main/resources/qt5cpp/model.mustache | 2 +- .../petstore/qt5cpp/.swagger-codegen/VERSION | 2 +- .../petstore/qt5cpp/client/SWGApiResponse.cpp | 7 +- .../petstore/qt5cpp/client/SWGApiResponse.h | 8 +- .../petstore/qt5cpp/client/SWGCategory.cpp | 6 +- .../petstore/qt5cpp/client/SWGCategory.h | 6 +- .../petstore/qt5cpp/client/SWGOrder.cpp | 10 +-- .../client/petstore/qt5cpp/client/SWGOrder.h | 14 +-- .../client/petstore/qt5cpp/client/SWGPet.cpp | 10 +-- .../client/petstore/qt5cpp/client/SWGPet.h | 14 +-- .../petstore/qt5cpp/client/SWGPetApi.cpp | 20 ++--- .../petstore/qt5cpp/client/SWGStoreApi.cpp | 5 -- .../client/petstore/qt5cpp/client/SWGTag.cpp | 6 +- .../client/petstore/qt5cpp/client/SWGTag.h | 6 +- .../client/petstore/qt5cpp/client/SWGUser.cpp | 12 +-- .../client/petstore/qt5cpp/client/SWGUser.h | 18 ++-- .../petstore/qt5cpp/client/SWGUserApi.cpp | 12 +-- 20 files changed, 139 insertions(+), 131 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache index 263c089d244..3188753295f 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache @@ -33,9 +33,9 @@ void {{#queryParams}} {{^collectionFormat}} - if (fullPath.indexOf("?") > 0) + if (fullPath.indexOf("?") > 0) fullPath.append("&"); - else + else fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("{{baseName}}")) .append("=") @@ -49,7 +49,7 @@ void foreach({{{baseType}}} t, *{{paramName}}) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); - else + else fullPath.append("?"); fullPath.append("{{{baseName}}}=").append(stringValue(t)); } @@ -57,7 +57,7 @@ void else if (QString("{{collectionFormat}}").indexOf("ssv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); - else + else fullPath.append("?"); fullPath.append("{{baseName}}="); qint32 count = 0; @@ -71,7 +71,7 @@ void else if (QString("{{collectionFormat}}").indexOf("tsv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); - else + else fullPath.append("?"); fullPath.append("{{baseName}}="); qint32 count = 0; @@ -160,11 +160,13 @@ void } {{/isListContainer}} - {{^isListContainer}}{{^isMapContainer}} + {{^isListContainer}} + {{^isMapContainer}} {{#returnTypeIsPrimitive}} {{{returnType}}} output; // TODO add primitive output support - {{/returnTypeIsPrimitive}}{{/isMapContainer}} - {{#isMapContainer}} + {{/returnTypeIsPrimitive}} + {{/isMapContainer}} + {{#isMapContainer}} {{{returnType}}} output = {{{defaultResponse}}}; QString json(worker->response); QByteArray array (json.toStdString().c_str()); diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/model-body.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/model-body.mustache index 011bf19fd69..b75312dd995 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/model-body.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/model-body.mustache @@ -41,7 +41,7 @@ void if({{name}} != nullptr) { {{#isContainer}} auto arr = {{name}}; for(auto o: *arr) { {{#items.isContainer}} - for(auto o1: *o) { + for(auto o1: *o) { delete o1; }{{/items.isContainer}} delete o; @@ -71,7 +71,7 @@ void {{#items.isListContainer}}auto {{name}}_item = new QList<{{items.items.baseType}}{{^items.items.isLong}}{{^items.items.isInteger}}{{^items.items.isDouble}}{{^items.items.isFloat}}{{^items.items.isBoolean}}*{{/items.items.isBoolean}}{{/items.items.isFloat}}{{/items.items.isDouble}}{{/items.items.isInteger}}{{/items.items.isLong}}>();{{/items.isListContainer}} {{#items.isMapContainer}}auto {{name}}_item = new QMap();{{/items.isMapContainer}} auto jsonval = jval.toObject(); - ::{{cppNamespace}}::setValue({{name}}_item, jsonval, "{{items.baseType}}", "{{items.items.baseType}}"); + ::{{cppNamespace}}::setValue({{name}}_item, jsonval, "{{items.baseType}}", "{{items.items.baseType}}"); {{name}}->push_back({{name}}_item); } }{{/isListContainer}}{{#isMapContainer}} @@ -80,10 +80,11 @@ void if(varmap.count() > 0){ for(auto val : varmap.keys()){ {{#items.isListContainer}}auto {{name}}_item = new QList<{{items.items.baseType}}{{^items.items.isLong}}{{^items.items.isInteger}}{{^items.items.isDouble}}{{^items.items.isFloat}}{{^items.items.isBoolean}}*{{/items.items.isBoolean}}{{/items.items.isFloat}}{{/items.items.isDouble}}{{/items.items.isInteger}}{{/items.items.isLong}}>();{{/items.isListContainer}} - {{#items.isMapContainer}}auto {{name}}_item = new QMap();{{/items.isMapContainer}} + {{#items.isMapContainer}}auto {{name}}_item = new QMap();{{/items.isMapContainer}} auto jsonval = QJsonValue::fromVariant(varmap.value(val)); - ::{{cppNamespace}}::setValue((QMap*)&{{name}}_item, jsonval, "{{items.baseType}}", "{{items.items.baseType}}"); - {{name}}->insert({{name}}->end(), val, {{name}}_item); + ::{{cppNamespace}}::setValue((QMap*)&{{name}}_item, jsonval, "{{items.baseType}}", "{{items.items.baseType}}"); + + {{name}}->insert({{name}}->end(), val, {{name}}_item); } } }{{/isMapContainer}}{{/items.isContainer}}{{/isContainer}} @@ -94,7 +95,7 @@ QString {{classname}}::asJson () { QJsonObject* obj = this->asJsonObject(); - + QJsonDocument doc(*obj); QByteArray bytes = doc.toJson(); return QString(bytes); @@ -104,47 +105,92 @@ QJsonObject* {{classname}}::asJsonObject() { QJsonObject* obj = new QJsonObject(); {{#vars}} - {{^isContainer}}{{#complexType}}{{^isString}}{{^isDate}}{{^isDateTime}}{{^isByteArray}} + {{^isContainer}} + {{#complexType}} + {{^isString}} + {{^isDate}} + {{^isDateTime}} + {{^isByteArray}} if(({{name}} != nullptr) && ({{name}}->isSet())){ toJsonValue(QString("{{baseName}}"), {{name}}, obj, QString("{{complexType}}")); - }{{/isByteArray}}{{/isDateTime}}{{/isDate}}{{/isString}}{{#isString}} + } + {{/isByteArray}} + {{/isDateTime}} + {{/isDate}} + {{/isString}} + {{#isString}} if({{name}} != nullptr && *{{name}} != QString("")){ toJsonValue(QString("{{baseName}}"), {{name}}, obj, QString("{{complexType}}")); - }{{/isString}}{{/complexType}}{{#isPrimitiveType}}{{^isDateTime}}{{^isDate}}{{^isByteArray}} + } + {{/isString}} + {{/complexType}} + {{#isPrimitiveType}} + {{^isDateTime}} + {{^isDate}} + {{^isByteArray}} if(m_{{name}}_isSet){ obj->insert("{{baseName}}", QJsonValue({{name}})); - }{{/isByteArray}}{{/isDate}}{{/isDateTime}}{{/isPrimitiveType}}{{#isDate}} + } + {{/isByteArray}} + {{/isDate}} + {{/isDateTime}} + {{/isPrimitiveType}} + {{#isDate}} if({{name}} != nullptr) { toJsonValue(QString("{{baseName}}"), {{name}}, obj, QString("{{complexType}}")); - }{{/isDate}}{{#isByteArray}} + } + {{/isDate}} + {{#isByteArray}} if({{name}} != nullptr) { obj->insert("{{name}}", QJsonValue(*{{name}})); - }{{/isByteArray}}{{#isDateTime}} + } + {{/isByteArray}} + {{#isDateTime}} if({{name}} != nullptr) { toJsonValue(QString("{{baseName}}"), {{name}}, obj, QString("{{complexType}}")); - }{{/isDateTime}}{{/isContainer}}{{#isContainer}}{{#isListContainer}} + } + {{/isDateTime}} + {{/isContainer}} + {{#isContainer}} + {{#isListContainer}} if({{name}}->size() > 0){ - {{^items.isContainer}}toJsonArray((QList*){{name}}, obj, "{{baseName}}", "{{complexType}}");{{/items.isContainer}}{{#items.isContainer}} + {{^items.isContainer}} + toJsonArray((QList*){{name}}, obj, "{{baseName}}", "{{complexType}}"); + {{/items.isContainer}} + {{#items.isContainer}} QJsonArray jarray; for(auto items : *{{name}}){ QJsonObject jobj; - {{#items.isListContainer}}toJsonArray((QList*)items, &jobj, "{{baseName}}", "{{items.items.baseType}}");{{/items.isListContainer}} - {{#items.isMapContainer}}toJsonMap((QMap*)items, &jobj, "{{baseName}}", "{{items.items.baseType}}");{{/items.isMapContainer}} + {{#items.isListContainer}} + toJsonArray((QList*)items, &jobj, "{{baseName}}", "{{items.items.baseType}}"); + {{/items.isListContainer}} + {{#items.isMapContainer}} + toJsonMap((QMap*)items, &jobj, "{{baseName}}", "{{items.items.baseType}}"); + {{/items.isMapContainer}} jarray.append(jobj.value("{{baseName}}")); } - obj->insert("{{baseName}}", jarray);{{/items.isContainer}} - }{{/isListContainer}}{{#isMapContainer}} + obj->insert("{{baseName}}", jarray); + {{/items.isContainer}} + } + {{/isListContainer}} + {{#isMapContainer}} if({{name}}->size() > 0){ {{^items.isContainer}}toJsonMap((QMap*) {{name}}, obj, "{{baseName}}", "{{complexType}}");{{/items.isContainer}}{{#items.isContainer}} QJsonObject mapobj; for(auto itemkey : {{name}}->keys()){ QJsonObject jobj; - {{#items.isListContainer}}toJsonArray((QList*){{name}}->value(itemkey), &jobj, itemkey, "{{items.items.baseType}}");{{/items.isListContainer}} - {{#items.isMapContainer}}toJsonMap((QMap*){{name}}->value(itemkey), &jobj, itemkey, "{{items.items.baseType}}");{{/items.isMapContainer}} + {{#items.isListContainer}} + toJsonArray((QList*){{name}}->value(itemkey), &jobj, itemkey, "{{items.items.baseType}}"); + {{/items.isListContainer}} + {{#items.isMapContainer}} + toJsonMap((QMap*){{name}}->value(itemkey), &jobj, itemkey, "{{items.items.baseType}}"); + {{/items.isMapContainer}} mapobj.insert(itemkey, jobj); } obj->insert("{{baseName}}", mapobj);{{/items.isContainer}} - }{{/isMapContainer}}{{/isContainer}} + } + {{/isMapContainer}} + {{/isContainer}} {{/vars}} return obj; @@ -163,7 +209,7 @@ void {{/vars}} -bool +bool {{classname}}::isSet(){ bool isObjectUpdated = false; do{ diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/model-header.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/model-header.mustache index c3182a72c16..d042330567b 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/model-header.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/model-header.mustache @@ -1,7 +1,7 @@ {{>licenseInfo}} {{#models}}{{#model}}/* * {{classname}}.h - * + * * {{description}} */ @@ -47,7 +47,7 @@ private: {{#vars}} {{{datatype}}} {{name}}; bool m_{{name}}_isSet; - + {{/vars}} }; diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/model.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/model.mustache index 80bf2842537..42e8aabeee7 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/model.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/model.mustache @@ -1,7 +1,7 @@ {{>licenseInfo}} {{#models}}{{#model}}/* * {{classname}}.h - * + * * {{description}} */ diff --git a/samples/client/petstore/qt5cpp/.swagger-codegen/VERSION b/samples/client/petstore/qt5cpp/.swagger-codegen/VERSION index f9f7450d135..855ff9501eb 100644 --- a/samples/client/petstore/qt5cpp/.swagger-codegen/VERSION +++ b/samples/client/petstore/qt5cpp/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.4.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/qt5cpp/client/SWGApiResponse.cpp b/samples/client/petstore/qt5cpp/client/SWGApiResponse.cpp index 84999f3b707..66e021fd402 100644 --- a/samples/client/petstore/qt5cpp/client/SWGApiResponse.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGApiResponse.cpp @@ -79,7 +79,7 @@ QString SWGApiResponse::asJson () { QJsonObject* obj = this->asJsonObject(); - + QJsonDocument doc(*obj); QByteArray bytes = doc.toJson(); return QString(bytes); @@ -88,15 +88,12 @@ SWGApiResponse::asJson () QJsonObject* SWGApiResponse::asJsonObject() { QJsonObject* obj = new QJsonObject(); - if(m_code_isSet){ obj->insert("code", QJsonValue(code)); } - if(type != nullptr && *type != QString("")){ toJsonValue(QString("type"), type, obj, QString("QString")); } - if(message != nullptr && *message != QString("")){ toJsonValue(QString("message"), message, obj, QString("QString")); } @@ -135,7 +132,7 @@ SWGApiResponse::setMessage(QString* message) { } -bool +bool SWGApiResponse::isSet(){ bool isObjectUpdated = false; do{ diff --git a/samples/client/petstore/qt5cpp/client/SWGApiResponse.h b/samples/client/petstore/qt5cpp/client/SWGApiResponse.h index 5204b245da6..423e29adf32 100644 --- a/samples/client/petstore/qt5cpp/client/SWGApiResponse.h +++ b/samples/client/petstore/qt5cpp/client/SWGApiResponse.h @@ -12,7 +12,7 @@ /* * SWGApiResponse.h - * + * * Describes the result of uploading an image resource */ @@ -56,13 +56,13 @@ class SWGApiResponse: public SWGObject { private: qint32 code; bool m_code_isSet; - + QString* type; bool m_type_isSet; - + QString* message; bool m_message_isSet; - + }; } diff --git a/samples/client/petstore/qt5cpp/client/SWGCategory.cpp b/samples/client/petstore/qt5cpp/client/SWGCategory.cpp index b508e66e014..d5f05e21893 100644 --- a/samples/client/petstore/qt5cpp/client/SWGCategory.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGCategory.cpp @@ -72,7 +72,7 @@ QString SWGCategory::asJson () { QJsonObject* obj = this->asJsonObject(); - + QJsonDocument doc(*obj); QByteArray bytes = doc.toJson(); return QString(bytes); @@ -81,11 +81,9 @@ SWGCategory::asJson () QJsonObject* SWGCategory::asJsonObject() { QJsonObject* obj = new QJsonObject(); - if(m_id_isSet){ obj->insert("id", QJsonValue(id)); } - if(name != nullptr && *name != QString("")){ toJsonValue(QString("name"), name, obj, QString("QString")); } @@ -114,7 +112,7 @@ SWGCategory::setName(QString* name) { } -bool +bool SWGCategory::isSet(){ bool isObjectUpdated = false; do{ diff --git a/samples/client/petstore/qt5cpp/client/SWGCategory.h b/samples/client/petstore/qt5cpp/client/SWGCategory.h index 83172863564..28486418b8e 100644 --- a/samples/client/petstore/qt5cpp/client/SWGCategory.h +++ b/samples/client/petstore/qt5cpp/client/SWGCategory.h @@ -12,7 +12,7 @@ /* * SWGCategory.h - * + * * A category for a pet */ @@ -53,10 +53,10 @@ class SWGCategory: public SWGObject { private: qint64 id; bool m_id_isSet; - + QString* name; bool m_name_isSet; - + }; } diff --git a/samples/client/petstore/qt5cpp/client/SWGOrder.cpp b/samples/client/petstore/qt5cpp/client/SWGOrder.cpp index 42e8891a9bf..5b997fffc1b 100644 --- a/samples/client/petstore/qt5cpp/client/SWGOrder.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGOrder.cpp @@ -94,7 +94,7 @@ QString SWGOrder::asJson () { QJsonObject* obj = this->asJsonObject(); - + QJsonDocument doc(*obj); QByteArray bytes = doc.toJson(); return QString(bytes); @@ -103,27 +103,21 @@ SWGOrder::asJson () QJsonObject* SWGOrder::asJsonObject() { QJsonObject* obj = new QJsonObject(); - if(m_id_isSet){ obj->insert("id", QJsonValue(id)); } - if(m_pet_id_isSet){ obj->insert("petId", QJsonValue(pet_id)); } - if(m_quantity_isSet){ obj->insert("quantity", QJsonValue(quantity)); } - if(ship_date != nullptr) { toJsonValue(QString("shipDate"), ship_date, obj, QString("QDateTime")); } - if(status != nullptr && *status != QString("")){ toJsonValue(QString("status"), status, obj, QString("QString")); } - if(m_complete_isSet){ obj->insert("complete", QJsonValue(complete)); } @@ -192,7 +186,7 @@ SWGOrder::setComplete(bool complete) { } -bool +bool SWGOrder::isSet(){ bool isObjectUpdated = false; do{ diff --git a/samples/client/petstore/qt5cpp/client/SWGOrder.h b/samples/client/petstore/qt5cpp/client/SWGOrder.h index 74cfc443f10..43dc7cfc68c 100644 --- a/samples/client/petstore/qt5cpp/client/SWGOrder.h +++ b/samples/client/petstore/qt5cpp/client/SWGOrder.h @@ -12,7 +12,7 @@ /* * SWGOrder.h - * + * * An order for a pets from the pet store */ @@ -66,22 +66,22 @@ class SWGOrder: public SWGObject { private: qint64 id; bool m_id_isSet; - + qint64 pet_id; bool m_pet_id_isSet; - + qint32 quantity; bool m_quantity_isSet; - + QDateTime* ship_date; bool m_ship_date_isSet; - + QString* status; bool m_status_isSet; - + bool complete; bool m_complete_isSet; - + }; } diff --git a/samples/client/petstore/qt5cpp/client/SWGPet.cpp b/samples/client/petstore/qt5cpp/client/SWGPet.cpp index 77a84be36a1..70dc8ebf891 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPet.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGPet.cpp @@ -108,7 +108,7 @@ QString SWGPet::asJson () { QJsonObject* obj = this->asJsonObject(); - + QJsonDocument doc(*obj); QByteArray bytes = doc.toJson(); return QString(bytes); @@ -117,27 +117,21 @@ SWGPet::asJson () QJsonObject* SWGPet::asJsonObject() { QJsonObject* obj = new QJsonObject(); - if(m_id_isSet){ obj->insert("id", QJsonValue(id)); } - if((category != nullptr) && (category->isSet())){ toJsonValue(QString("category"), category, obj, QString("SWGCategory")); } - if(name != nullptr && *name != QString("")){ toJsonValue(QString("name"), name, obj, QString("QString")); } - if(photo_urls->size() > 0){ toJsonArray((QList*)photo_urls, obj, "photoUrls", "QString"); } - if(tags->size() > 0){ toJsonArray((QList*)tags, obj, "tags", "SWGTag"); } - if(status != nullptr && *status != QString("")){ toJsonValue(QString("status"), status, obj, QString("QString")); } @@ -206,7 +200,7 @@ SWGPet::setStatus(QString* status) { } -bool +bool SWGPet::isSet(){ bool isObjectUpdated = false; do{ diff --git a/samples/client/petstore/qt5cpp/client/SWGPet.h b/samples/client/petstore/qt5cpp/client/SWGPet.h index 30a46879084..e356f136021 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPet.h +++ b/samples/client/petstore/qt5cpp/client/SWGPet.h @@ -12,7 +12,7 @@ /* * SWGPet.h - * + * * A pet for sale in the pet store */ @@ -68,22 +68,22 @@ class SWGPet: public SWGObject { private: qint64 id; bool m_id_isSet; - + SWGCategory* category; bool m_category_isSet; - + QString* name; bool m_name_isSet; - + QList* photo_urls; bool m_photo_urls_isSet; - + QList* tags; bool m_tags_isSet; - + QString* status; bool m_status_isSet; - + }; } diff --git a/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp b/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp index ece4311aa08..3dffe9c0695 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp @@ -147,7 +147,7 @@ SWGPetApi::findPetsByStatus(QList* status) { foreach(QString* t, *status) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); - else + else fullPath.append("?"); fullPath.append("status=").append(stringValue(t)); } @@ -155,7 +155,7 @@ SWGPetApi::findPetsByStatus(QList* status) { else if (QString("csv").indexOf("ssv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); - else + else fullPath.append("?"); fullPath.append("status="); qint32 count = 0; @@ -169,7 +169,7 @@ SWGPetApi::findPetsByStatus(QList* status) { else if (QString("csv").indexOf("tsv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); - else + else fullPath.append("?"); fullPath.append("status="); qint32 count = 0; @@ -229,7 +229,7 @@ SWGPetApi::findPetsByStatusCallback(SWGHttpRequestWorker * worker) { output->append(o); } - worker->deleteLater(); + worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit findPetsByStatusSignal(output); @@ -252,7 +252,7 @@ SWGPetApi::findPetsByTags(QList* tags) { foreach(QString* t, *tags) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); - else + else fullPath.append("?"); fullPath.append("tags=").append(stringValue(t)); } @@ -260,7 +260,7 @@ SWGPetApi::findPetsByTags(QList* tags) { else if (QString("csv").indexOf("ssv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); - else + else fullPath.append("?"); fullPath.append("tags="); qint32 count = 0; @@ -274,7 +274,7 @@ SWGPetApi::findPetsByTags(QList* tags) { else if (QString("csv").indexOf("tsv") == 0) { if (fullPath.indexOf("?") > 0) fullPath.append("&"); - else + else fullPath.append("?"); fullPath.append("tags="); qint32 count = 0; @@ -334,7 +334,7 @@ SWGPetApi::findPetsByTagsCallback(SWGHttpRequestWorker * worker) { output->append(o); } - worker->deleteLater(); + worker->deleteLater(); if (worker->error_type == QNetworkReply::NoError) { emit findPetsByTagsSignal(output); @@ -386,8 +386,6 @@ SWGPetApi::getPetByIdCallback(SWGHttpRequestWorker * worker) { } - - QString json(worker->response); SWGPet* output = static_cast(create(json, QString("SWGPet"))); worker->deleteLater(); @@ -557,8 +555,6 @@ SWGPetApi::uploadFileCallback(SWGHttpRequestWorker * worker) { } - - QString json(worker->response); SWGApiResponse* output = static_cast(create(json, QString("SWGApiResponse"))); worker->deleteLater(); diff --git a/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp b/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp index 15b13dc26a4..2a747610340 100644 --- a/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp @@ -119,7 +119,6 @@ SWGStoreApi::getInventoryCallback(SWGHttpRequestWorker * worker) { } - QMap* output = new QMap(); QString json(worker->response); QByteArray array (json.toStdString().c_str()); @@ -183,8 +182,6 @@ SWGStoreApi::getOrderByIdCallback(SWGHttpRequestWorker * worker) { } - - QString json(worker->response); SWGOrder* output = static_cast(create(json, QString("SWGOrder"))); worker->deleteLater(); @@ -240,8 +237,6 @@ SWGStoreApi::placeOrderCallback(SWGHttpRequestWorker * worker) { } - - QString json(worker->response); SWGOrder* output = static_cast(create(json, QString("SWGOrder"))); worker->deleteLater(); diff --git a/samples/client/petstore/qt5cpp/client/SWGTag.cpp b/samples/client/petstore/qt5cpp/client/SWGTag.cpp index 36cf43fd345..82ee1d57fe6 100644 --- a/samples/client/petstore/qt5cpp/client/SWGTag.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGTag.cpp @@ -72,7 +72,7 @@ QString SWGTag::asJson () { QJsonObject* obj = this->asJsonObject(); - + QJsonDocument doc(*obj); QByteArray bytes = doc.toJson(); return QString(bytes); @@ -81,11 +81,9 @@ SWGTag::asJson () QJsonObject* SWGTag::asJsonObject() { QJsonObject* obj = new QJsonObject(); - if(m_id_isSet){ obj->insert("id", QJsonValue(id)); } - if(name != nullptr && *name != QString("")){ toJsonValue(QString("name"), name, obj, QString("QString")); } @@ -114,7 +112,7 @@ SWGTag::setName(QString* name) { } -bool +bool SWGTag::isSet(){ bool isObjectUpdated = false; do{ diff --git a/samples/client/petstore/qt5cpp/client/SWGTag.h b/samples/client/petstore/qt5cpp/client/SWGTag.h index 1bddc52e312..fd2fd6436e5 100644 --- a/samples/client/petstore/qt5cpp/client/SWGTag.h +++ b/samples/client/petstore/qt5cpp/client/SWGTag.h @@ -12,7 +12,7 @@ /* * SWGTag.h - * + * * A tag for a pet */ @@ -53,10 +53,10 @@ class SWGTag: public SWGObject { private: qint64 id; bool m_id_isSet; - + QString* name; bool m_name_isSet; - + }; } diff --git a/samples/client/petstore/qt5cpp/client/SWGUser.cpp b/samples/client/petstore/qt5cpp/client/SWGUser.cpp index e3781b93172..1dd64b356a0 100644 --- a/samples/client/petstore/qt5cpp/client/SWGUser.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGUser.cpp @@ -112,7 +112,7 @@ QString SWGUser::asJson () { QJsonObject* obj = this->asJsonObject(); - + QJsonDocument doc(*obj); QByteArray bytes = doc.toJson(); return QString(bytes); @@ -121,35 +121,27 @@ SWGUser::asJson () QJsonObject* SWGUser::asJsonObject() { QJsonObject* obj = new QJsonObject(); - if(m_id_isSet){ obj->insert("id", QJsonValue(id)); } - if(username != nullptr && *username != QString("")){ toJsonValue(QString("username"), username, obj, QString("QString")); } - if(first_name != nullptr && *first_name != QString("")){ toJsonValue(QString("firstName"), first_name, obj, QString("QString")); } - if(last_name != nullptr && *last_name != QString("")){ toJsonValue(QString("lastName"), last_name, obj, QString("QString")); } - if(email != nullptr && *email != QString("")){ toJsonValue(QString("email"), email, obj, QString("QString")); } - if(password != nullptr && *password != QString("")){ toJsonValue(QString("password"), password, obj, QString("QString")); } - if(phone != nullptr && *phone != QString("")){ toJsonValue(QString("phone"), phone, obj, QString("QString")); } - if(m_user_status_isSet){ obj->insert("userStatus", QJsonValue(user_status)); } @@ -238,7 +230,7 @@ SWGUser::setUserStatus(qint32 user_status) { } -bool +bool SWGUser::isSet(){ bool isObjectUpdated = false; do{ diff --git a/samples/client/petstore/qt5cpp/client/SWGUser.h b/samples/client/petstore/qt5cpp/client/SWGUser.h index c7839922539..02ddd3af61b 100644 --- a/samples/client/petstore/qt5cpp/client/SWGUser.h +++ b/samples/client/petstore/qt5cpp/client/SWGUser.h @@ -12,7 +12,7 @@ /* * SWGUser.h - * + * * A User who is purchasing from the pet store */ @@ -71,28 +71,28 @@ class SWGUser: public SWGObject { private: qint64 id; bool m_id_isSet; - + QString* username; bool m_username_isSet; - + QString* first_name; bool m_first_name_isSet; - + QString* last_name; bool m_last_name_isSet; - + QString* email; bool m_email_isSet; - + QString* password; bool m_password_isSet; - + QString* phone; bool m_phone_isSet; - + qint32 user_status; bool m_user_status_isSet; - + }; } diff --git a/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp b/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp index a990b898dbb..6af3d311623 100644 --- a/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp @@ -285,8 +285,6 @@ SWGUserApi::getUserByNameCallback(SWGHttpRequestWorker * worker) { } - - QString json(worker->response); SWGUser* output = static_cast(create(json, QString("SWGUser"))); worker->deleteLater(); @@ -305,17 +303,17 @@ SWGUserApi::loginUser(QString* username, QString* password) { fullPath.append(this->host).append(this->basePath).append("/user/login"); - if (fullPath.indexOf("?") > 0) + if (fullPath.indexOf("?") > 0) fullPath.append("&"); - else + else fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("username")) .append("=") .append(QUrl::toPercentEncoding(stringValue(username))); - if (fullPath.indexOf("?") > 0) + if (fullPath.indexOf("?") > 0) fullPath.append("&"); - else + else fullPath.append("?"); fullPath.append(QUrl::toPercentEncoding("password")) .append("=") @@ -355,8 +353,6 @@ SWGUserApi::loginUserCallback(SWGHttpRequestWorker * worker) { } - - QString json(worker->response); QString* output = static_cast(create(json, QString("QString"))); worker->deleteLater();