Last active
June 19, 2017 12:45
-
-
Save manuc66/730be9e25488450ebf99ba69196790db to your computer and use it in GitHub Desktop.
Result of generation for a model with additionalProperties to object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "SWGError.h" | |
#include "SWGHelpers.h" | |
#include <QJsonDocument> | |
#include <QJsonArray> | |
#include <QObject> | |
#include <QDebug> | |
namespace com { | |
SWGError::SWGError(QString* json) { | |
init(); | |
this->fromJson(*json); | |
} | |
SWGError::SWGError() { | |
init(); | |
} | |
SWGError::~SWGError() { | |
this->cleanup(); | |
} | |
void | |
SWGError::init() { | |
_type = new QString(""); | |
key = new QString(""); | |
message = new QString(""); | |
} | |
void | |
SWGError::cleanup() { | |
if(_type != nullptr) { | |
delete _type; | |
} | |
if(key != nullptr) { | |
delete key; | |
} | |
if(message != nullptr) { | |
delete message; | |
} | |
} | |
SWGError* | |
SWGError::fromJson(QString &json) { | |
QByteArray array (json.toStdString().c_str()); | |
QJsonDocument doc = QJsonDocument::fromJson(array); | |
QJsonObject jsonObject = doc.object(); | |
this->fromJsonObject(jsonObject); | |
return this; | |
} | |
void | |
SWGError::fromJsonObject(QJsonObject &pJson) { | |
::com::setValue(&_type, pJson["_type"], "QString", "QString"); | |
::com::setValue(&key, pJson["key"], "QString", "QString"); | |
::com::setValue(&message, pJson["message"], "QString", "QString"); | |
} | |
QString | |
SWGError::asJson () | |
{ | |
QJsonObject* obj = this->asJsonObject(); | |
QJsonDocument doc(*obj); | |
QByteArray bytes = doc.toJson(); | |
return QString(bytes); | |
} | |
QJsonObject* | |
SWGError::asJsonObject() { | |
QJsonObject* obj = new QJsonObject(); | |
toJsonValue(QString("_type"), _type, obj, QString("QString")); | |
toJsonValue(QString("key"), key, obj, QString("QString")); | |
toJsonValue(QString("message"), message, obj, QString("QString")); | |
return obj; | |
} | |
QString* | |
SWGError::getType() { | |
return _type; | |
} | |
void | |
SWGError::setType(QString* _type) { | |
this->_type = _type; | |
} | |
QString* | |
SWGError::getKey() { | |
return key; | |
} | |
void | |
SWGError::setKey(QString* key) { | |
this->key = key; | |
} | |
QString* | |
SWGError::getMessage() { | |
return message; | |
} | |
void | |
SWGError::setMessage(QString* message) { | |
this->message = message; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment