forked from loafle/openapi-generator-original
* Rename script: qt5-petstore.sh -> cpp-qt5-petstore.sh * Rename sample folder: qt5cpp -> cpp-qt5 * Rename script: cpprest-petstore.sh -> cpp-restsdk-petstore.sh * Rename sample folder: cpprest -> cpp-restsdk * Rename generator: CppRestClientCodegen -> CppRestSdkClientCodegen * Rename script: tizen-petstore.sh -> cpp-tizen-petstore.sh * Rename sample folder: tizen -> cpp-tizen * Rename script(security): qt5cpp-petstore.sh -> cpp-qt5-petstore.sh * Rename sample folder(security): qt5cpp -> cpp-qt5 * Rename script(windows): qt5cpp-petstore.bat -> cpp-qt5-petstore.bat * Change sample folder * Rename script(windows): cpprest-petstore.bat -> cpp-restsdk-petstore.bat * Change sample folder * Rename script(windows): tizen-petstore.bat -> cpp-tizen-petstore.bat * Change sample folder * Change output folder: tizen -> cpp-tizen * Rename the scripts under bin/openapi3 cpp-restsdk is not exist under bin/openapi3 * Change sample folder
146 lines
3.0 KiB
C++
146 lines
3.0 KiB
C++
/**
|
|
* OpenAPI Petstore
|
|
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
|
*
|
|
* OpenAPI spec version: 1.0.0
|
|
*
|
|
*
|
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
* https://openapi-generator.tech
|
|
* Do not edit the class manually.
|
|
*/
|
|
|
|
|
|
#include "OAIApiResponse.h"
|
|
|
|
#include "OAIHelpers.h"
|
|
|
|
#include <QJsonDocument>
|
|
#include <QJsonArray>
|
|
#include <QObject>
|
|
#include <QDebug>
|
|
|
|
namespace OpenAPI {
|
|
|
|
OAIApiResponse::OAIApiResponse(QString json) {
|
|
init();
|
|
this->fromJson(json);
|
|
}
|
|
|
|
OAIApiResponse::OAIApiResponse() {
|
|
init();
|
|
}
|
|
|
|
OAIApiResponse::~OAIApiResponse() {
|
|
this->cleanup();
|
|
}
|
|
|
|
void
|
|
OAIApiResponse::init() {
|
|
code = 0;
|
|
m_code_isSet = false;
|
|
type = new QString("");
|
|
m_type_isSet = false;
|
|
message = new QString("");
|
|
m_message_isSet = false;
|
|
}
|
|
|
|
void
|
|
OAIApiResponse::cleanup() {
|
|
|
|
if(type != nullptr) {
|
|
delete type;
|
|
}
|
|
if(message != nullptr) {
|
|
delete message;
|
|
}
|
|
}
|
|
|
|
OAIApiResponse*
|
|
OAIApiResponse::fromJson(QString json) {
|
|
QByteArray array (json.toStdString().c_str());
|
|
QJsonDocument doc = QJsonDocument::fromJson(array);
|
|
QJsonObject jsonObject = doc.object();
|
|
this->fromJsonObject(jsonObject);
|
|
return this;
|
|
}
|
|
|
|
void
|
|
OAIApiResponse::fromJsonObject(QJsonObject pJson) {
|
|
::OpenAPI::setValue(&code, pJson["code"], "qint32", "");
|
|
|
|
::OpenAPI::setValue(&type, pJson["type"], "QString", "QString");
|
|
|
|
::OpenAPI::setValue(&message, pJson["message"], "QString", "QString");
|
|
|
|
}
|
|
|
|
QString
|
|
OAIApiResponse::asJson ()
|
|
{
|
|
QJsonObject obj = this->asJsonObject();
|
|
QJsonDocument doc(obj);
|
|
QByteArray bytes = doc.toJson();
|
|
return QString(bytes);
|
|
}
|
|
|
|
QJsonObject
|
|
OAIApiResponse::asJsonObject() {
|
|
QJsonObject obj;
|
|
if(m_code_isSet){
|
|
obj.insert("code", QJsonValue(code));
|
|
}
|
|
if(type != nullptr && *type != QString("")){
|
|
toJsonValue(QString("type"), type, obj, QString("QString"));
|
|
}
|
|
if(message != nullptr && *message != QString("")){
|
|
toJsonValue(QString("message"), message, obj, QString("QString"));
|
|
}
|
|
|
|
return obj;
|
|
}
|
|
|
|
qint32
|
|
OAIApiResponse::getCode() {
|
|
return code;
|
|
}
|
|
void
|
|
OAIApiResponse::setCode(qint32 code) {
|
|
this->code = code;
|
|
this->m_code_isSet = true;
|
|
}
|
|
|
|
QString*
|
|
OAIApiResponse::getType() {
|
|
return type;
|
|
}
|
|
void
|
|
OAIApiResponse::setType(QString* type) {
|
|
this->type = type;
|
|
this->m_type_isSet = true;
|
|
}
|
|
|
|
QString*
|
|
OAIApiResponse::getMessage() {
|
|
return message;
|
|
}
|
|
void
|
|
OAIApiResponse::setMessage(QString* message) {
|
|
this->message = message;
|
|
this->m_message_isSet = true;
|
|
}
|
|
|
|
|
|
bool
|
|
OAIApiResponse::isSet(){
|
|
bool isObjectUpdated = false;
|
|
do{
|
|
if(m_code_isSet){ isObjectUpdated = true; break;}
|
|
if(type != nullptr && *type != QString("")){ isObjectUpdated = true; break;}
|
|
if(message != nullptr && *message != QString("")){ isObjectUpdated = true; break;}
|
|
}while(false);
|
|
return isObjectUpdated;
|
|
}
|
|
}
|
|
|