mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 10:58:55 +00:00
[QT5][CPP] Fixing issue with maps in models (#6479)
* [QT5][CPP] Fixing issue with maps in models - Adjusted init function to init map correctly - Adjusted cleanup function to cleanup maps correctly * Fixed formatting for samples
This commit is contained in:
parent
f3c41e866c
commit
5443c0a94c
@ -317,6 +317,9 @@ public class Qt5CPPGenerator extends AbstractCppCodegen implements CodegenConfig
|
|||||||
} else if (p instanceof MapProperty) {
|
} else if (p instanceof MapProperty) {
|
||||||
MapProperty ap = (MapProperty) p;
|
MapProperty ap = (MapProperty) p;
|
||||||
String inner = getSwaggerType(ap.getAdditionalProperties());
|
String inner = getSwaggerType(ap.getAdditionalProperties());
|
||||||
|
if (!languageSpecificPrimitives.contains(inner)) {
|
||||||
|
inner += "*";
|
||||||
|
}
|
||||||
return "new QMap<QString, " + inner + ">()";
|
return "new QMap<QString, " + inner + ">()";
|
||||||
} else if (p instanceof ArrayProperty) {
|
} else if (p instanceof ArrayProperty) {
|
||||||
ArrayProperty ap = (ArrayProperty) p;
|
ArrayProperty ap = (ArrayProperty) p;
|
||||||
|
@ -37,7 +37,7 @@ void
|
|||||||
{{classname}}::cleanup() {
|
{{classname}}::cleanup() {
|
||||||
{{#vars}}{{#complexType}}
|
{{#vars}}{{#complexType}}
|
||||||
if({{name}} != nullptr) {
|
if({{name}} != nullptr) {
|
||||||
{{#isContainer}}QList<{{complexType}}*>* arr = {{name}};
|
{{#isContainer}}{{#isListContainer}}QList<{{complexType}}*>* arr = {{name}};{{/isListContainer}}{{#isMapContainer}}QMap<QString, {{complexType}}*>* arr = {{name}};{{/isMapContainer}}
|
||||||
foreach({{complexType}}* o, *arr) {
|
foreach({{complexType}}* o, *arr) {
|
||||||
delete o;
|
delete o;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user