/** * 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 unset. * https://openapi-generator.tech * Do not edit the class manually. */ #include "User.h" #include #include #include #include #include #include using boost::property_tree::ptree; using boost::property_tree::read_json; using boost::property_tree::write_json; namespace org { namespace openapitools { namespace server { namespace model { User::User(boost::property_tree::ptree const& pt) { fromPropertyTree(pt); } std::string User::toJsonString(bool prettyJson /* = false */) { return toJsonString_internal(prettyJson); } void User::fromJsonString(std::string const& jsonString) { fromJsonString_internal(jsonString); } boost::property_tree::ptree User::toPropertyTree() { return toPropertyTree_internal(); } void User::fromPropertyTree(boost::property_tree::ptree const& pt) { fromPropertyTree_internal(pt); } std::string User::toJsonString_internal(bool prettyJson) { std::stringstream ss; write_json(ss, this->toPropertyTree(), prettyJson); return ss.str(); } void User::fromJsonString_internal(std::string const& jsonString) { std::stringstream ss(jsonString); ptree pt; read_json(ss,pt); this->fromPropertyTree(pt); } ptree User::toPropertyTree_internal() { ptree pt; ptree tmp_node; pt.put("id", m_Id); pt.put("username", m_Username); pt.put("firstName", m_FirstName); pt.put("lastName", m_LastName); pt.put("email", m_Email); pt.put("password", m_Password); pt.put("phone", m_Phone); pt.put("userStatus", m_UserStatus); return pt; } void User::fromPropertyTree_internal(ptree const &pt) { ptree tmp_node; m_Id = pt.get("id", 0L); m_Username = pt.get("username", ""); m_FirstName = pt.get("firstName", ""); m_LastName = pt.get("lastName", ""); m_Email = pt.get("email", ""); m_Password = pt.get("password", ""); m_Phone = pt.get("phone", ""); m_UserStatus = pt.get("userStatus", 0); } int64_t User::getId() const { return m_Id; } void User::setId(int64_t value) { m_Id = value; } std::string User::getUsername() const { return m_Username; } void User::setUsername(std::string value) { m_Username = value; } std::string User::getFirstName() const { return m_FirstName; } void User::setFirstName(std::string value) { m_FirstName = value; } std::string User::getLastName() const { return m_LastName; } void User::setLastName(std::string value) { m_LastName = value; } std::string User::getEmail() const { return m_Email; } void User::setEmail(std::string value) { m_Email = value; } std::string User::getPassword() const { return m_Password; } void User::setPassword(std::string value) { m_Password = value; } std::string User::getPhone() const { return m_Phone; } void User::setPhone(std::string value) { m_Phone = value; } int32_t User::getUserStatus() const { return m_UserStatus; } void User::setUserStatus(int32_t value) { m_UserStatus = value; } std::vector createUserVectorFromJsonString(const std::string& json) { std::stringstream sstream(json); boost::property_tree::ptree pt; boost::property_tree::json_parser::read_json(sstream,pt); auto vec = std::vector(); for (const auto& child: pt) { vec.emplace_back(User(child.second)); } return vec; } } } } }