|
| 1 | +/** |
| 2 | + * Swagger Petstore |
| 3 | + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. |
| 4 | + * |
| 5 | + * OpenAPI spec version: 1.0.0 |
| 6 | + |
| 7 | + * |
| 8 | + * NOTE: This class is auto generated by the swagger code generator 2.4.0-SNAPSHOT. |
| 9 | + * https://github.com/swagger-api/swagger-codegen.git |
| 10 | + * Do not edit the class manually. |
| 11 | + */ |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +#include "Amount.h" |
| 16 | + |
| 17 | +namespace io { |
| 18 | +namespace swagger { |
| 19 | +namespace client { |
| 20 | +namespace model { |
| 21 | + |
| 22 | +Amount::Amount() |
| 23 | +{ |
| 24 | + m_Value = 0.0; |
| 25 | +} |
| 26 | + |
| 27 | +Amount::~Amount() |
| 28 | +{ |
| 29 | +} |
| 30 | + |
| 31 | +void Amount::validate() |
| 32 | +{ |
| 33 | + // TODO: implement validation |
| 34 | +} |
| 35 | + |
| 36 | +web::json::value Amount::toJson() const |
| 37 | +{ |
| 38 | + web::json::value val = web::json::value::object(); |
| 39 | + |
| 40 | + val[utility::conversions::to_string_t("value")] = ModelBase::toJson(m_Value); |
| 41 | + val[utility::conversions::to_string_t("currency")] = ModelBase::toJson(m_Currency); |
| 42 | + |
| 43 | + return val; |
| 44 | +} |
| 45 | + |
| 46 | +void Amount::fromJson(web::json::value& val) |
| 47 | +{ |
| 48 | + setValue(ModelBase::doubleFromJson(val[utility::conversions::to_string_t("value")])); |
| 49 | + std::shared_ptr<Currency> newCurrency(new Currency()); |
| 50 | + newCurrency->fromJson(val[utility::conversions::to_string_t("currency")]); |
| 51 | + setCurrency( newCurrency ); |
| 52 | +} |
| 53 | + |
| 54 | +void Amount::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const |
| 55 | +{ |
| 56 | + utility::string_t namePrefix = prefix; |
| 57 | + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) |
| 58 | + { |
| 59 | + namePrefix += utility::conversions::to_string_t("."); |
| 60 | + } |
| 61 | + |
| 62 | + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("value"), m_Value)); |
| 63 | + m_Currency->toMultipart(multipart, utility::conversions::to_string_t("currency.")); |
| 64 | +} |
| 65 | + |
| 66 | +void Amount::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) |
| 67 | +{ |
| 68 | + utility::string_t namePrefix = prefix; |
| 69 | + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(".")) |
| 70 | + { |
| 71 | + namePrefix += utility::conversions::to_string_t("."); |
| 72 | + } |
| 73 | + |
| 74 | + setValue(ModelBase::doubleFromHttpContent(multipart->getContent(utility::conversions::to_string_t("value")))); |
| 75 | + std::shared_ptr<Currency> newCurrency(new Currency()); |
| 76 | + newCurrency->fromMultiPart(multipart, utility::conversions::to_string_t("currency.")); |
| 77 | + setCurrency( newCurrency ); |
| 78 | +} |
| 79 | + |
| 80 | +double Amount::getValue() const |
| 81 | +{ |
| 82 | + return m_Value; |
| 83 | +} |
| 84 | + |
| 85 | + |
| 86 | +void Amount::setValue(double value) |
| 87 | +{ |
| 88 | + m_Value = value; |
| 89 | + |
| 90 | +} |
| 91 | +std::shared_ptr<Currency> Amount::getCurrency() const |
| 92 | +{ |
| 93 | + return m_Currency; |
| 94 | +} |
| 95 | + |
| 96 | + |
| 97 | +void Amount::setCurrency(std::shared_ptr<Currency> value) |
| 98 | +{ |
| 99 | + m_Currency = value; |
| 100 | + |
| 101 | +} |
| 102 | +} |
| 103 | +} |
| 104 | +} |
| 105 | +} |
| 106 | + |
0 commit comments