diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Qt5CPPGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Qt5CPPGenerator.java index f3179688c323..c487cbda9298 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Qt5CPPGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Qt5CPPGenerator.java @@ -336,6 +336,33 @@ public class Qt5CPPGenerator extends DefaultCodegen implements CodegenConfig { } } + @Override + public String toVarName(String name) { + // sanitize name + name = sanitizeName(name); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. + + // if it's all uppper case, convert to lower case + if (name.matches("^[A-Z_]*$")) { + name = name.toLowerCase(); + } + + // camelize (lower first character) the variable name + // petId => pet_id + name = underscore(name); + + // for reserved word or word starting with number, append _ + if (isReservedWord(name) || name.matches("^\\d.*")) { + name = escapeReservedWord(name); + } + + return name; + } + + @Override + public String toParamName(String name) { + return toVarName(name); + } + @Override public String toApiName(String type) { return PREFIX + Character.toUpperCase(type.charAt(0)) + type.substring(1) + "Api"; 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 578eecc9c62e..a5fee37258b2 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache @@ -24,7 +24,7 @@ void fullPath.append(this->host).append(this->basePath).append("{{path}}"); {{#pathParams}} - QString {{paramName}}PathParam("{"); {{paramName}}PathParam.append("{{paramName}}").append("}"); + QString {{paramName}}PathParam("{"); {{paramName}}PathParam.append("{{baseName}}").append("}"); fullPath.replace({{paramName}}PathParam, stringValue({{paramName}})); {{/pathParams}} @@ -34,7 +34,7 @@ void fullPath.append("&"); else fullPath.append("?"); - fullPath.append(QUrl::toPercentEncoding("{{paramName}}")) + fullPath.append(QUrl::toPercentEncoding("{{baseName}}")) .append("=") .append(QUrl::toPercentEncoding(stringValue({{paramName}}))); {{/collectionFormat}} @@ -48,7 +48,7 @@ void fullPath.append("&"); else fullPath.append("?"); - fullPath.append("{{{paramName}}}=").append(stringValue(t)); + fullPath.append("{{{baseName}}}=").append(stringValue(t)); } } else if (QString("{{collectionFormat}}").indexOf("ssv") == 0) { @@ -56,7 +56,7 @@ void fullPath.append("&"); else fullPath.append("?"); - fullPath.append("{{paramName}}="); + fullPath.append("{{baseName}}="); qint32 count = 0; foreach({{{baseType}}} t, *{{paramName}}) { if (count > 0) { @@ -70,7 +70,7 @@ void fullPath.append("&"); else fullPath.append("?"); - fullPath.append("{{paramName}}="); + fullPath.append("{{baseName}}="); qint32 count = 0; foreach({{{baseType}}} t, *{{paramName}}) { if (count > 0) { @@ -88,7 +88,7 @@ void HttpRequestInput input(fullPath, "{{httpMethod}}"); {{#formParams}}if ({{paramName}} != NULL) { - {{^isFile}}input.add_var("{{paramName}}", *{{paramName}});{{/isFile}}{{#isFile}}input.add_file("{{paramName}}", (*{{paramName}}).local_filename, (*{{paramName}}).request_filename, (*{{paramName}}).mime_type);{{/isFile}} + {{^isFile}}input.add_var("{{baseName}}", *{{paramName}});{{/isFile}}{{#isFile}}input.add_file("{{baseName}}", (*{{paramName}}).local_filename, (*{{paramName}}).request_filename, (*{{paramName}}).mime_type);{{/isFile}} } {{/formParams}} diff --git a/samples/client/petstore/qt5cpp/.swagger-codegen-ignore b/samples/client/petstore/qt5cpp/.swagger-codegen-ignore new file mode 100644 index 000000000000..c5fa491b4c55 --- /dev/null +++ b/samples/client/petstore/qt5cpp/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/qt5cpp/LICENSE b/samples/client/petstore/qt5cpp/LICENSE new file mode 100644 index 000000000000..8dada3edaf50 --- /dev/null +++ b/samples/client/petstore/qt5cpp/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/samples/client/petstore/qt5cpp/client/SWGApiResponse.h b/samples/client/petstore/qt5cpp/client/SWGApiResponse.h index afd7b29be498..ee861c873455 100644 --- a/samples/client/petstore/qt5cpp/client/SWGApiResponse.h +++ b/samples/client/petstore/qt5cpp/client/SWGApiResponse.h @@ -25,7 +25,7 @@ /* * SWGApiResponse.h * - * + * Describes the result of uploading an image resource */ #ifndef SWGApiResponse_H_ diff --git a/samples/client/petstore/qt5cpp/client/SWGCategory.h b/samples/client/petstore/qt5cpp/client/SWGCategory.h index 44e03dd3a3c6..254862e5c5fd 100644 --- a/samples/client/petstore/qt5cpp/client/SWGCategory.h +++ b/samples/client/petstore/qt5cpp/client/SWGCategory.h @@ -25,7 +25,7 @@ /* * SWGCategory.h * - * + * A category for a pet */ #ifndef SWGCategory_H_ diff --git a/samples/client/petstore/qt5cpp/client/SWGHelpers.cpp b/samples/client/petstore/qt5cpp/client/SWGHelpers.cpp index 27518392f06e..cfc295e7e102 100644 --- a/samples/client/petstore/qt5cpp/client/SWGHelpers.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGHelpers.cpp @@ -117,6 +117,27 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) { qDebug() << "Can't set value because the target pointer is NULL"; } } + else if (QStringLiteral("QByteArray").compare(type) == 0) { + QByteArray **val = static_cast(value); + + if(val != NULL) { + if(!obj.isNull()) { + // create a new value and return + delete *val; + + *val = new QByteArray(QByteArray::fromBase64(QByteArray::fromStdString(obj.toString().toStdString()))); + return; + } + else { + // set target to NULL + delete *val; + *val = NULL; + } + } + else { + qDebug() << "Can't set value because the target pointer is NULL"; + } + } else if(type.startsWith("SWG") && obj.isObject()) { // complex type QJsonObject jsonObj = obj.toObject(); @@ -244,6 +265,10 @@ toJsonValue(QString name, void* value, QJsonObject* output, QString type) { QDateTime* datetime = static_cast(value); output->insert(name, QJsonValue(datetime->toString(Qt::ISODate))); } + else if(QStringLiteral("QByteArray").compare(type) == 0) { + QByteArray* byteArray = static_cast(value); + output->insert(name, QJsonValue(QString(byteArray->toBase64()))); + } } void diff --git a/samples/client/petstore/qt5cpp/client/SWGOrder.cpp b/samples/client/petstore/qt5cpp/client/SWGOrder.cpp index 7c1c5bf273fa..2c640390f38d 100644 --- a/samples/client/petstore/qt5cpp/client/SWGOrder.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGOrder.cpp @@ -51,9 +51,9 @@ SWGOrder::~SWGOrder() { void SWGOrder::init() { id = 0L; -petId = 0L; +pet_id = 0L; quantity = 0; -shipDate = NULL; +ship_date = NULL; status = new QString(""); complete = false; } @@ -63,8 +63,8 @@ SWGOrder::cleanup() { -if(shipDate != NULL) { - delete shipDate; +if(ship_date != NULL) { + delete ship_date; } if(status != NULL) { delete status; @@ -84,9 +84,9 @@ SWGOrder::fromJson(QString &json) { void SWGOrder::fromJsonObject(QJsonObject &pJson) { setValue(&id, pJson["id"], "qint64", ""); -setValue(&petId, pJson["petId"], "qint64", ""); +setValue(&pet_id, pJson["pet_id"], "qint64", ""); setValue(&quantity, pJson["quantity"], "qint32", ""); -setValue(&shipDate, pJson["shipDate"], "QDateTime", "QDateTime"); +setValue(&ship_date, pJson["ship_date"], "QDateTime", "QDateTime"); setValue(&status, pJson["status"], "QString", "QString"); setValue(&complete, pJson["complete"], "bool", ""); } @@ -105,11 +105,11 @@ QJsonObject* SWGOrder::asJsonObject() { QJsonObject* obj = new QJsonObject(); obj->insert("id", QJsonValue(id)); -obj->insert("petId", QJsonValue(petId)); +obj->insert("pet_id", QJsonValue(pet_id)); obj->insert("quantity", QJsonValue(quantity)); - toJsonValue(QString("shipDate"), shipDate, obj, QString("QDateTime")); + toJsonValue(QString("ship_date"), ship_date, obj, QString("QDateTime")); @@ -133,11 +133,11 @@ SWGOrder::setId(qint64 id) { qint64 SWGOrder::getPetId() { - return petId; + return pet_id; } void -SWGOrder::setPetId(qint64 petId) { - this->petId = petId; +SWGOrder::setPetId(qint64 pet_id) { + this->pet_id = pet_id; } qint32 @@ -151,11 +151,11 @@ SWGOrder::setQuantity(qint32 quantity) { QDateTime* SWGOrder::getShipDate() { - return shipDate; + return ship_date; } void -SWGOrder::setShipDate(QDateTime* shipDate) { - this->shipDate = shipDate; +SWGOrder::setShipDate(QDateTime* ship_date) { + this->ship_date = ship_date; } QString* diff --git a/samples/client/petstore/qt5cpp/client/SWGOrder.h b/samples/client/petstore/qt5cpp/client/SWGOrder.h index e5dc8d750415..0a55773c13fa 100644 --- a/samples/client/petstore/qt5cpp/client/SWGOrder.h +++ b/samples/client/petstore/qt5cpp/client/SWGOrder.h @@ -25,7 +25,7 @@ /* * SWGOrder.h * - * + * An order for a pets from the pet store */ #ifndef SWGOrder_H_ @@ -58,11 +58,11 @@ public: qint64 getId(); void setId(qint64 id); qint64 getPetId(); - void setPetId(qint64 petId); + void setPetId(qint64 pet_id); qint32 getQuantity(); void setQuantity(qint32 quantity); QDateTime* getShipDate(); - void setShipDate(QDateTime* shipDate); + void setShipDate(QDateTime* ship_date); QString* getStatus(); void setStatus(QString* status); bool getComplete(); @@ -70,9 +70,9 @@ bool getComplete(); private: qint64 id; -qint64 petId; +qint64 pet_id; qint32 quantity; -QDateTime* shipDate; +QDateTime* ship_date; QString* status; bool complete; }; diff --git a/samples/client/petstore/qt5cpp/client/SWGPet.cpp b/samples/client/petstore/qt5cpp/client/SWGPet.cpp index 5c2ec3f86534..7f927f6c509d 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPet.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGPet.cpp @@ -53,7 +53,7 @@ SWGPet::init() { id = 0L; category = new SWGCategory(); name = new QString(""); -photoUrls = new QList(); +photo_urls = new QList(); tags = new QList(); status = new QString(""); } @@ -67,12 +67,12 @@ if(category != NULL) { if(name != NULL) { delete name; } -if(photoUrls != NULL) { - QList* arr = photoUrls; +if(photo_urls != NULL) { + QList* arr = photo_urls; foreach(QString* o, *arr) { delete o; } - delete photoUrls; + delete photo_urls; } if(tags != NULL) { QList* arr = tags; @@ -100,7 +100,7 @@ SWGPet::fromJsonObject(QJsonObject &pJson) { setValue(&id, pJson["id"], "qint64", ""); setValue(&category, pJson["category"], "SWGCategory", "SWGCategory"); setValue(&name, pJson["name"], "QString", "QString"); -setValue(&photoUrls, pJson["photoUrls"], "QList", "QString"); +setValue(&photo_urls, pJson["photo_urls"], "QList", "QString"); setValue(&tags, pJson["tags"], "QList", "SWGTag"); setValue(&status, pJson["status"], "QString", "QString"); } @@ -131,11 +131,11 @@ SWGPet::asJsonObject() { - QList* photoUrlsList = photoUrls; - QJsonArray photoUrlsJsonArray; - toJsonArray((QList*)photoUrls, &photoUrlsJsonArray, "photoUrls", "QString"); + QList* photo_urlsList = photo_urls; + QJsonArray photo_urlsJsonArray; + toJsonArray((QList*)photo_urls, &photo_urlsJsonArray, "photo_urls", "QString"); - obj->insert("photoUrls", photoUrlsJsonArray); + obj->insert("photo_urls", photo_urlsJsonArray); @@ -183,11 +183,11 @@ SWGPet::setName(QString* name) { QList* SWGPet::getPhotoUrls() { - return photoUrls; + return photo_urls; } void -SWGPet::setPhotoUrls(QList* photoUrls) { - this->photoUrls = photoUrls; +SWGPet::setPhotoUrls(QList* photo_urls) { + this->photo_urls = photo_urls; } QList* diff --git a/samples/client/petstore/qt5cpp/client/SWGPet.h b/samples/client/petstore/qt5cpp/client/SWGPet.h index aa1676d0f87d..faa5a4003f48 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPet.h +++ b/samples/client/petstore/qt5cpp/client/SWGPet.h @@ -25,7 +25,7 @@ /* * SWGPet.h * - * + * A pet for sale in the pet store */ #ifndef SWGPet_H_ @@ -64,7 +64,7 @@ SWGCategory* getCategory(); QString* getName(); void setName(QString* name); QList* getPhotoUrls(); - void setPhotoUrls(QList* photoUrls); + void setPhotoUrls(QList* photo_urls); QList* getTags(); void setTags(QList* tags); QString* getStatus(); @@ -74,7 +74,7 @@ private: qint64 id; SWGCategory* category; QString* name; -QList* photoUrls; +QList* photo_urls; QList* tags; QString* status; }; diff --git a/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp b/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp index 1c607da1071c..8fba5e4757b9 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp @@ -81,12 +81,12 @@ SWGPetApi::addPetCallback(HttpRequestWorker * worker) { emit addPetSignal(); } void -SWGPetApi::deletePet(qint64 petId, QString* apiKey) { +SWGPetApi::deletePet(qint64 pet_id, QString* api_key) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/{petId}"); - QString petIdPathParam("{"); petIdPathParam.append("petId").append("}"); - fullPath.replace(petIdPathParam, stringValue(petId)); + QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}"); + fullPath.replace(pet_idPathParam, stringValue(pet_id)); HttpRequestWorker *worker = new HttpRequestWorker(); @@ -315,12 +315,12 @@ SWGPetApi::findPetsByTagsCallback(HttpRequestWorker * worker) { } void -SWGPetApi::getPetById(qint64 petId) { +SWGPetApi::getPetById(qint64 pet_id) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/{petId}"); - QString petIdPathParam("{"); petIdPathParam.append("petId").append("}"); - fullPath.replace(petIdPathParam, stringValue(petId)); + QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}"); + fullPath.replace(pet_idPathParam, stringValue(pet_id)); HttpRequestWorker *worker = new HttpRequestWorker(); @@ -400,12 +400,12 @@ SWGPetApi::updatePetCallback(HttpRequestWorker * worker) { emit updatePetSignal(); } void -SWGPetApi::updatePetWithForm(qint64 petId, QString* name, QString* status) { +SWGPetApi::updatePetWithForm(qint64 pet_id, QString* name, QString* status) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/{petId}"); - QString petIdPathParam("{"); petIdPathParam.append("petId").append("}"); - fullPath.replace(petIdPathParam, stringValue(petId)); + QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}"); + fullPath.replace(pet_idPathParam, stringValue(pet_id)); HttpRequestWorker *worker = new HttpRequestWorker(); @@ -447,19 +447,19 @@ SWGPetApi::updatePetWithFormCallback(HttpRequestWorker * worker) { emit updatePetWithFormSignal(); } void -SWGPetApi::uploadFile(qint64 petId, QString* additionalMetadata, SWGHttpRequestInputFileElement* file) { +SWGPetApi::uploadFile(qint64 pet_id, QString* additional_metadata, SWGHttpRequestInputFileElement* file) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/pet/{petId}/uploadImage"); - QString petIdPathParam("{"); petIdPathParam.append("petId").append("}"); - fullPath.replace(petIdPathParam, stringValue(petId)); + QString pet_idPathParam("{"); pet_idPathParam.append("petId").append("}"); + fullPath.replace(pet_idPathParam, stringValue(pet_id)); HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "POST"); - if (additionalMetadata != NULL) { - input.add_var("additionalMetadata", *additionalMetadata); + if (additional_metadata != NULL) { + input.add_var("additionalMetadata", *additional_metadata); } if (file != NULL) { input.add_file("file", (*file).local_filename, (*file).request_filename, (*file).mime_type); diff --git a/samples/client/petstore/qt5cpp/client/SWGPetApi.h b/samples/client/petstore/qt5cpp/client/SWGPetApi.h index cc115fa33bf5..87ef70789477 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPetApi.h +++ b/samples/client/petstore/qt5cpp/client/SWGPetApi.h @@ -48,13 +48,13 @@ public: QString basePath; void addPet(SWGPet body); - void deletePet(qint64 petId, QString* apiKey); + void deletePet(qint64 pet_id, QString* api_key); void findPetsByStatus(QList* status); void findPetsByTags(QList* tags); - void getPetById(qint64 petId); + void getPetById(qint64 pet_id); void updatePet(SWGPet body); - void updatePetWithForm(qint64 petId, QString* name, QString* status); - void uploadFile(qint64 petId, QString* additionalMetadata, SWGHttpRequestInputFileElement* file); + void updatePetWithForm(qint64 pet_id, QString* name, QString* status); + void uploadFile(qint64 pet_id, QString* additional_metadata, SWGHttpRequestInputFileElement* file); private: void addPetCallback (HttpRequestWorker * worker); diff --git a/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp b/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp index efa097dcffd9..b68c8d28b6db 100644 --- a/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp @@ -40,12 +40,12 @@ SWGStoreApi::SWGStoreApi(QString host, QString basePath) { } void -SWGStoreApi::deleteOrder(QString* orderId) { +SWGStoreApi::deleteOrder(QString* order_id) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/store/order/{orderId}"); - QString orderIdPathParam("{"); orderIdPathParam.append("orderId").append("}"); - fullPath.replace(orderIdPathParam, stringValue(orderId)); + QString order_idPathParam("{"); order_idPathParam.append("orderId").append("}"); + fullPath.replace(order_idPathParam, stringValue(order_id)); HttpRequestWorker *worker = new HttpRequestWorker(); @@ -135,12 +135,12 @@ SWGStoreApi::getInventoryCallback(HttpRequestWorker * worker) { } void -SWGStoreApi::getOrderById(qint64 orderId) { +SWGStoreApi::getOrderById(qint64 order_id) { QString fullPath; fullPath.append(this->host).append(this->basePath).append("/store/order/{orderId}"); - QString orderIdPathParam("{"); orderIdPathParam.append("orderId").append("}"); - fullPath.replace(orderIdPathParam, stringValue(orderId)); + QString order_idPathParam("{"); order_idPathParam.append("orderId").append("}"); + fullPath.replace(order_idPathParam, stringValue(order_id)); HttpRequestWorker *worker = new HttpRequestWorker(); diff --git a/samples/client/petstore/qt5cpp/client/SWGStoreApi.h b/samples/client/petstore/qt5cpp/client/SWGStoreApi.h index 398349289d68..b33cd51f5d68 100644 --- a/samples/client/petstore/qt5cpp/client/SWGStoreApi.h +++ b/samples/client/petstore/qt5cpp/client/SWGStoreApi.h @@ -46,9 +46,9 @@ public: QString host; QString basePath; - void deleteOrder(QString* orderId); + void deleteOrder(QString* order_id); void getInventory(); - void getOrderById(qint64 orderId); + void getOrderById(qint64 order_id); void placeOrder(SWGOrder body); private: diff --git a/samples/client/petstore/qt5cpp/client/SWGTag.h b/samples/client/petstore/qt5cpp/client/SWGTag.h index 681d74f9ecaa..af0d5a687a09 100644 --- a/samples/client/petstore/qt5cpp/client/SWGTag.h +++ b/samples/client/petstore/qt5cpp/client/SWGTag.h @@ -25,7 +25,7 @@ /* * SWGTag.h * - * + * A tag for a pet */ #ifndef SWGTag_H_ diff --git a/samples/client/petstore/qt5cpp/client/SWGUser.cpp b/samples/client/petstore/qt5cpp/client/SWGUser.cpp index 6b926d25334a..f69839926c6e 100644 --- a/samples/client/petstore/qt5cpp/client/SWGUser.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGUser.cpp @@ -52,12 +52,12 @@ void SWGUser::init() { id = 0L; username = new QString(""); -firstName = new QString(""); -lastName = new QString(""); +first_name = new QString(""); +last_name = new QString(""); email = new QString(""); password = new QString(""); phone = new QString(""); -userStatus = 0; +user_status = 0; } void @@ -66,11 +66,11 @@ SWGUser::cleanup() { if(username != NULL) { delete username; } -if(firstName != NULL) { - delete firstName; +if(first_name != NULL) { + delete first_name; } -if(lastName != NULL) { - delete lastName; +if(last_name != NULL) { + delete last_name; } if(email != NULL) { delete email; @@ -97,12 +97,12 @@ void SWGUser::fromJsonObject(QJsonObject &pJson) { setValue(&id, pJson["id"], "qint64", ""); setValue(&username, pJson["username"], "QString", "QString"); -setValue(&firstName, pJson["firstName"], "QString", "QString"); -setValue(&lastName, pJson["lastName"], "QString", "QString"); +setValue(&first_name, pJson["first_name"], "QString", "QString"); +setValue(&last_name, pJson["last_name"], "QString", "QString"); setValue(&email, pJson["email"], "QString", "QString"); setValue(&password, pJson["password"], "QString", "QString"); setValue(&phone, pJson["phone"], "QString", "QString"); -setValue(&userStatus, pJson["userStatus"], "qint32", ""); +setValue(&user_status, pJson["user_status"], "qint32", ""); } QString @@ -126,12 +126,12 @@ SWGUser::asJsonObject() { - toJsonValue(QString("firstName"), firstName, obj, QString("QString")); + toJsonValue(QString("first_name"), first_name, obj, QString("QString")); - toJsonValue(QString("lastName"), lastName, obj, QString("QString")); + toJsonValue(QString("last_name"), last_name, obj, QString("QString")); @@ -149,7 +149,7 @@ SWGUser::asJsonObject() { toJsonValue(QString("phone"), phone, obj, QString("QString")); -obj->insert("userStatus", QJsonValue(userStatus)); +obj->insert("user_status", QJsonValue(user_status)); return obj; } @@ -174,20 +174,20 @@ SWGUser::setUsername(QString* username) { QString* SWGUser::getFirstName() { - return firstName; + return first_name; } void -SWGUser::setFirstName(QString* firstName) { - this->firstName = firstName; +SWGUser::setFirstName(QString* first_name) { + this->first_name = first_name; } QString* SWGUser::getLastName() { - return lastName; + return last_name; } void -SWGUser::setLastName(QString* lastName) { - this->lastName = lastName; +SWGUser::setLastName(QString* last_name) { + this->last_name = last_name; } QString* @@ -219,11 +219,11 @@ SWGUser::setPhone(QString* phone) { qint32 SWGUser::getUserStatus() { - return userStatus; + return user_status; } void -SWGUser::setUserStatus(qint32 userStatus) { - this->userStatus = userStatus; +SWGUser::setUserStatus(qint32 user_status) { + this->user_status = user_status; } diff --git a/samples/client/petstore/qt5cpp/client/SWGUser.h b/samples/client/petstore/qt5cpp/client/SWGUser.h index ef08a994ea56..b6a5c2ab8536 100644 --- a/samples/client/petstore/qt5cpp/client/SWGUser.h +++ b/samples/client/petstore/qt5cpp/client/SWGUser.h @@ -25,7 +25,7 @@ /* * SWGUser.h * - * + * A User who is purchasing from the pet store */ #ifndef SWGUser_H_ @@ -59,9 +59,9 @@ public: QString* getUsername(); void setUsername(QString* username); QString* getFirstName(); - void setFirstName(QString* firstName); + void setFirstName(QString* first_name); QString* getLastName(); - void setLastName(QString* lastName); + void setLastName(QString* last_name); QString* getEmail(); void setEmail(QString* email); QString* getPassword(); @@ -69,17 +69,17 @@ QString* getPassword(); QString* getPhone(); void setPhone(QString* phone); qint32 getUserStatus(); - void setUserStatus(qint32 userStatus); + void setUserStatus(qint32 user_status); private: qint64 id; QString* username; -QString* firstName; -QString* lastName; +QString* first_name; +QString* last_name; QString* email; QString* password; QString* phone; -qint32 userStatus; +qint32 user_status; }; } /* namespace Swagger */