From f1a93fa3dba2bfc6dc03c72f9133fe2ab75c47e0 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sat, 25 Jun 2022 12:05:28 +0800 Subject: [PATCH] add new test files --- .../petstore/cpp-qt/client/PFXTestAnyType.cpp | 130 ++++++++++++++++++ .../petstore/cpp-qt/client/PFXTestAnyType.h | 71 ++++++++++ 2 files changed, 201 insertions(+) create mode 100644 samples/client/petstore/cpp-qt/client/PFXTestAnyType.cpp create mode 100644 samples/client/petstore/cpp-qt/client/PFXTestAnyType.h diff --git a/samples/client/petstore/cpp-qt/client/PFXTestAnyType.cpp b/samples/client/petstore/cpp-qt/client/PFXTestAnyType.cpp new file mode 100644 index 00000000000..671ed6fccdc --- /dev/null +++ b/samples/client/petstore/cpp-qt/client/PFXTestAnyType.cpp @@ -0,0 +1,130 @@ +/** + * 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 "PFXTestAnyType.h" + +#include +#include +#include +#include + +#include "PFXHelpers.h" + +namespace test_namespace { + +PFXTestAnyType::PFXTestAnyType(QString json) { + this->initializeModel(); + this->fromJson(json); +} + +PFXTestAnyType::PFXTestAnyType() { + this->initializeModel(); +} + +PFXTestAnyType::~PFXTestAnyType() {} + +void PFXTestAnyType::initializeModel() { + + m_code_isSet = false; + m_code_isValid = false; + + m_message_isSet = false; + m_message_isValid = false; +} + +void PFXTestAnyType::fromJson(QString jsonString) { + QByteArray array(jsonString.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); +} + +void PFXTestAnyType::fromJsonObject(QJsonObject json) { + + m_code_isValid = ::test_namespace::fromJsonValue(code, json[QString("code")]); + m_code_isSet = !json[QString("code")].isNull() && m_code_isValid; + + m_message_isValid = ::test_namespace::fromJsonValue(message, json[QString("message")]); + m_message_isSet = !json[QString("message")].isNull() && m_message_isValid; +} + +QString PFXTestAnyType::asJson() const { + QJsonObject obj = this->asJsonObject(); + QJsonDocument doc(obj); + QByteArray bytes = doc.toJson(); + return QString(bytes); +} + +QJsonObject PFXTestAnyType::asJsonObject() const { + QJsonObject obj; + if (m_code_isSet) { + obj.insert(QString("code"), ::test_namespace::toJsonValue(code)); + } + if (m_message_isSet) { + obj.insert(QString("message"), ::test_namespace::toJsonValue(message)); + } + return obj; +} + +QJsonValue PFXTestAnyType::getCode() const { + return code; +} +void PFXTestAnyType::setCode(const QJsonValue &code) { + this->code = code; + this->m_code_isSet = true; +} + +bool PFXTestAnyType::is_code_Set() const{ + return m_code_isSet; +} + +bool PFXTestAnyType::is_code_Valid() const{ + return m_code_isValid; +} + +QString PFXTestAnyType::getMessage() const { + return message; +} +void PFXTestAnyType::setMessage(const QString &message) { + this->message = message; + this->m_message_isSet = true; +} + +bool PFXTestAnyType::is_message_Set() const{ + return m_message_isSet; +} + +bool PFXTestAnyType::is_message_Valid() const{ + return m_message_isValid; +} + +bool PFXTestAnyType::isSet() const { + bool isObjectUpdated = false; + do { + if (m_code_isSet) { + isObjectUpdated = true; + break; + } + + if (m_message_isSet) { + isObjectUpdated = true; + break; + } + } while (false); + return isObjectUpdated; +} + +bool PFXTestAnyType::isValid() const { + // only required properties are required for the object to be considered valid + return true; +} + +} // namespace test_namespace diff --git a/samples/client/petstore/cpp-qt/client/PFXTestAnyType.h b/samples/client/petstore/cpp-qt/client/PFXTestAnyType.h new file mode 100644 index 00000000000..45e6dae018c --- /dev/null +++ b/samples/client/petstore/cpp-qt/client/PFXTestAnyType.h @@ -0,0 +1,71 @@ +/** + * 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. + */ + +/* + * PFXTestAnyType.h + * + * test any type + */ + +#ifndef PFXTestAnyType_H +#define PFXTestAnyType_H + +#include + +#include +#include + +#include "PFXEnum.h" +#include "PFXObject.h" + +namespace test_namespace { + +class PFXTestAnyType : public PFXObject { +public: + PFXTestAnyType(); + PFXTestAnyType(QString json); + ~PFXTestAnyType() override; + + QString asJson() const override; + QJsonObject asJsonObject() const override; + void fromJsonObject(QJsonObject json) override; + void fromJson(QString jsonString) override; + + QJsonValue getCode() const; + void setCode(const QJsonValue &code); + bool is_code_Set() const; + bool is_code_Valid() const; + + QString getMessage() const; + void setMessage(const QString &message); + bool is_message_Set() const; + bool is_message_Valid() const; + + virtual bool isSet() const override; + virtual bool isValid() const override; + +private: + void initializeModel(); + + QJsonValue code; + bool m_code_isSet; + bool m_code_isValid; + + QString message; + bool m_message_isSet; + bool m_message_isValid; +}; + +} // namespace test_namespace + +Q_DECLARE_METATYPE(test_namespace::PFXTestAnyType) + +#endif // PFXTestAnyType_H