forked from loafle/openapi-generator-original
[cpp-qt-client] Replace AnyType with QJsonValue (#12642)
This commit is contained in:
parent
22ea4a60a1
commit
c1b8780fff
@ -38,6 +38,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
| Type/Alias | Imports |
|
||||
| ---------- | ------- |
|
||||
|OAIHttpFileElement|#include "OAIHttpFileElement.h"|
|
||||
|QJsonValue|#include <QJsonValue>|
|
||||
|
||||
|
||||
## INSTANTIATION TYPES
|
||||
|
@ -108,7 +108,9 @@ public class CppQtClientCodegen extends CppQtAbstractCodegen implements CodegenC
|
||||
supportingFiles.add(new SupportingFile("Project.mustache", sourceFolder, "client.pri"));
|
||||
}
|
||||
typeMapping.put("file", PREFIX + "HttpFileElement");
|
||||
typeMapping.put("AnyType", "QJsonValue");
|
||||
importMapping.put(PREFIX + "HttpFileElement", "#include \"" + PREFIX + "HttpFileElement.h\"");
|
||||
importMapping.put("QJsonValue", "#include <QJsonValue>");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -140,7 +142,9 @@ public class CppQtClientCodegen extends CppQtAbstractCodegen implements CodegenC
|
||||
|
||||
|
||||
typeMapping.put("file", modelNamePrefix + "HttpFileElement");
|
||||
typeMapping.put("AnyType", "QJsonValue");
|
||||
importMapping.put(modelNamePrefix + "HttpFileElement", "#include \"" + modelNamePrefix + "HttpFileElement.h\"");
|
||||
importMapping.put("QJsonValue", "#include <QJsonValue>");
|
||||
if (optionalProjectFileFlag) {
|
||||
supportingFiles.add(new SupportingFile("Project.mustache", sourceFolder, modelNamePrefix + "client.pri"));
|
||||
}
|
||||
|
@ -186,6 +186,10 @@ QJsonValue toJsonValue(const {{prefix}}HttpFileElement &value) {
|
||||
return value.asJsonValue();
|
||||
}
|
||||
|
||||
QJsonValue toJsonValue(const QJsonValue &value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
bool fromStringValue(const QString &inStr, QString &value) {
|
||||
value.clear();
|
||||
value.append(inStr);
|
||||
@ -415,6 +419,11 @@ bool fromJsonValue({{prefix}}HttpFileElement &value, const QJsonValue &jval) {
|
||||
return value.fromJsonValue(jval);
|
||||
}
|
||||
|
||||
bool fromJsonValue(QJsonValue &value, const QJsonValue &jval) {
|
||||
value = jval;
|
||||
return true;
|
||||
}
|
||||
|
||||
{{#cppNamespaceDeclarations}}
|
||||
} // namespace {{this}}
|
||||
{{/cppNamespaceDeclarations}}
|
||||
|
@ -127,6 +127,7 @@ QJsonValue toJsonValue(const double &value);
|
||||
QJsonValue toJsonValue(const {{prefix}}Object &value);
|
||||
QJsonValue toJsonValue(const {{prefix}}Enum &value);
|
||||
QJsonValue toJsonValue(const {{prefix}}HttpFileElement &value);
|
||||
QJsonValue toJsonValue(const QJsonValue &value);
|
||||
|
||||
template <typename T>
|
||||
QJsonValue toJsonValue(const QList<T> &val) {
|
||||
@ -213,6 +214,7 @@ bool fromJsonValue(double &value, const QJsonValue &jval);
|
||||
bool fromJsonValue({{prefix}}Object &value, const QJsonValue &jval);
|
||||
bool fromJsonValue({{prefix}}Enum &value, const QJsonValue &jval);
|
||||
bool fromJsonValue({{prefix}}HttpFileElement &value, const QJsonValue &jval);
|
||||
bool fromJsonValue(QJsonValue &value, const QJsonValue &jval);
|
||||
|
||||
template <typename T>
|
||||
bool fromJsonValue(QList<T> &val, const QJsonValue &jval) {
|
||||
|
@ -194,6 +194,10 @@ QJsonValue toJsonValue(const PFXHttpFileElement &value) {
|
||||
return value.asJsonValue();
|
||||
}
|
||||
|
||||
QJsonValue toJsonValue(const QJsonValue &value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
bool fromStringValue(const QString &inStr, QString &value) {
|
||||
value.clear();
|
||||
value.append(inStr);
|
||||
@ -423,4 +427,9 @@ bool fromJsonValue(PFXHttpFileElement &value, const QJsonValue &jval) {
|
||||
return value.fromJsonValue(jval);
|
||||
}
|
||||
|
||||
bool fromJsonValue(QJsonValue &value, const QJsonValue &jval) {
|
||||
value = jval;
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace test_namespace
|
||||
|
@ -135,6 +135,7 @@ QJsonValue toJsonValue(const double &value);
|
||||
QJsonValue toJsonValue(const PFXObject &value);
|
||||
QJsonValue toJsonValue(const PFXEnum &value);
|
||||
QJsonValue toJsonValue(const PFXHttpFileElement &value);
|
||||
QJsonValue toJsonValue(const QJsonValue &value);
|
||||
|
||||
template <typename T>
|
||||
QJsonValue toJsonValue(const QList<T> &val) {
|
||||
@ -221,6 +222,7 @@ bool fromJsonValue(double &value, const QJsonValue &jval);
|
||||
bool fromJsonValue(PFXObject &value, const QJsonValue &jval);
|
||||
bool fromJsonValue(PFXEnum &value, const QJsonValue &jval);
|
||||
bool fromJsonValue(PFXHttpFileElement &value, const QJsonValue &jval);
|
||||
bool fromJsonValue(QJsonValue &value, const QJsonValue &jval);
|
||||
|
||||
template <typename T>
|
||||
bool fromJsonValue(QList<T> &val, const QJsonValue &jval) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user