forked from loafle/openapi-generator-original
251 lines
5.9 KiB
C++
251 lines
5.9 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.
|
|
*
|
|
* The version of the OpenAPI document: 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 "PFXPet.h"
|
|
|
|
#include <QDebug>
|
|
#include <QJsonArray>
|
|
#include <QJsonDocument>
|
|
#include <QObject>
|
|
|
|
#include "PFXHelpers.h"
|
|
|
|
namespace test_namespace {
|
|
|
|
PFXPet::PFXPet(QString json) {
|
|
this->initializeModel();
|
|
this->fromJson(json);
|
|
}
|
|
|
|
PFXPet::PFXPet() {
|
|
this->initializeModel();
|
|
}
|
|
|
|
PFXPet::~PFXPet() {}
|
|
|
|
void PFXPet::initializeModel() {
|
|
|
|
m_id_isSet = false;
|
|
m_id_isValid = false;
|
|
|
|
m_category_isSet = false;
|
|
m_category_isValid = false;
|
|
|
|
m_name_isSet = false;
|
|
m_name_isValid = false;
|
|
|
|
m_photo_urls_isSet = false;
|
|
m_photo_urls_isValid = false;
|
|
|
|
m_tags_isSet = false;
|
|
m_tags_isValid = false;
|
|
|
|
m_status_isSet = false;
|
|
m_status_isValid = false;
|
|
}
|
|
|
|
void PFXPet::fromJson(QString jsonString) {
|
|
QByteArray array(jsonString.toStdString().c_str());
|
|
QJsonDocument doc = QJsonDocument::fromJson(array);
|
|
QJsonObject jsonObject = doc.object();
|
|
this->fromJsonObject(jsonObject);
|
|
}
|
|
|
|
void PFXPet::fromJsonObject(QJsonObject json) {
|
|
|
|
m_id_isValid = ::test_namespace::fromJsonValue(m_id, json[QString("id")]);
|
|
m_id_isSet = !json[QString("id")].isNull() && m_id_isValid;
|
|
|
|
m_category_isValid = ::test_namespace::fromJsonValue(m_category, json[QString("category")]);
|
|
m_category_isSet = !json[QString("category")].isNull() && m_category_isValid;
|
|
|
|
m_name_isValid = ::test_namespace::fromJsonValue(m_name, json[QString("name")]);
|
|
m_name_isSet = !json[QString("name")].isNull() && m_name_isValid;
|
|
|
|
m_photo_urls_isValid = ::test_namespace::fromJsonValue(m_photo_urls, json[QString("photoUrls")]);
|
|
m_photo_urls_isSet = !json[QString("photoUrls")].isNull() && m_photo_urls_isValid;
|
|
|
|
m_tags_isValid = ::test_namespace::fromJsonValue(m_tags, json[QString("tags")]);
|
|
m_tags_isSet = !json[QString("tags")].isNull() && m_tags_isValid;
|
|
|
|
m_status_isValid = ::test_namespace::fromJsonValue(m_status, json[QString("status")]);
|
|
m_status_isSet = !json[QString("status")].isNull() && m_status_isValid;
|
|
}
|
|
|
|
QString PFXPet::asJson() const {
|
|
QJsonObject obj = this->asJsonObject();
|
|
QJsonDocument doc(obj);
|
|
QByteArray bytes = doc.toJson();
|
|
return QString(bytes);
|
|
}
|
|
|
|
QJsonObject PFXPet::asJsonObject() const {
|
|
QJsonObject obj;
|
|
if (m_id_isSet) {
|
|
obj.insert(QString("id"), ::test_namespace::toJsonValue(m_id));
|
|
}
|
|
if (m_category.isSet()) {
|
|
obj.insert(QString("category"), ::test_namespace::toJsonValue(m_category));
|
|
}
|
|
if (m_name_isSet) {
|
|
obj.insert(QString("name"), ::test_namespace::toJsonValue(m_name));
|
|
}
|
|
if (m_photo_urls.size() > 0) {
|
|
obj.insert(QString("photoUrls"), ::test_namespace::toJsonValue(m_photo_urls));
|
|
}
|
|
if (m_tags.size() > 0) {
|
|
obj.insert(QString("tags"), ::test_namespace::toJsonValue(m_tags));
|
|
}
|
|
if (m_status_isSet) {
|
|
obj.insert(QString("status"), ::test_namespace::toJsonValue(m_status));
|
|
}
|
|
return obj;
|
|
}
|
|
|
|
qint64 PFXPet::getId() const {
|
|
return m_id;
|
|
}
|
|
void PFXPet::setId(const qint64 &id) {
|
|
m_id = id;
|
|
m_id_isSet = true;
|
|
}
|
|
|
|
bool PFXPet::is_id_Set() const{
|
|
return m_id_isSet;
|
|
}
|
|
|
|
bool PFXPet::is_id_Valid() const{
|
|
return m_id_isValid;
|
|
}
|
|
|
|
PFXCategory PFXPet::getCategory() const {
|
|
return m_category;
|
|
}
|
|
void PFXPet::setCategory(const PFXCategory &category) {
|
|
m_category = category;
|
|
m_category_isSet = true;
|
|
}
|
|
|
|
bool PFXPet::is_category_Set() const{
|
|
return m_category_isSet;
|
|
}
|
|
|
|
bool PFXPet::is_category_Valid() const{
|
|
return m_category_isValid;
|
|
}
|
|
|
|
QString PFXPet::getName() const {
|
|
return m_name;
|
|
}
|
|
void PFXPet::setName(const QString &name) {
|
|
m_name = name;
|
|
m_name_isSet = true;
|
|
}
|
|
|
|
bool PFXPet::is_name_Set() const{
|
|
return m_name_isSet;
|
|
}
|
|
|
|
bool PFXPet::is_name_Valid() const{
|
|
return m_name_isValid;
|
|
}
|
|
|
|
QList<QString> PFXPet::getPhotoUrls() const {
|
|
return m_photo_urls;
|
|
}
|
|
void PFXPet::setPhotoUrls(const QList<QString> &photo_urls) {
|
|
m_photo_urls = photo_urls;
|
|
m_photo_urls_isSet = true;
|
|
}
|
|
|
|
bool PFXPet::is_photo_urls_Set() const{
|
|
return m_photo_urls_isSet;
|
|
}
|
|
|
|
bool PFXPet::is_photo_urls_Valid() const{
|
|
return m_photo_urls_isValid;
|
|
}
|
|
|
|
QList<PFXTag> PFXPet::getTags() const {
|
|
return m_tags;
|
|
}
|
|
void PFXPet::setTags(const QList<PFXTag> &tags) {
|
|
m_tags = tags;
|
|
m_tags_isSet = true;
|
|
}
|
|
|
|
bool PFXPet::is_tags_Set() const{
|
|
return m_tags_isSet;
|
|
}
|
|
|
|
bool PFXPet::is_tags_Valid() const{
|
|
return m_tags_isValid;
|
|
}
|
|
|
|
QString PFXPet::getStatus() const {
|
|
return m_status;
|
|
}
|
|
void PFXPet::setStatus(const QString &status) {
|
|
m_status = status;
|
|
m_status_isSet = true;
|
|
}
|
|
|
|
bool PFXPet::is_status_Set() const{
|
|
return m_status_isSet;
|
|
}
|
|
|
|
bool PFXPet::is_status_Valid() const{
|
|
return m_status_isValid;
|
|
}
|
|
|
|
bool PFXPet::isSet() const {
|
|
bool isObjectUpdated = false;
|
|
do {
|
|
if (m_id_isSet) {
|
|
isObjectUpdated = true;
|
|
break;
|
|
}
|
|
|
|
if (m_category.isSet()) {
|
|
isObjectUpdated = true;
|
|
break;
|
|
}
|
|
|
|
if (m_name_isSet) {
|
|
isObjectUpdated = true;
|
|
break;
|
|
}
|
|
|
|
if (m_photo_urls.size() > 0) {
|
|
isObjectUpdated = true;
|
|
break;
|
|
}
|
|
|
|
if (m_tags.size() > 0) {
|
|
isObjectUpdated = true;
|
|
break;
|
|
}
|
|
|
|
if (m_status_isSet) {
|
|
isObjectUpdated = true;
|
|
break;
|
|
}
|
|
} while (false);
|
|
return isObjectUpdated;
|
|
}
|
|
|
|
bool PFXPet::isValid() const {
|
|
// only required properties are required for the object to be considered valid
|
|
return m_name_isValid && m_photo_urls_isValid && true;
|
|
}
|
|
|
|
} // namespace test_namespace
|