sunn 3bb4edf865 [C++] [Qt5] Add enum support for client and server (#2339)
* Add enum support to Qt5 client and server

* Correct model name prefix

* Remove tabs

* Correct wrong filename when prefix used
2019-03-30 09:32:06 +08:00

260 lines
5.4 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 "OAIUser.h"
#include "OAIHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace OpenAPI {
OAIUser::OAIUser(QString json) {
this->init();
this->fromJson(json);
}
OAIUser::OAIUser() {
this->init();
}
OAIUser::~OAIUser() {
}
void
OAIUser::init() {
m_id_isSet = false;
m_id_isValid = false;
m_username_isSet = false;
m_username_isValid = false;
m_first_name_isSet = false;
m_first_name_isValid = false;
m_last_name_isSet = false;
m_last_name_isValid = false;
m_email_isSet = false;
m_email_isValid = false;
m_password_isSet = false;
m_password_isValid = false;
m_phone_isSet = false;
m_phone_isValid = false;
m_user_status_isSet = false;
m_user_status_isValid = false;
}
void
OAIUser::fromJson(QString jsonString) {
QByteArray array (jsonString.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
}
void
OAIUser::fromJsonObject(QJsonObject json) {
m_id_isValid = ::OpenAPI::fromJsonValue(id, json[QString("id")]);
m_username_isValid = ::OpenAPI::fromJsonValue(username, json[QString("username")]);
m_first_name_isValid = ::OpenAPI::fromJsonValue(first_name, json[QString("firstName")]);
m_last_name_isValid = ::OpenAPI::fromJsonValue(last_name, json[QString("lastName")]);
m_email_isValid = ::OpenAPI::fromJsonValue(email, json[QString("email")]);
m_password_isValid = ::OpenAPI::fromJsonValue(password, json[QString("password")]);
m_phone_isValid = ::OpenAPI::fromJsonValue(phone, json[QString("phone")]);
m_user_status_isValid = ::OpenAPI::fromJsonValue(user_status, json[QString("userStatus")]);
}
QString
OAIUser::asJson () const {
QJsonObject obj = this->asJsonObject();
QJsonDocument doc(obj);
QByteArray bytes = doc.toJson();
return QString(bytes);
}
QJsonObject
OAIUser::asJsonObject() const {
QJsonObject obj;
if(m_id_isSet){
obj.insert(QString("id"), ::OpenAPI::toJsonValue(id));
}
if(m_username_isSet){
obj.insert(QString("username"), ::OpenAPI::toJsonValue(username));
}
if(m_first_name_isSet){
obj.insert(QString("firstName"), ::OpenAPI::toJsonValue(first_name));
}
if(m_last_name_isSet){
obj.insert(QString("lastName"), ::OpenAPI::toJsonValue(last_name));
}
if(m_email_isSet){
obj.insert(QString("email"), ::OpenAPI::toJsonValue(email));
}
if(m_password_isSet){
obj.insert(QString("password"), ::OpenAPI::toJsonValue(password));
}
if(m_phone_isSet){
obj.insert(QString("phone"), ::OpenAPI::toJsonValue(phone));
}
if(m_user_status_isSet){
obj.insert(QString("userStatus"), ::OpenAPI::toJsonValue(user_status));
}
return obj;
}
qint64
OAIUser::getId() const {
return id;
}
void
OAIUser::setId(const qint64 &id) {
this->id = id;
this->m_id_isSet = true;
}
QString
OAIUser::getUsername() const {
return username;
}
void
OAIUser::setUsername(const QString &username) {
this->username = username;
this->m_username_isSet = true;
}
QString
OAIUser::getFirstName() const {
return first_name;
}
void
OAIUser::setFirstName(const QString &first_name) {
this->first_name = first_name;
this->m_first_name_isSet = true;
}
QString
OAIUser::getLastName() const {
return last_name;
}
void
OAIUser::setLastName(const QString &last_name) {
this->last_name = last_name;
this->m_last_name_isSet = true;
}
QString
OAIUser::getEmail() const {
return email;
}
void
OAIUser::setEmail(const QString &email) {
this->email = email;
this->m_email_isSet = true;
}
QString
OAIUser::getPassword() const {
return password;
}
void
OAIUser::setPassword(const QString &password) {
this->password = password;
this->m_password_isSet = true;
}
QString
OAIUser::getPhone() const {
return phone;
}
void
OAIUser::setPhone(const QString &phone) {
this->phone = phone;
this->m_phone_isSet = true;
}
qint32
OAIUser::getUserStatus() const {
return user_status;
}
void
OAIUser::setUserStatus(const qint32 &user_status) {
this->user_status = user_status;
this->m_user_status_isSet = true;
}
bool
OAIUser::isSet() const {
bool isObjectUpdated = false;
do{
if(m_id_isSet){ isObjectUpdated = true; break;}
if(m_username_isSet){ isObjectUpdated = true; break;}
if(m_first_name_isSet){ isObjectUpdated = true; break;}
if(m_last_name_isSet){ isObjectUpdated = true; break;}
if(m_email_isSet){ isObjectUpdated = true; break;}
if(m_password_isSet){ isObjectUpdated = true; break;}
if(m_phone_isSet){ isObjectUpdated = true; break;}
if(m_user_status_isSet){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
bool
OAIUser::isValid() const {
// only required properties are required for the object to be considered valid
return true;
}
}