forked from loafle/openapi-generator-original
[cpprestsdk] fix string conversion, add integer enum support (#10531)
* [cpprestsdk] fix string conversion * Support number enums
This commit is contained in:
parent
12d80bfbb5
commit
71afbf5909
@ -10,6 +10,55 @@ namespace {{this}} {
|
||||
|
||||
{{#isEnum}}
|
||||
|
||||
namespace
|
||||
{
|
||||
using EnumUnderlyingType = {{#isNumeric}}int64_t{{/isNumeric}}{{^isNumeric}}utility::string_t{{/isNumeric}};
|
||||
|
||||
{{classname}}::e{{classname}} toEnum(const EnumUnderlyingType& val)
|
||||
{
|
||||
{{#allowableValues}}
|
||||
{{#isNumeric}}
|
||||
switch (val)
|
||||
{
|
||||
{{#enumVars}}
|
||||
case {{value}}:
|
||||
return {{classname}}::e{{classname}}::{{classname}}_{{name}};
|
||||
{{#-last}}
|
||||
default:
|
||||
break;
|
||||
{{/-last}}
|
||||
{{/enumVars}}
|
||||
}
|
||||
{{/isNumeric}}
|
||||
{{^isNumeric}}
|
||||
{{#enumVars}}
|
||||
if (val == utility::conversions::to_string_t(U("{{{value}}}")))
|
||||
return {{classname}}::e{{classname}}::{{classname}}_{{name}};
|
||||
{{/enumVars}}
|
||||
{{/isNumeric}}
|
||||
{{/allowableValues}}
|
||||
return {};
|
||||
}
|
||||
|
||||
EnumUnderlyingType fromEnum({{classname}}::e{{classname}} e)
|
||||
{
|
||||
{{#allowableValues}}
|
||||
switch (e)
|
||||
{
|
||||
{{#enumVars}}
|
||||
case {{classname}}::e{{classname}}::{{classname}}_{{name}}:
|
||||
return {{#isNumeric}}{{value}}{{/isNumeric}}{{^isNumeric}}U("{{value}}"){{/isNumeric}};
|
||||
{{#-last}}
|
||||
default:
|
||||
break;
|
||||
{{/-last}}
|
||||
{{/enumVars}}
|
||||
}
|
||||
{{/allowableValues}}
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
{{classname}}::{{classname}}()
|
||||
{
|
||||
}
|
||||
@ -25,57 +74,45 @@ void {{classname}}::validate()
|
||||
|
||||
web::json::value {{classname}}::toJson() const
|
||||
{
|
||||
web::json::value val = web::json::value::object();
|
||||
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
if (m_value == e{{classname}}::{{classname}}_{{name}}) val = web::json::value::string(U({{{value}}}));{{/enumVars}}{{/allowableValues}}
|
||||
|
||||
return val;
|
||||
auto val = fromEnum(m_value);
|
||||
return web::json::value(val);
|
||||
}
|
||||
|
||||
bool {{classname}}::fromJson(const web::json::value& val)
|
||||
{
|
||||
auto s = val.as_string();
|
||||
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
if (s == utility::conversions::to_string_t({{{value}}})) m_value = e{{classname}}::{{classname}}_{{name}};{{/enumVars}}{{/allowableValues}}
|
||||
m_value = toEnum({{#isNumeric}}val.as_number().to_int64(){{/isNumeric}}{{^isNumeric}}val.as_string(){{/isNumeric}});
|
||||
return true;
|
||||
}
|
||||
|
||||
void {{classname}}::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const
|
||||
{
|
||||
utility::string_t namePrefix = prefix;
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
|
||||
if (!namePrefix.empty() && namePrefix.back() != U('.'))
|
||||
{
|
||||
namePrefix += utility::conversions::to_string_t(".");
|
||||
namePrefix.push_back(U('.'));
|
||||
}
|
||||
|
||||
utility::string_t s;
|
||||
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
if (m_value == e{{classname}}::{{classname}}_{{name}}) s = utility::conversions::to_string_t({{{value}}});{{/enumVars}}{{/allowableValues}}
|
||||
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix, s));
|
||||
auto e = fromEnum(m_value);
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix, e));
|
||||
}
|
||||
|
||||
bool {{classname}}::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix)
|
||||
{
|
||||
bool ok = true;
|
||||
utility::string_t namePrefix = prefix;
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
|
||||
if (!namePrefix.empty() && namePrefix.back() != U('.'))
|
||||
{
|
||||
namePrefix += utility::conversions::to_string_t(".");
|
||||
namePrefix.push_back(U('.'));
|
||||
}
|
||||
{
|
||||
utility::string_t s;
|
||||
ok = ModelBase::fromHttpContent(multipart->getContent(namePrefix), s);
|
||||
e{{classname}} v;
|
||||
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
if (s == utility::conversions::to_string_t({{{value}}})) v = e{{classname}}::{{classname}}_{{name}};{{/enumVars}}{{/allowableValues}}
|
||||
|
||||
EnumUnderlyingType e;
|
||||
ok = ModelBase::fromHttpContent(multipart->getContent(namePrefix), e);
|
||||
if (ok)
|
||||
{
|
||||
auto v = toEnum(e);
|
||||
setValue(v);
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -134,7 +171,7 @@ web::json::value {{classname}}::toJson() const
|
||||
{{#vars}}{{^isInherited}}
|
||||
if(m_{{name}}IsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("{{baseName}}")] = ModelBase::toJson(m_{{name}});
|
||||
val[utility::conversions::to_string_t(U("{{baseName}}"))] = ModelBase::toJson(m_{{name}});
|
||||
}{{/isInherited}}{{/vars}}
|
||||
|
||||
return val;
|
||||
@ -147,9 +184,9 @@ bool {{classname}}::fromJson(const web::json::value& val)
|
||||
ok &= this->{{{.}}}::fromJson(val);
|
||||
{{/parent}}
|
||||
{{#vars}}{{^isInherited}}
|
||||
if(val.has_field(utility::conversions::to_string_t("{{baseName}}")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("{{baseName}}"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("{{baseName}}"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("{{baseName}}")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
{{{dataType}}} refVal_{{baseName}};
|
||||
@ -163,14 +200,14 @@ bool {{classname}}::fromJson(const web::json::value& val)
|
||||
void {{classname}}::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const
|
||||
{
|
||||
utility::string_t namePrefix = prefix;
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U(".")))
|
||||
{
|
||||
namePrefix += utility::conversions::to_string_t(".");
|
||||
namePrefix += utility::conversions::to_string_t(U("."));
|
||||
}
|
||||
{{#vars}}
|
||||
if(m_{{name}}IsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("{{baseName}}"), m_{{name}}));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("{{baseName}}")), m_{{name}}));
|
||||
}
|
||||
{{/vars}}
|
||||
}
|
||||
@ -179,16 +216,16 @@ bool {{classname}}::fromMultiPart(std::shared_ptr<MultipartFormData> multipart,
|
||||
{
|
||||
bool ok = true;
|
||||
utility::string_t namePrefix = prefix;
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U(".")))
|
||||
{
|
||||
namePrefix += utility::conversions::to_string_t(".");
|
||||
namePrefix += utility::conversions::to_string_t(U("."));
|
||||
}
|
||||
|
||||
{{#vars}}
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("{{baseName}}")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("{{baseName}}"))))
|
||||
{
|
||||
{{{dataType}}} refVal_{{baseName}};
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("{{baseName}}")), refVal_{{baseName}} );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("{{baseName}}"))), refVal_{{baseName}} );
|
||||
{{setter}}(refVal_{{baseName}});
|
||||
}
|
||||
{{/vars}}
|
||||
|
@ -47,15 +47,15 @@ web::json::value ApiResponse::toJson() const
|
||||
|
||||
if(m_CodeIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("code")] = ModelBase::toJson(m_Code);
|
||||
val[utility::conversions::to_string_t(U("code"))] = ModelBase::toJson(m_Code);
|
||||
}
|
||||
if(m_TypeIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("type")] = ModelBase::toJson(m_Type);
|
||||
val[utility::conversions::to_string_t(U("type"))] = ModelBase::toJson(m_Type);
|
||||
}
|
||||
if(m_MessageIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("message")] = ModelBase::toJson(m_Message);
|
||||
val[utility::conversions::to_string_t(U("message"))] = ModelBase::toJson(m_Message);
|
||||
}
|
||||
|
||||
return val;
|
||||
@ -65,9 +65,9 @@ bool ApiResponse::fromJson(const web::json::value& val)
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
if(val.has_field(utility::conversions::to_string_t("code")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("code"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("code"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("code")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
int32_t refVal_code;
|
||||
@ -75,9 +75,9 @@ bool ApiResponse::fromJson(const web::json::value& val)
|
||||
setCode(refVal_code);
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("type")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("type"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("type"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("type")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
utility::string_t refVal_type;
|
||||
@ -85,9 +85,9 @@ bool ApiResponse::fromJson(const web::json::value& val)
|
||||
setType(refVal_type);
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("message")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("message"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("message"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("message")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
utility::string_t refVal_message;
|
||||
@ -101,21 +101,21 @@ bool ApiResponse::fromJson(const web::json::value& val)
|
||||
void ApiResponse::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const
|
||||
{
|
||||
utility::string_t namePrefix = prefix;
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U(".")))
|
||||
{
|
||||
namePrefix += utility::conversions::to_string_t(".");
|
||||
namePrefix += utility::conversions::to_string_t(U("."));
|
||||
}
|
||||
if(m_CodeIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("code"), m_Code));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("code")), m_Code));
|
||||
}
|
||||
if(m_TypeIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("type"), m_Type));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("type")), m_Type));
|
||||
}
|
||||
if(m_MessageIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("message"), m_Message));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("message")), m_Message));
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,27 +123,27 @@ bool ApiResponse::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, co
|
||||
{
|
||||
bool ok = true;
|
||||
utility::string_t namePrefix = prefix;
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U(".")))
|
||||
{
|
||||
namePrefix += utility::conversions::to_string_t(".");
|
||||
namePrefix += utility::conversions::to_string_t(U("."));
|
||||
}
|
||||
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("code")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("code"))))
|
||||
{
|
||||
int32_t refVal_code;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("code")), refVal_code );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("code"))), refVal_code );
|
||||
setCode(refVal_code);
|
||||
}
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("type")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("type"))))
|
||||
{
|
||||
utility::string_t refVal_type;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("type")), refVal_type );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("type"))), refVal_type );
|
||||
setType(refVal_type);
|
||||
}
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("message")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("message"))))
|
||||
{
|
||||
utility::string_t refVal_message;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("message")), refVal_message );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("message"))), refVal_message );
|
||||
setMessage(refVal_message);
|
||||
}
|
||||
return ok;
|
||||
|
@ -45,11 +45,11 @@ web::json::value Category::toJson() const
|
||||
|
||||
if(m_IdIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("id")] = ModelBase::toJson(m_Id);
|
||||
val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id);
|
||||
}
|
||||
if(m_NameIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("name")] = ModelBase::toJson(m_Name);
|
||||
val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name);
|
||||
}
|
||||
|
||||
return val;
|
||||
@ -59,9 +59,9 @@ bool Category::fromJson(const web::json::value& val)
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
if(val.has_field(utility::conversions::to_string_t("id")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("id"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("id"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
int64_t refVal_id;
|
||||
@ -69,9 +69,9 @@ bool Category::fromJson(const web::json::value& val)
|
||||
setId(refVal_id);
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("name")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("name"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("name"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
utility::string_t refVal_name;
|
||||
@ -85,17 +85,17 @@ bool Category::fromJson(const web::json::value& val)
|
||||
void Category::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const
|
||||
{
|
||||
utility::string_t namePrefix = prefix;
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U(".")))
|
||||
{
|
||||
namePrefix += utility::conversions::to_string_t(".");
|
||||
namePrefix += utility::conversions::to_string_t(U("."));
|
||||
}
|
||||
if(m_IdIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("id"), m_Id));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id));
|
||||
}
|
||||
if(m_NameIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("name"), m_Name));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name));
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,21 +103,21 @@ bool Category::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const
|
||||
{
|
||||
bool ok = true;
|
||||
utility::string_t namePrefix = prefix;
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U(".")))
|
||||
{
|
||||
namePrefix += utility::conversions::to_string_t(".");
|
||||
namePrefix += utility::conversions::to_string_t(U("."));
|
||||
}
|
||||
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("id")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("id"))))
|
||||
{
|
||||
int64_t refVal_id;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("id")), refVal_id );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_id );
|
||||
setId(refVal_id);
|
||||
}
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("name")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("name"))))
|
||||
{
|
||||
utility::string_t refVal_name;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("name")), refVal_name );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_name );
|
||||
setName(refVal_name);
|
||||
}
|
||||
return ok;
|
||||
|
@ -53,27 +53,27 @@ web::json::value Order::toJson() const
|
||||
|
||||
if(m_IdIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("id")] = ModelBase::toJson(m_Id);
|
||||
val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id);
|
||||
}
|
||||
if(m_PetIdIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("petId")] = ModelBase::toJson(m_PetId);
|
||||
val[utility::conversions::to_string_t(U("petId"))] = ModelBase::toJson(m_PetId);
|
||||
}
|
||||
if(m_QuantityIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("quantity")] = ModelBase::toJson(m_Quantity);
|
||||
val[utility::conversions::to_string_t(U("quantity"))] = ModelBase::toJson(m_Quantity);
|
||||
}
|
||||
if(m_ShipDateIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("shipDate")] = ModelBase::toJson(m_ShipDate);
|
||||
val[utility::conversions::to_string_t(U("shipDate"))] = ModelBase::toJson(m_ShipDate);
|
||||
}
|
||||
if(m_StatusIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("status")] = ModelBase::toJson(m_Status);
|
||||
val[utility::conversions::to_string_t(U("status"))] = ModelBase::toJson(m_Status);
|
||||
}
|
||||
if(m_CompleteIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("complete")] = ModelBase::toJson(m_Complete);
|
||||
val[utility::conversions::to_string_t(U("complete"))] = ModelBase::toJson(m_Complete);
|
||||
}
|
||||
|
||||
return val;
|
||||
@ -83,9 +83,9 @@ bool Order::fromJson(const web::json::value& val)
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
if(val.has_field(utility::conversions::to_string_t("id")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("id"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("id"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
int64_t refVal_id;
|
||||
@ -93,9 +93,9 @@ bool Order::fromJson(const web::json::value& val)
|
||||
setId(refVal_id);
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("petId")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("petId"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("petId"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("petId")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
int64_t refVal_petId;
|
||||
@ -103,9 +103,9 @@ bool Order::fromJson(const web::json::value& val)
|
||||
setPetId(refVal_petId);
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("quantity")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("quantity"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("quantity"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("quantity")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
int32_t refVal_quantity;
|
||||
@ -113,9 +113,9 @@ bool Order::fromJson(const web::json::value& val)
|
||||
setQuantity(refVal_quantity);
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("shipDate")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("shipDate"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("shipDate"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("shipDate")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
utility::datetime refVal_shipDate;
|
||||
@ -123,9 +123,9 @@ bool Order::fromJson(const web::json::value& val)
|
||||
setShipDate(refVal_shipDate);
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("status")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("status"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("status"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("status")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
utility::string_t refVal_status;
|
||||
@ -133,9 +133,9 @@ bool Order::fromJson(const web::json::value& val)
|
||||
setStatus(refVal_status);
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("complete")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("complete"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("complete"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("complete")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
bool refVal_complete;
|
||||
@ -149,33 +149,33 @@ bool Order::fromJson(const web::json::value& val)
|
||||
void Order::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const
|
||||
{
|
||||
utility::string_t namePrefix = prefix;
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U(".")))
|
||||
{
|
||||
namePrefix += utility::conversions::to_string_t(".");
|
||||
namePrefix += utility::conversions::to_string_t(U("."));
|
||||
}
|
||||
if(m_IdIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("id"), m_Id));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id));
|
||||
}
|
||||
if(m_PetIdIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("petId"), m_PetId));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("petId")), m_PetId));
|
||||
}
|
||||
if(m_QuantityIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("quantity"), m_Quantity));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("quantity")), m_Quantity));
|
||||
}
|
||||
if(m_ShipDateIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("shipDate"), m_ShipDate));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("shipDate")), m_ShipDate));
|
||||
}
|
||||
if(m_StatusIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("status"), m_Status));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("status")), m_Status));
|
||||
}
|
||||
if(m_CompleteIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("complete"), m_Complete));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("complete")), m_Complete));
|
||||
}
|
||||
}
|
||||
|
||||
@ -183,45 +183,45 @@ bool Order::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const ut
|
||||
{
|
||||
bool ok = true;
|
||||
utility::string_t namePrefix = prefix;
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U(".")))
|
||||
{
|
||||
namePrefix += utility::conversions::to_string_t(".");
|
||||
namePrefix += utility::conversions::to_string_t(U("."));
|
||||
}
|
||||
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("id")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("id"))))
|
||||
{
|
||||
int64_t refVal_id;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("id")), refVal_id );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_id );
|
||||
setId(refVal_id);
|
||||
}
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("petId")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("petId"))))
|
||||
{
|
||||
int64_t refVal_petId;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("petId")), refVal_petId );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("petId"))), refVal_petId );
|
||||
setPetId(refVal_petId);
|
||||
}
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("quantity")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("quantity"))))
|
||||
{
|
||||
int32_t refVal_quantity;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("quantity")), refVal_quantity );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("quantity"))), refVal_quantity );
|
||||
setQuantity(refVal_quantity);
|
||||
}
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("shipDate")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("shipDate"))))
|
||||
{
|
||||
utility::datetime refVal_shipDate;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("shipDate")), refVal_shipDate );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("shipDate"))), refVal_shipDate );
|
||||
setShipDate(refVal_shipDate);
|
||||
}
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("status")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("status"))))
|
||||
{
|
||||
utility::string_t refVal_status;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("status")), refVal_status );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("status"))), refVal_status );
|
||||
setStatus(refVal_status);
|
||||
}
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("complete")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("complete"))))
|
||||
{
|
||||
bool refVal_complete;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("complete")), refVal_complete );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("complete"))), refVal_complete );
|
||||
setComplete(refVal_complete);
|
||||
}
|
||||
return ok;
|
||||
|
@ -50,27 +50,27 @@ web::json::value Pet::toJson() const
|
||||
|
||||
if(m_IdIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("id")] = ModelBase::toJson(m_Id);
|
||||
val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id);
|
||||
}
|
||||
if(m_CategoryIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("category")] = ModelBase::toJson(m_Category);
|
||||
val[utility::conversions::to_string_t(U("category"))] = ModelBase::toJson(m_Category);
|
||||
}
|
||||
if(m_NameIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("name")] = ModelBase::toJson(m_Name);
|
||||
val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name);
|
||||
}
|
||||
if(m_PhotoUrlsIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("photoUrls")] = ModelBase::toJson(m_PhotoUrls);
|
||||
val[utility::conversions::to_string_t(U("photoUrls"))] = ModelBase::toJson(m_PhotoUrls);
|
||||
}
|
||||
if(m_TagsIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("tags")] = ModelBase::toJson(m_Tags);
|
||||
val[utility::conversions::to_string_t(U("tags"))] = ModelBase::toJson(m_Tags);
|
||||
}
|
||||
if(m_StatusIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("status")] = ModelBase::toJson(m_Status);
|
||||
val[utility::conversions::to_string_t(U("status"))] = ModelBase::toJson(m_Status);
|
||||
}
|
||||
|
||||
return val;
|
||||
@ -80,9 +80,9 @@ bool Pet::fromJson(const web::json::value& val)
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
if(val.has_field(utility::conversions::to_string_t("id")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("id"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("id"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
int64_t refVal_id;
|
||||
@ -90,9 +90,9 @@ bool Pet::fromJson(const web::json::value& val)
|
||||
setId(refVal_id);
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("category")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("category"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("category"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("category")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
std::shared_ptr<Category> refVal_category;
|
||||
@ -100,9 +100,9 @@ bool Pet::fromJson(const web::json::value& val)
|
||||
setCategory(refVal_category);
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("name")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("name"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("name"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
utility::string_t refVal_name;
|
||||
@ -110,9 +110,9 @@ bool Pet::fromJson(const web::json::value& val)
|
||||
setName(refVal_name);
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("photoUrls")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("photoUrls"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("photoUrls"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("photoUrls")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
std::vector<utility::string_t> refVal_photoUrls;
|
||||
@ -120,9 +120,9 @@ bool Pet::fromJson(const web::json::value& val)
|
||||
setPhotoUrls(refVal_photoUrls);
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("tags")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("tags"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("tags"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("tags")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
std::vector<std::shared_ptr<Tag>> refVal_tags;
|
||||
@ -130,9 +130,9 @@ bool Pet::fromJson(const web::json::value& val)
|
||||
setTags(refVal_tags);
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("status")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("status"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("status"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("status")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
utility::string_t refVal_status;
|
||||
@ -146,33 +146,33 @@ bool Pet::fromJson(const web::json::value& val)
|
||||
void Pet::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const
|
||||
{
|
||||
utility::string_t namePrefix = prefix;
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U(".")))
|
||||
{
|
||||
namePrefix += utility::conversions::to_string_t(".");
|
||||
namePrefix += utility::conversions::to_string_t(U("."));
|
||||
}
|
||||
if(m_IdIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("id"), m_Id));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id));
|
||||
}
|
||||
if(m_CategoryIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("category"), m_Category));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("category")), m_Category));
|
||||
}
|
||||
if(m_NameIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("name"), m_Name));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name));
|
||||
}
|
||||
if(m_PhotoUrlsIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("photoUrls"), m_PhotoUrls));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("photoUrls")), m_PhotoUrls));
|
||||
}
|
||||
if(m_TagsIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("tags"), m_Tags));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("tags")), m_Tags));
|
||||
}
|
||||
if(m_StatusIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("status"), m_Status));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("status")), m_Status));
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,45 +180,45 @@ bool Pet::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const util
|
||||
{
|
||||
bool ok = true;
|
||||
utility::string_t namePrefix = prefix;
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U(".")))
|
||||
{
|
||||
namePrefix += utility::conversions::to_string_t(".");
|
||||
namePrefix += utility::conversions::to_string_t(U("."));
|
||||
}
|
||||
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("id")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("id"))))
|
||||
{
|
||||
int64_t refVal_id;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("id")), refVal_id );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_id );
|
||||
setId(refVal_id);
|
||||
}
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("category")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("category"))))
|
||||
{
|
||||
std::shared_ptr<Category> refVal_category;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("category")), refVal_category );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("category"))), refVal_category );
|
||||
setCategory(refVal_category);
|
||||
}
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("name")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("name"))))
|
||||
{
|
||||
utility::string_t refVal_name;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("name")), refVal_name );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_name );
|
||||
setName(refVal_name);
|
||||
}
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("photoUrls")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("photoUrls"))))
|
||||
{
|
||||
std::vector<utility::string_t> refVal_photoUrls;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("photoUrls")), refVal_photoUrls );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("photoUrls"))), refVal_photoUrls );
|
||||
setPhotoUrls(refVal_photoUrls);
|
||||
}
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("tags")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("tags"))))
|
||||
{
|
||||
std::vector<std::shared_ptr<Tag>> refVal_tags;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("tags")), refVal_tags );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("tags"))), refVal_tags );
|
||||
setTags(refVal_tags);
|
||||
}
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("status")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("status"))))
|
||||
{
|
||||
utility::string_t refVal_status;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("status")), refVal_status );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("status"))), refVal_status );
|
||||
setStatus(refVal_status);
|
||||
}
|
||||
return ok;
|
||||
|
@ -45,11 +45,11 @@ web::json::value Tag::toJson() const
|
||||
|
||||
if(m_IdIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("id")] = ModelBase::toJson(m_Id);
|
||||
val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id);
|
||||
}
|
||||
if(m_NameIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("name")] = ModelBase::toJson(m_Name);
|
||||
val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name);
|
||||
}
|
||||
|
||||
return val;
|
||||
@ -59,9 +59,9 @@ bool Tag::fromJson(const web::json::value& val)
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
if(val.has_field(utility::conversions::to_string_t("id")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("id"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("id"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
int64_t refVal_id;
|
||||
@ -69,9 +69,9 @@ bool Tag::fromJson(const web::json::value& val)
|
||||
setId(refVal_id);
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("name")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("name"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("name"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
utility::string_t refVal_name;
|
||||
@ -85,17 +85,17 @@ bool Tag::fromJson(const web::json::value& val)
|
||||
void Tag::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const
|
||||
{
|
||||
utility::string_t namePrefix = prefix;
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U(".")))
|
||||
{
|
||||
namePrefix += utility::conversions::to_string_t(".");
|
||||
namePrefix += utility::conversions::to_string_t(U("."));
|
||||
}
|
||||
if(m_IdIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("id"), m_Id));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id));
|
||||
}
|
||||
if(m_NameIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("name"), m_Name));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name));
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,21 +103,21 @@ bool Tag::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const util
|
||||
{
|
||||
bool ok = true;
|
||||
utility::string_t namePrefix = prefix;
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U(".")))
|
||||
{
|
||||
namePrefix += utility::conversions::to_string_t(".");
|
||||
namePrefix += utility::conversions::to_string_t(U("."));
|
||||
}
|
||||
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("id")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("id"))))
|
||||
{
|
||||
int64_t refVal_id;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("id")), refVal_id );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_id );
|
||||
setId(refVal_id);
|
||||
}
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("name")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("name"))))
|
||||
{
|
||||
utility::string_t refVal_name;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("name")), refVal_name );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_name );
|
||||
setName(refVal_name);
|
||||
}
|
||||
return ok;
|
||||
|
@ -57,35 +57,35 @@ web::json::value User::toJson() const
|
||||
|
||||
if(m_IdIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("id")] = ModelBase::toJson(m_Id);
|
||||
val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id);
|
||||
}
|
||||
if(m_UsernameIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("username")] = ModelBase::toJson(m_Username);
|
||||
val[utility::conversions::to_string_t(U("username"))] = ModelBase::toJson(m_Username);
|
||||
}
|
||||
if(m_FirstNameIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("firstName")] = ModelBase::toJson(m_FirstName);
|
||||
val[utility::conversions::to_string_t(U("firstName"))] = ModelBase::toJson(m_FirstName);
|
||||
}
|
||||
if(m_LastNameIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("lastName")] = ModelBase::toJson(m_LastName);
|
||||
val[utility::conversions::to_string_t(U("lastName"))] = ModelBase::toJson(m_LastName);
|
||||
}
|
||||
if(m_EmailIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("email")] = ModelBase::toJson(m_Email);
|
||||
val[utility::conversions::to_string_t(U("email"))] = ModelBase::toJson(m_Email);
|
||||
}
|
||||
if(m_PasswordIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("password")] = ModelBase::toJson(m_Password);
|
||||
val[utility::conversions::to_string_t(U("password"))] = ModelBase::toJson(m_Password);
|
||||
}
|
||||
if(m_PhoneIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("phone")] = ModelBase::toJson(m_Phone);
|
||||
val[utility::conversions::to_string_t(U("phone"))] = ModelBase::toJson(m_Phone);
|
||||
}
|
||||
if(m_UserStatusIsSet)
|
||||
{
|
||||
val[utility::conversions::to_string_t("userStatus")] = ModelBase::toJson(m_UserStatus);
|
||||
val[utility::conversions::to_string_t(U("userStatus"))] = ModelBase::toJson(m_UserStatus);
|
||||
}
|
||||
|
||||
return val;
|
||||
@ -95,9 +95,9 @@ bool User::fromJson(const web::json::value& val)
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
if(val.has_field(utility::conversions::to_string_t("id")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("id"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("id"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
int64_t refVal_id;
|
||||
@ -105,9 +105,9 @@ bool User::fromJson(const web::json::value& val)
|
||||
setId(refVal_id);
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("username")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("username"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("username"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("username")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
utility::string_t refVal_username;
|
||||
@ -115,9 +115,9 @@ bool User::fromJson(const web::json::value& val)
|
||||
setUsername(refVal_username);
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("firstName")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("firstName"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("firstName"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("firstName")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
utility::string_t refVal_firstName;
|
||||
@ -125,9 +125,9 @@ bool User::fromJson(const web::json::value& val)
|
||||
setFirstName(refVal_firstName);
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("lastName")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("lastName"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("lastName"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("lastName")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
utility::string_t refVal_lastName;
|
||||
@ -135,9 +135,9 @@ bool User::fromJson(const web::json::value& val)
|
||||
setLastName(refVal_lastName);
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("email")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("email"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("email"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("email")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
utility::string_t refVal_email;
|
||||
@ -145,9 +145,9 @@ bool User::fromJson(const web::json::value& val)
|
||||
setEmail(refVal_email);
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("password")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("password"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("password"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("password")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
utility::string_t refVal_password;
|
||||
@ -155,9 +155,9 @@ bool User::fromJson(const web::json::value& val)
|
||||
setPassword(refVal_password);
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("phone")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("phone"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("phone"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("phone")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
utility::string_t refVal_phone;
|
||||
@ -165,9 +165,9 @@ bool User::fromJson(const web::json::value& val)
|
||||
setPhone(refVal_phone);
|
||||
}
|
||||
}
|
||||
if(val.has_field(utility::conversions::to_string_t("userStatus")))
|
||||
if(val.has_field(utility::conversions::to_string_t(U("userStatus"))))
|
||||
{
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("userStatus"));
|
||||
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("userStatus")));
|
||||
if(!fieldValue.is_null())
|
||||
{
|
||||
int32_t refVal_userStatus;
|
||||
@ -181,41 +181,41 @@ bool User::fromJson(const web::json::value& val)
|
||||
void User::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const
|
||||
{
|
||||
utility::string_t namePrefix = prefix;
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U(".")))
|
||||
{
|
||||
namePrefix += utility::conversions::to_string_t(".");
|
||||
namePrefix += utility::conversions::to_string_t(U("."));
|
||||
}
|
||||
if(m_IdIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("id"), m_Id));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id));
|
||||
}
|
||||
if(m_UsernameIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("username"), m_Username));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("username")), m_Username));
|
||||
}
|
||||
if(m_FirstNameIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("firstName"), m_FirstName));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("firstName")), m_FirstName));
|
||||
}
|
||||
if(m_LastNameIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("lastName"), m_LastName));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("lastName")), m_LastName));
|
||||
}
|
||||
if(m_EmailIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("email"), m_Email));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("email")), m_Email));
|
||||
}
|
||||
if(m_PasswordIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("password"), m_Password));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("password")), m_Password));
|
||||
}
|
||||
if(m_PhoneIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("phone"), m_Phone));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("phone")), m_Phone));
|
||||
}
|
||||
if(m_UserStatusIsSet)
|
||||
{
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("userStatus"), m_UserStatus));
|
||||
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("userStatus")), m_UserStatus));
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,57 +223,57 @@ bool User::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const uti
|
||||
{
|
||||
bool ok = true;
|
||||
utility::string_t namePrefix = prefix;
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
|
||||
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U(".")))
|
||||
{
|
||||
namePrefix += utility::conversions::to_string_t(".");
|
||||
namePrefix += utility::conversions::to_string_t(U("."));
|
||||
}
|
||||
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("id")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("id"))))
|
||||
{
|
||||
int64_t refVal_id;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("id")), refVal_id );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_id );
|
||||
setId(refVal_id);
|
||||
}
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("username")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("username"))))
|
||||
{
|
||||
utility::string_t refVal_username;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("username")), refVal_username );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("username"))), refVal_username );
|
||||
setUsername(refVal_username);
|
||||
}
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("firstName")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("firstName"))))
|
||||
{
|
||||
utility::string_t refVal_firstName;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("firstName")), refVal_firstName );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("firstName"))), refVal_firstName );
|
||||
setFirstName(refVal_firstName);
|
||||
}
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("lastName")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("lastName"))))
|
||||
{
|
||||
utility::string_t refVal_lastName;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("lastName")), refVal_lastName );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("lastName"))), refVal_lastName );
|
||||
setLastName(refVal_lastName);
|
||||
}
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("email")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("email"))))
|
||||
{
|
||||
utility::string_t refVal_email;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("email")), refVal_email );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("email"))), refVal_email );
|
||||
setEmail(refVal_email);
|
||||
}
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("password")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("password"))))
|
||||
{
|
||||
utility::string_t refVal_password;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("password")), refVal_password );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("password"))), refVal_password );
|
||||
setPassword(refVal_password);
|
||||
}
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("phone")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("phone"))))
|
||||
{
|
||||
utility::string_t refVal_phone;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("phone")), refVal_phone );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("phone"))), refVal_phone );
|
||||
setPhone(refVal_phone);
|
||||
}
|
||||
if(multipart->hasContent(utility::conversions::to_string_t("userStatus")))
|
||||
if(multipart->hasContent(utility::conversions::to_string_t(U("userStatus"))))
|
||||
{
|
||||
int32_t refVal_userStatus;
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("userStatus")), refVal_userStatus );
|
||||
ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("userStatus"))), refVal_userStatus );
|
||||
setUserStatus(refVal_userStatus);
|
||||
}
|
||||
return ok;
|
||||
|
Loading…
x
Reference in New Issue
Block a user