mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 02:55:19 +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) {
|
||||
MapProperty ap = (MapProperty) p;
|
||||
String inner = getSwaggerType(ap.getAdditionalProperties());
|
||||
if (!languageSpecificPrimitives.contains(inner)) {
|
||||
inner += "*";
|
||||
}
|
||||
return "new QMap<QString, " + inner + ">()";
|
||||
} else if (p instanceof ArrayProperty) {
|
||||
ArrayProperty ap = (ArrayProperty) p;
|
||||
|
@ -37,7 +37,7 @@ void
|
||||
{{classname}}::cleanup() {
|
||||
{{#vars}}{{#complexType}}
|
||||
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) {
|
||||
delete o;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user