mirror of
				https://github.com/OpenAPITools/openapi-generator.git
				synced 2025-10-31 16:53:54 +00:00 
			
		
		
		
	remove spaces, empty lines from qt5cpp client (#6956)
This commit is contained in:
		
							parent
							
								
									47f1865e69
								
							
						
					
					
						commit
						744c7d904a
					
				| @ -35,7 +35,8 @@ void | ||||
| 
 | ||||
| void | ||||
| {{classname}}::cleanup() { | ||||
|     {{#vars}}{{#complexType}} | ||||
|     {{#vars}} | ||||
|     {{#complexType}} | ||||
|     if({{name}} != nullptr) { | ||||
|         {{#isContainer}}{{#isListContainer}}QList<{{complexType}}*>* arr = {{name}};{{/isListContainer}}{{#isMapContainer}}QMap<QString, {{complexType}}*>* arr = {{name}};{{/isMapContainer}} | ||||
|         foreach({{complexType}}* o, *arr) { | ||||
| @ -58,10 +59,16 @@ void | ||||
| void | ||||
| {{classname}}::fromJsonObject(QJsonObject &pJson) { | ||||
|     {{#vars}} | ||||
|     {{^isContainer}}::{{cppNamespace}}::setValue(&{{name}}, pJson["{{baseName}}"], "{{baseType}}", "{{complexType}}");{{/isContainer}}  | ||||
|     {{^isContainer}} | ||||
|     ::{{cppNamespace}}::setValue(&{{name}}, pJson["{{baseName}}"], "{{baseType}}", "{{complexType}}"); | ||||
|     {{/isContainer}} | ||||
|     {{#isListContainer}} | ||||
|     {{#complexType}}::{{cppNamespace}}::setValue(&{{name}}, pJson["{{baseName}}"], "{{baseType}}", "{{complexType}}");{{/complexType}} | ||||
|     {{^complexType}}::{{cppNamespace}}::setValue(&{{name}}, pJson["{{baseName}}"], "{{baseType}}", "{{items.baseType}}");{{/complexType}} | ||||
|     {{#complexType}} | ||||
|     ::{{cppNamespace}}::setValue(&{{name}}, pJson["{{baseName}}"], "{{baseType}}", "{{complexType}}"); | ||||
|     {{/complexType}} | ||||
|     {{^complexType}} | ||||
|     ::{{cppNamespace}}::setValue(&{{name}}, pJson["{{baseName}}"], "{{baseType}}", "{{items.baseType}}"); | ||||
|     {{/complexType}} | ||||
|     {{/isListContainer}}         | ||||
|     {{#isMapContainer}}     | ||||
|     if( pJson["{{baseName}}"].isObject()){ | ||||
| @ -95,32 +102,52 @@ QString | ||||
| QJsonObject* | ||||
| {{classname}}::asJsonObject() { | ||||
|     QJsonObject* obj = new QJsonObject(); | ||||
|     {{#vars}}{{#complexType}}{{^isContainer}}{{#complexType}} | ||||
|     toJsonValue(QString("{{baseName}}"), {{name}}, obj, QString("{{complexType}}"));{{/complexType}}{{^complexType}} | ||||
|     {{#vars}} | ||||
|     {{#complexType}} | ||||
|     {{^isContainer}} | ||||
|     {{#complexType}} | ||||
|     toJsonValue(QString("{{baseName}}"), {{name}}, obj, QString("{{complexType}}")); | ||||
|     {{/complexType}} | ||||
|     {{^complexType}} | ||||
|     if({{name}} != nullptr && *{{name}} != nullptr) {  | ||||
|         obj->insert("{{name}}", QJsonValue(*{{name}})); | ||||
|     }{{/complexType}}{{/isContainer}}{{#isListContainer}} | ||||
|     } | ||||
|     {{/complexType}} | ||||
|     {{/isContainer}} | ||||
|     {{#isListContainer}} | ||||
|     QJsonArray {{name}}JsonArray; | ||||
|     toJsonArray((QList<void*>*){{name}}, &{{name}}JsonArray, "{{name}}", "{{complexType}}"); | ||||
|     obj->insert("{{baseName}}", {{name}}JsonArray);{{/isListContainer}}{{#isMapContainer}} | ||||
|     obj->insert("{{baseName}}", {{name}}JsonArray); | ||||
|     {{/isListContainer}} | ||||
|     {{#isMapContainer}} | ||||
|     QJsonArray {{name}}JsonArray; | ||||
|     for(auto keyval : {{name}}->keys()){ | ||||
| 	    QJsonObject {{name}}_jobj; | ||||
| 	    toJsonValue(keyval, ((*{{name}})[keyval]), &{{name}}_jobj, "{{complexType}}"); | ||||
| 	    {{name}}JsonArray.append({{name}}_jobj); | ||||
| 	}    | ||||
|     obj->insert("{{baseName}}", {{name}}JsonArray);{{/isMapContainer}}{{/complexType}}{{^complexType}}{{^isContainer}} | ||||
|     obj->insert("{{baseName}}", QJsonValue({{name}}));{{/isContainer}}{{#isListContainer}} | ||||
|     obj->insert("{{baseName}}", {{name}}JsonArray); | ||||
|     {{/isMapContainer}} | ||||
|     {{/complexType}} | ||||
|     {{^complexType}} | ||||
|     {{^isContainer}} | ||||
|     obj->insert("{{baseName}}", QJsonValue({{name}})); | ||||
|     {{/isContainer}} | ||||
|     {{#isListContainer}} | ||||
|     QJsonArray {{name}}JsonArray; | ||||
|     toJsonArray((QList<void*>*){{name}}, &{{name}}JsonArray, "{{name}}", "{{items.baseType}}"); | ||||
|     obj->insert("{{baseName}}", {{name}}JsonArray);{{/isListContainer}}{{#isMapContainer}} | ||||
|     obj->insert("{{baseName}}", {{name}}JsonArray); | ||||
|     {{/isListContainer}} | ||||
|     {{#isMapContainer}} | ||||
|     QJsonArray {{name}}JsonArray; | ||||
|     for(auto keyval : {{name}}->keys()){ | ||||
| 	    QJsonObject {{name}}_jobj; | ||||
| 	    toJsonValue(keyval, ((*{{name}})[keyval]), &{{name}}_jobj, "{{items.baseType}}"); | ||||
| 	    {{name}}JsonArray.append(portsobj); | ||||
| 	}      | ||||
|     obj->insert("{{baseName}}", {{name}}JsonArray);{{/isMapContainer}}{{/complexType}} | ||||
|     obj->insert("{{baseName}}", {{name}}JsonArray); | ||||
|     {{/isMapContainer}} | ||||
|     {{/complexType}} | ||||
|     {{/vars}} | ||||
| 
 | ||||
|     return obj; | ||||
|  | ||||
| @ -16,7 +16,8 @@ | ||||
| 
 | ||||
| #include "SWGObject.h" | ||||
| 
 | ||||
| {{#models}}{{#model}} | ||||
| {{#models}} | ||||
| {{#model}} | ||||
| {{#cppNamespaceDeclarations}} | ||||
| namespace {{this}} { | ||||
| {{/cppNamespaceDeclarations}} | ||||
|  | ||||
| @ -21,7 +21,8 @@ using namespace Tizen::Web::Json; | ||||
| {{#imports}}{{{import}}} | ||||
| {{/imports}} | ||||
| 
 | ||||
| {{#models}}{{#model}} | ||||
| {{#models}} | ||||
| {{#model}} | ||||
| 
 | ||||
| {{#cppNamespaceDeclarations}} | ||||
| namespace {{this}} { | ||||
| @ -47,11 +48,12 @@ public: | ||||
| 
 | ||||
|     {{#vars}} | ||||
|     {{datatype}} {{getter}}(); | ||||
|     void {{setter}}({{datatype}} {{name}}); | ||||
|     void {{setter}}({{{datatype}}} {{name}}); | ||||
|     {{/vars}} | ||||
| 
 | ||||
| private: | ||||
|     {{#vars}}{{datatype}} {{name}}; | ||||
|     {{#vars}} | ||||
|     {{{datatype}}} {{name}}; | ||||
|     {{/vars}} | ||||
| }; | ||||
| 
 | ||||
|  | ||||
| @ -44,12 +44,10 @@ SWGApiResponse::init() { | ||||
| 
 | ||||
| void | ||||
| SWGApiResponse::cleanup() { | ||||
|      | ||||
| 
 | ||||
|     if(type != nullptr) { | ||||
|         delete type; | ||||
|     } | ||||
| 
 | ||||
|     if(message != nullptr) { | ||||
|         delete message; | ||||
|     } | ||||
| @ -84,11 +82,8 @@ SWGApiResponse::asJson () | ||||
| QJsonObject* | ||||
| SWGApiResponse::asJsonObject() { | ||||
|     QJsonObject* obj = new QJsonObject(); | ||||
|      | ||||
|     obj->insert("code", QJsonValue(code)); | ||||
| 
 | ||||
|     toJsonValue(QString("type"), type, obj, QString("QString")); | ||||
| 
 | ||||
|     toJsonValue(QString("message"), message, obj, QString("QString")); | ||||
| 
 | ||||
|     return obj; | ||||
|  | ||||
| @ -26,7 +26,6 @@ | ||||
| 
 | ||||
| #include "SWGObject.h" | ||||
| 
 | ||||
| 
 | ||||
| namespace Swagger { | ||||
| 
 | ||||
| class SWGApiResponse: public SWGObject { | ||||
|  | ||||
| @ -43,7 +43,6 @@ SWGCategory::init() { | ||||
| 
 | ||||
| void | ||||
| SWGCategory::cleanup() { | ||||
|      | ||||
| 
 | ||||
|     if(name != nullptr) { | ||||
|         delete name; | ||||
| @ -78,9 +77,7 @@ SWGCategory::asJson () | ||||
| QJsonObject* | ||||
| SWGCategory::asJsonObject() { | ||||
|     QJsonObject* obj = new QJsonObject(); | ||||
|      | ||||
|     obj->insert("id", QJsonValue(id)); | ||||
| 
 | ||||
|     toJsonValue(QString("name"), name, obj, QString("QString")); | ||||
| 
 | ||||
|     return obj; | ||||
|  | ||||
| @ -26,7 +26,6 @@ | ||||
| 
 | ||||
| #include "SWGObject.h" | ||||
| 
 | ||||
| 
 | ||||
| namespace Swagger { | ||||
| 
 | ||||
| class SWGCategory: public SWGObject { | ||||
|  | ||||
| @ -47,14 +47,12 @@ SWGOrder::init() { | ||||
| 
 | ||||
| void | ||||
| SWGOrder::cleanup() { | ||||
|      | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     if(ship_date != nullptr) { | ||||
|         delete ship_date; | ||||
|     } | ||||
| 
 | ||||
|     if(status != nullptr) { | ||||
|         delete status; | ||||
|     } | ||||
| @ -93,17 +91,11 @@ SWGOrder::asJson () | ||||
| QJsonObject* | ||||
| SWGOrder::asJsonObject() { | ||||
|     QJsonObject* obj = new QJsonObject(); | ||||
|      | ||||
|     obj->insert("id", QJsonValue(id)); | ||||
| 
 | ||||
|     obj->insert("petId", QJsonValue(pet_id)); | ||||
| 
 | ||||
|     obj->insert("quantity", QJsonValue(quantity)); | ||||
| 
 | ||||
|     toJsonValue(QString("shipDate"), ship_date, obj, QString("QDateTime")); | ||||
| 
 | ||||
|     toJsonValue(QString("status"), status, obj, QString("QString")); | ||||
| 
 | ||||
|     obj->insert("complete", QJsonValue(complete)); | ||||
| 
 | ||||
|     return obj; | ||||
|  | ||||
| @ -27,7 +27,6 @@ | ||||
| 
 | ||||
| #include "SWGObject.h" | ||||
| 
 | ||||
| 
 | ||||
| namespace Swagger { | ||||
| 
 | ||||
| class SWGOrder: public SWGObject { | ||||
|  | ||||
| @ -47,16 +47,13 @@ SWGPet::init() { | ||||
| 
 | ||||
| void | ||||
| SWGPet::cleanup() { | ||||
|      | ||||
| 
 | ||||
|     if(category != nullptr) { | ||||
|         delete category; | ||||
|     } | ||||
| 
 | ||||
|     if(name != nullptr) { | ||||
|         delete name; | ||||
|     } | ||||
| 
 | ||||
|     if(photo_urls != nullptr) { | ||||
|         QList<QString*>* arr = photo_urls; | ||||
|         foreach(QString* o, *arr) { | ||||
| @ -64,7 +61,6 @@ SWGPet::cleanup() { | ||||
|         } | ||||
|         delete photo_urls; | ||||
|     } | ||||
| 
 | ||||
|     if(tags != nullptr) { | ||||
|         QList<SWGTag*>* arr = tags; | ||||
|         foreach(SWGTag* o, *arr) { | ||||
| @ -72,7 +68,6 @@ SWGPet::cleanup() { | ||||
|         } | ||||
|         delete tags; | ||||
|     } | ||||
| 
 | ||||
|     if(status != nullptr) { | ||||
|         delete status; | ||||
|     } | ||||
| @ -92,12 +87,8 @@ SWGPet::fromJsonObject(QJsonObject &pJson) { | ||||
|     ::Swagger::setValue(&id, pJson["id"], "qint64", ""); | ||||
|     ::Swagger::setValue(&category, pJson["category"], "SWGCategory", "SWGCategory"); | ||||
|     ::Swagger::setValue(&name, pJson["name"], "QString", "QString"); | ||||
|      | ||||
|     ::Swagger::setValue(&photo_urls, pJson["photoUrls"], "QList", "QString"); | ||||
|      | ||||
|      | ||||
|     ::Swagger::setValue(&tags, pJson["tags"], "QList", "SWGTag"); | ||||
|      | ||||
|     ::Swagger::setValue(&status, pJson["status"], "QString", "QString"); | ||||
| } | ||||
| 
 | ||||
| @ -114,21 +105,15 @@ SWGPet::asJson () | ||||
| QJsonObject* | ||||
| SWGPet::asJsonObject() { | ||||
|     QJsonObject* obj = new QJsonObject(); | ||||
|      | ||||
|     obj->insert("id", QJsonValue(id)); | ||||
| 
 | ||||
|     toJsonValue(QString("category"), category, obj, QString("SWGCategory")); | ||||
| 
 | ||||
|     toJsonValue(QString("name"), name, obj, QString("QString")); | ||||
| 
 | ||||
|     QJsonArray photo_urlsJsonArray; | ||||
|     toJsonArray((QList<void*>*)photo_urls, &photo_urlsJsonArray, "photo_urls", "QString"); | ||||
|     obj->insert("photoUrls", photo_urlsJsonArray); | ||||
| 
 | ||||
|     QJsonArray tagsJsonArray; | ||||
|     toJsonArray((QList<void*>*)tags, &tagsJsonArray, "tags", "SWGTag"); | ||||
|     obj->insert("tags", tagsJsonArray); | ||||
| 
 | ||||
|     toJsonValue(QString("status"), status, obj, QString("QString")); | ||||
| 
 | ||||
|     return obj; | ||||
|  | ||||
| @ -29,7 +29,6 @@ | ||||
| 
 | ||||
| #include "SWGObject.h" | ||||
| 
 | ||||
| 
 | ||||
| namespace Swagger { | ||||
| 
 | ||||
| class SWGPet: public SWGObject { | ||||
|  | ||||
| @ -43,7 +43,6 @@ SWGTag::init() { | ||||
| 
 | ||||
| void | ||||
| SWGTag::cleanup() { | ||||
|      | ||||
| 
 | ||||
|     if(name != nullptr) { | ||||
|         delete name; | ||||
| @ -78,9 +77,7 @@ SWGTag::asJson () | ||||
| QJsonObject* | ||||
| SWGTag::asJsonObject() { | ||||
|     QJsonObject* obj = new QJsonObject(); | ||||
|      | ||||
|     obj->insert("id", QJsonValue(id)); | ||||
| 
 | ||||
|     toJsonValue(QString("name"), name, obj, QString("QString")); | ||||
| 
 | ||||
|     return obj; | ||||
|  | ||||
| @ -26,7 +26,6 @@ | ||||
| 
 | ||||
| #include "SWGObject.h" | ||||
| 
 | ||||
| 
 | ||||
| namespace Swagger { | ||||
| 
 | ||||
| class SWGTag: public SWGObject { | ||||
|  | ||||
| @ -49,28 +49,22 @@ SWGUser::init() { | ||||
| 
 | ||||
| void | ||||
| SWGUser::cleanup() { | ||||
|      | ||||
| 
 | ||||
|     if(username != nullptr) { | ||||
|         delete username; | ||||
|     } | ||||
| 
 | ||||
|     if(first_name != nullptr) { | ||||
|         delete first_name; | ||||
|     } | ||||
| 
 | ||||
|     if(last_name != nullptr) { | ||||
|         delete last_name; | ||||
|     } | ||||
| 
 | ||||
|     if(email != nullptr) { | ||||
|         delete email; | ||||
|     } | ||||
| 
 | ||||
|     if(password != nullptr) { | ||||
|         delete password; | ||||
|     } | ||||
| 
 | ||||
|     if(phone != nullptr) { | ||||
|         delete phone; | ||||
|     } | ||||
| @ -111,21 +105,13 @@ SWGUser::asJson () | ||||
| QJsonObject* | ||||
| SWGUser::asJsonObject() { | ||||
|     QJsonObject* obj = new QJsonObject(); | ||||
|      | ||||
|     obj->insert("id", QJsonValue(id)); | ||||
| 
 | ||||
|     toJsonValue(QString("username"), username, obj, QString("QString")); | ||||
| 
 | ||||
|     toJsonValue(QString("firstName"), first_name, obj, QString("QString")); | ||||
| 
 | ||||
|     toJsonValue(QString("lastName"), last_name, obj, QString("QString")); | ||||
| 
 | ||||
|     toJsonValue(QString("email"), email, obj, QString("QString")); | ||||
| 
 | ||||
|     toJsonValue(QString("password"), password, obj, QString("QString")); | ||||
| 
 | ||||
|     toJsonValue(QString("phone"), phone, obj, QString("QString")); | ||||
| 
 | ||||
|     obj->insert("userStatus", QJsonValue(user_status)); | ||||
| 
 | ||||
|     return obj; | ||||
|  | ||||
| @ -26,7 +26,6 @@ | ||||
| 
 | ||||
| #include "SWGObject.h" | ||||
| 
 | ||||
| 
 | ||||
| namespace Swagger { | ||||
| 
 | ||||
| class SWGUser: public SWGObject { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user