Skip to content

Commit

Permalink
[QT5][CPP] Fixing issue with maps in models (#6479)
Browse files Browse the repository at this point in the history
* [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
  • Loading branch information
stkrwork authored and wing328 committed Sep 19, 2017
1 parent f3c41e8 commit 5443c0a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@ public String toDefaultValue(Property p) {
} 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 5443c0a

Please sign in to comment.