From 3048fb02e14a84c088507d57f00751fa68c05f26 Mon Sep 17 00:00:00 2001 From: Amin Ya Date: Wed, 7 May 2025 00:08:38 -0700 Subject: [PATCH] [cpp-rest-sdk] remove U macro definition from public headers (#21221) Cpprest has a public U macro definition that causes build errors in libraries as U is a common name for template parameters. This PR fixes the issue by turning it off. [microsoft/cpprestsdk@411a109/Release/include/cpprest/details/basic_types.h#L87](https://github.com/microsoft/cpprestsdk/blob/411a109150b270f23c8c97fa4ec9a0a4a98cdecf/Release/include/cpprest/details/basic_types.h#L87) Related to https://github.com/microsoft/cpprestsdk/issues/1805 and https://github.com/fmtlib/fmt/issues/4180 --- .../cpp-rest-sdk-client/cmake-lists.mustache | 1 + .../cpp-rest-sdk-client/model-source.mustache | 42 +++--- .../cpp-restsdk/client/CMakeLists.txt | 1 + .../client/src/model/ApiResponse.cpp | 44 +++---- .../cpp-restsdk/client/src/model/Category.cpp | 32 ++--- .../cpp-restsdk/client/src/model/Color.cpp | 28 ++-- .../cpp-restsdk/client/src/model/Order.cpp | 80 ++++++------ .../cpp-restsdk/client/src/model/Pet.cpp | 80 ++++++------ .../client/src/model/Pet_vaccinationBook.cpp | 123 ------------------ .../client/src/model/SchemaWithSet.cpp | 32 ++--- .../model/SchemaWithSet_vaccinationBook.cpp | 20 +-- .../cpp-restsdk/client/src/model/Tag.cpp | 32 ++--- .../cpp-restsdk/client/src/model/User.cpp | 104 +++++++-------- .../cpp-restsdk/client/src/model/Vaccine.cpp | 32 ++--- 14 files changed, 265 insertions(+), 386 deletions(-) delete mode 100644 samples/client/petstore/cpp-restsdk/client/src/model/Pet_vaccinationBook.cpp diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-lists.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-lists.mustache index c60a256667a..c2076ca4ef2 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-lists.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-lists.mustache @@ -36,6 +36,7 @@ if(NOT CMAKE_BUILD_TYPE) endif() find_package(cpprestsdk REQUIRED) +target_compile_definitions(cpprestsdk::cpprest INTERFACE _TURN_OFF_PLATFORM_STRING) find_package(Boost REQUIRED) include(GNUInstallDirs) diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache index 66a9e42adbd..f6aa3b51728 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache @@ -82,7 +82,7 @@ using EnumUnderlyingType = {{#isNumeric}}int64_t{{/isNumeric}}{{^isNumeric}}util {{/isNumeric}} {{^isNumeric}} {{#enumVars}} - if (val == utility::conversions::to_string_t(U("{{{value}}}"))) + if (val == utility::conversions::to_string_t(_XPLATSTR("{{{value}}}"))) return {{classname}}::e{{classname}}::{{classname}}_{{name}}; {{/enumVars}} {{/isNumeric}} @@ -97,7 +97,7 @@ EnumUnderlyingType fromEnum({{classname}}::e{{classname}} e) { {{#enumVars}} case {{classname}}::e{{classname}}::{{classname}}_{{name}}: - return {{#isNumeric}}{{value}}{{/isNumeric}}{{^isNumeric}}U("{{value}}"){{/isNumeric}}; + return {{#isNumeric}}{{value}}{{/isNumeric}}{{^isNumeric}}_XPLATSTR("{{value}}"){{/isNumeric}}; {{#-last}} default: break; @@ -137,9 +137,9 @@ bool {{classname}}::fromJson(const web::json::value& val) void {{classname}}::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const { utility::string_t namePrefix = prefix; - if (!namePrefix.empty() && namePrefix.back() != U('.')) + if (!namePrefix.empty() && namePrefix.back() != _XPLATSTR('.')) { - namePrefix.push_back(U('.')); + namePrefix.push_back(_XPLATSTR('.')); } auto e = fromEnum(m_value); @@ -150,9 +150,9 @@ bool {{classname}}::fromMultiPart(std::shared_ptr multipart, { bool ok = true; utility::string_t namePrefix = prefix; - if (!namePrefix.empty() && namePrefix.back() != U('.')) + if (!namePrefix.empty() && namePrefix.back() != _XPLATSTR('.')) { - namePrefix.push_back(U('.')); + namePrefix.push_back(_XPLATSTR('.')); } { EnumUnderlyingType e; @@ -231,13 +231,13 @@ web::json::value {{classname}}::toJson() const {{#isEnum}}{{#isContainer}}{{#isArray}} {{{dataType}}} refVal = from{{{enumName}}}(m_{{name}}); {{/isArray}}{{#isMap}} - val[utility::conversions::to_string_t(U("{{baseName}}"))] = ModelBase::toJson(m_{{name}}); + val[utility::conversions::to_string_t(_XPLATSTR("{{baseName}}"))] = ModelBase::toJson(m_{{name}}); {{/isMap}}{{/isContainer}}{{^isContainer}} utility::string_t refVal = from{{{datatypeWithEnum}}}(m_{{name}}); - {{/isContainer}}{{^isMap}}val[utility::conversions::to_string_t(U("{{baseName}}"))] = ModelBase::toJson(refVal); + {{/isContainer}}{{^isMap}}val[utility::conversions::to_string_t(_XPLATSTR("{{baseName}}"))] = ModelBase::toJson(refVal); {{/isMap}}{{/isEnum}} {{^isEnum}} - val[utility::conversions::to_string_t(U("{{baseName}}"))] = ModelBase::toJson(m_{{name}}); + val[utility::conversions::to_string_t(_XPLATSTR("{{baseName}}"))] = ModelBase::toJson(m_{{name}}); {{/isEnum}} } {{/isInherited}} @@ -254,9 +254,9 @@ bool {{classname}}::fromJson(const web::json::value& val) {{/parent}} {{#vars}} {{^isInherited}} - if(val.has_field(utility::conversions::to_string_t(U("{{baseName}}")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("{{baseName}}")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("{{baseName}}"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("{{baseName}}"))); if(!fieldValue.is_null()) { {{{dataType}}} refVal_{{setter}}; @@ -281,26 +281,26 @@ bool {{classname}}::fromJson(const web::json::value& val) void {{classname}}::toMultipart(std::shared_ptr 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(U("."))) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) { - namePrefix += utility::conversions::to_string_t(U(".")); + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); } {{#vars}} if(m_{{name}}IsSet) { {{^isEnum}} - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("{{baseName}}")), m_{{name}})); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("{{baseName}}")), m_{{name}})); {{/isEnum}} {{#isEnum}} {{#isContainer}} {{#isArray}} - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("{{baseName}}")), from{{{enumName}}}(m_{{name}}))); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("{{baseName}}")), from{{{enumName}}}(m_{{name}}))); {{/isArray}}{{#isMap}} - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("{{baseName}}")), m_{{name}})); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("{{baseName}}")), m_{{name}})); {{/isMap}} {{/isContainer}} {{^isContainer}} - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("{{baseName}}")), from{{{datatypeWithEnum}}}(m_{{name}}))); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("{{baseName}}")), from{{{datatypeWithEnum}}}(m_{{name}}))); {{/isContainer}} {{/isEnum}} } @@ -311,16 +311,16 @@ bool {{classname}}::fromMultiPart(std::shared_ptr multipart, { bool ok = true; utility::string_t namePrefix = prefix; - if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) { - namePrefix += utility::conversions::to_string_t(U(".")); + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); } {{#vars}} - if(multipart->hasContent(utility::conversions::to_string_t(U("{{baseName}}")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("{{baseName}}")))) { {{{dataType}}} refVal_{{setter}}; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("{{baseName}}"))), refVal_{{setter}} ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("{{baseName}}"))), refVal_{{setter}} ); {{^isEnum}} {{setter}}(refVal_{{setter}}); {{/isEnum}} diff --git a/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt b/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt index f7243a05ff5..7ab8d11a434 100644 --- a/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt +++ b/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt @@ -36,6 +36,7 @@ if(NOT CMAKE_BUILD_TYPE) endif() find_package(cpprestsdk REQUIRED) +target_compile_definitions(cpprestsdk::cpprest INTERFACE _TURN_OFF_PLATFORM_STRING) find_package(Boost REQUIRED) include(GNUInstallDirs) diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/ApiResponse.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/ApiResponse.cpp index 7245fb98848..baf16d2fd2b 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/ApiResponse.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/ApiResponse.cpp @@ -43,17 +43,17 @@ web::json::value ApiResponse::toJson() const if(m_CodeIsSet) { - val[utility::conversions::to_string_t(U("code"))] = ModelBase::toJson(m_Code); + val[utility::conversions::to_string_t(_XPLATSTR("code"))] = ModelBase::toJson(m_Code); } if(m_TypeIsSet) { - val[utility::conversions::to_string_t(U("type"))] = ModelBase::toJson(m_Type); + val[utility::conversions::to_string_t(_XPLATSTR("type"))] = ModelBase::toJson(m_Type); } if(m_MessageIsSet) { - val[utility::conversions::to_string_t(U("message"))] = ModelBase::toJson(m_Message); + val[utility::conversions::to_string_t(_XPLATSTR("message"))] = ModelBase::toJson(m_Message); } return val; @@ -62,9 +62,9 @@ web::json::value ApiResponse::toJson() const bool ApiResponse::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t(U("code")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("code")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("code"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("code"))); if(!fieldValue.is_null()) { int32_t refVal_setCode; @@ -73,9 +73,9 @@ bool ApiResponse::fromJson(const web::json::value& val) } } - if(val.has_field(utility::conversions::to_string_t(U("type")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("type")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("type"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("type"))); if(!fieldValue.is_null()) { utility::string_t refVal_setType; @@ -84,9 +84,9 @@ bool ApiResponse::fromJson(const web::json::value& val) } } - if(val.has_field(utility::conversions::to_string_t(U("message")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("message")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("message"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("message"))); if(!fieldValue.is_null()) { utility::string_t refVal_setMessage; @@ -101,21 +101,21 @@ bool ApiResponse::fromJson(const web::json::value& val) void ApiResponse::toMultipart(std::shared_ptr 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(U("."))) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) { - namePrefix += utility::conversions::to_string_t(U(".")); + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); } if(m_CodeIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("code")), m_Code)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("code")), m_Code)); } if(m_TypeIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("type")), m_Type)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("type")), m_Type)); } if(m_MessageIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("message")), m_Message)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("message")), m_Message)); } } @@ -123,27 +123,27 @@ bool ApiResponse::fromMultiPart(std::shared_ptr multipart, co { bool ok = true; utility::string_t namePrefix = prefix; - if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) { - namePrefix += utility::conversions::to_string_t(U(".")); + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); } - if(multipart->hasContent(utility::conversions::to_string_t(U("code")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("code")))) { int32_t refVal_setCode; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("code"))), refVal_setCode ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("code"))), refVal_setCode ); setCode(refVal_setCode); } - if(multipart->hasContent(utility::conversions::to_string_t(U("type")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("type")))) { utility::string_t refVal_setType; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("type"))), refVal_setType ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("type"))), refVal_setType ); setType(refVal_setType); } - if(multipart->hasContent(utility::conversions::to_string_t(U("message")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("message")))) { utility::string_t refVal_setMessage; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("message"))), refVal_setMessage ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("message"))), refVal_setMessage ); setMessage(refVal_setMessage); } return ok; diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/Category.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/Category.cpp index 52211db8cbb..68c070a62f8 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/Category.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/Category.cpp @@ -41,12 +41,12 @@ web::json::value Category::toJson() const if(m_IdIsSet) { - val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); + val[utility::conversions::to_string_t(_XPLATSTR("id"))] = ModelBase::toJson(m_Id); } if(m_NameIsSet) { - val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); + val[utility::conversions::to_string_t(_XPLATSTR("name"))] = ModelBase::toJson(m_Name); } return val; @@ -55,9 +55,9 @@ web::json::value Category::toJson() const bool Category::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t(U("id")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("id")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("id"))); if(!fieldValue.is_null()) { int64_t refVal_setId; @@ -66,9 +66,9 @@ bool Category::fromJson(const web::json::value& val) } } - if(val.has_field(utility::conversions::to_string_t(U("name")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("name")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("name"))); if(!fieldValue.is_null()) { utility::string_t refVal_setName; @@ -83,17 +83,17 @@ bool Category::fromJson(const web::json::value& val) void Category::toMultipart(std::shared_ptr 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(U("."))) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) { - namePrefix += utility::conversions::to_string_t(U(".")); + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); } if(m_IdIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("id")), m_Id)); } if(m_NameIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("name")), m_Name)); } } @@ -101,21 +101,21 @@ bool Category::fromMultiPart(std::shared_ptr multipart, const { bool ok = true; utility::string_t namePrefix = prefix; - if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) { - namePrefix += utility::conversions::to_string_t(U(".")); + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); } - if(multipart->hasContent(utility::conversions::to_string_t(U("id")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("id")))) { int64_t refVal_setId; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_setId ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("id"))), refVal_setId ); setId(refVal_setId); } - if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("name")))) { utility::string_t refVal_setName; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_setName ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("name"))), refVal_setName ); setName(refVal_setName); } return ok; diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/Color.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/Color.cpp index ed466db022e..f8e6f781c96 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/Color.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/Color.cpp @@ -24,15 +24,15 @@ using EnumUnderlyingType = utility::string_t; Color::eColor toEnum(const EnumUnderlyingType& val) { - if (val == utility::conversions::to_string_t(U("black"))) + if (val == utility::conversions::to_string_t(_XPLATSTR("black"))) return Color::eColor::Color_BLACK; - if (val == utility::conversions::to_string_t(U("white"))) + if (val == utility::conversions::to_string_t(_XPLATSTR("white"))) return Color::eColor::Color_WHITE; - if (val == utility::conversions::to_string_t(U("brown"))) + if (val == utility::conversions::to_string_t(_XPLATSTR("brown"))) return Color::eColor::Color_BROWN; - if (val == utility::conversions::to_string_t(U("golden"))) + if (val == utility::conversions::to_string_t(_XPLATSTR("golden"))) return Color::eColor::Color_GOLDEN; - if (val == utility::conversions::to_string_t(U("mixed"))) + if (val == utility::conversions::to_string_t(_XPLATSTR("mixed"))) return Color::eColor::Color_MIXED; return {}; } @@ -42,15 +42,15 @@ EnumUnderlyingType fromEnum(Color::eColor e) switch (e) { case Color::eColor::Color_BLACK: - return U("black"); + return _XPLATSTR("black"); case Color::eColor::Color_WHITE: - return U("white"); + return _XPLATSTR("white"); case Color::eColor::Color_BROWN: - return U("brown"); + return _XPLATSTR("brown"); case Color::eColor::Color_GOLDEN: - return U("golden"); + return _XPLATSTR("golden"); case Color::eColor::Color_MIXED: - return U("mixed"); + return _XPLATSTR("mixed"); default: break; } @@ -86,9 +86,9 @@ bool Color::fromJson(const web::json::value& val) void Color::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const { utility::string_t namePrefix = prefix; - if (!namePrefix.empty() && namePrefix.back() != U('.')) + if (!namePrefix.empty() && namePrefix.back() != _XPLATSTR('.')) { - namePrefix.push_back(U('.')); + namePrefix.push_back(_XPLATSTR('.')); } auto e = fromEnum(m_value); @@ -99,9 +99,9 @@ bool Color::fromMultiPart(std::shared_ptr multipart, const ut { bool ok = true; utility::string_t namePrefix = prefix; - if (!namePrefix.empty() && namePrefix.back() != U('.')) + if (!namePrefix.empty() && namePrefix.back() != _XPLATSTR('.')) { - namePrefix.push_back(U('.')); + namePrefix.push_back(_XPLATSTR('.')); } { EnumUnderlyingType e; diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/Order.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/Order.cpp index c4c653d2df1..318ffd19144 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/Order.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/Order.cpp @@ -48,34 +48,34 @@ web::json::value Order::toJson() const if(m_IdIsSet) { - val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); + val[utility::conversions::to_string_t(_XPLATSTR("id"))] = ModelBase::toJson(m_Id); } if(m_PetIdIsSet) { - val[utility::conversions::to_string_t(U("petId"))] = ModelBase::toJson(m_PetId); + val[utility::conversions::to_string_t(_XPLATSTR("petId"))] = ModelBase::toJson(m_PetId); } if(m_QuantityIsSet) { - val[utility::conversions::to_string_t(U("quantity"))] = ModelBase::toJson(m_Quantity); + val[utility::conversions::to_string_t(_XPLATSTR("quantity"))] = ModelBase::toJson(m_Quantity); } if(m_ShipDateIsSet) { - val[utility::conversions::to_string_t(U("shipDate"))] = ModelBase::toJson(m_ShipDate); + val[utility::conversions::to_string_t(_XPLATSTR("shipDate"))] = ModelBase::toJson(m_ShipDate); } if(m_StatusIsSet) { utility::string_t refVal = fromStatusEnum(m_Status); - val[utility::conversions::to_string_t(U("status"))] = ModelBase::toJson(refVal); + val[utility::conversions::to_string_t(_XPLATSTR("status"))] = ModelBase::toJson(refVal); } if(m_CompleteIsSet) { - val[utility::conversions::to_string_t(U("complete"))] = ModelBase::toJson(m_Complete); + val[utility::conversions::to_string_t(_XPLATSTR("complete"))] = ModelBase::toJson(m_Complete); } return val; @@ -84,9 +84,9 @@ web::json::value Order::toJson() const bool Order::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t(U("id")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("id")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("id"))); if(!fieldValue.is_null()) { int64_t refVal_setId; @@ -95,9 +95,9 @@ bool Order::fromJson(const web::json::value& val) } } - if(val.has_field(utility::conversions::to_string_t(U("petId")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("petId")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("petId"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("petId"))); if(!fieldValue.is_null()) { int64_t refVal_setPetId; @@ -106,9 +106,9 @@ bool Order::fromJson(const web::json::value& val) } } - if(val.has_field(utility::conversions::to_string_t(U("quantity")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("quantity")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("quantity"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("quantity"))); if(!fieldValue.is_null()) { int32_t refVal_setQuantity; @@ -117,9 +117,9 @@ bool Order::fromJson(const web::json::value& val) } } - if(val.has_field(utility::conversions::to_string_t(U("shipDate")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("shipDate")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("shipDate"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("shipDate"))); if(!fieldValue.is_null()) { utility::datetime refVal_setShipDate; @@ -128,9 +128,9 @@ bool Order::fromJson(const web::json::value& val) } } - if(val.has_field(utility::conversions::to_string_t(U("status")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("status")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("status"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("status"))); if(!fieldValue.is_null()) { utility::string_t refVal_setStatus; @@ -140,9 +140,9 @@ bool Order::fromJson(const web::json::value& val) } } - if(val.has_field(utility::conversions::to_string_t(U("complete")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("complete")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("complete"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("complete"))); if(!fieldValue.is_null()) { bool refVal_setComplete; @@ -157,33 +157,33 @@ bool Order::fromJson(const web::json::value& val) void Order::toMultipart(std::shared_ptr 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(U("."))) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) { - namePrefix += utility::conversions::to_string_t(U(".")); + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); } if(m_IdIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("id")), m_Id)); } if(m_PetIdIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("petId")), m_PetId)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("petId")), m_PetId)); } if(m_QuantityIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("quantity")), m_Quantity)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("quantity")), m_Quantity)); } if(m_ShipDateIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("shipDate")), m_ShipDate)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("shipDate")), m_ShipDate)); } if(m_StatusIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("status")), fromStatusEnum(m_Status))); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("status")), fromStatusEnum(m_Status))); } if(m_CompleteIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("complete")), m_Complete)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("complete")), m_Complete)); } } @@ -191,45 +191,45 @@ bool Order::fromMultiPart(std::shared_ptr 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(U("."))) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) { - namePrefix += utility::conversions::to_string_t(U(".")); + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); } - if(multipart->hasContent(utility::conversions::to_string_t(U("id")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("id")))) { int64_t refVal_setId; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_setId ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("id"))), refVal_setId ); setId(refVal_setId); } - if(multipart->hasContent(utility::conversions::to_string_t(U("petId")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("petId")))) { int64_t refVal_setPetId; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("petId"))), refVal_setPetId ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("petId"))), refVal_setPetId ); setPetId(refVal_setPetId); } - if(multipart->hasContent(utility::conversions::to_string_t(U("quantity")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("quantity")))) { int32_t refVal_setQuantity; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("quantity"))), refVal_setQuantity ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("quantity"))), refVal_setQuantity ); setQuantity(refVal_setQuantity); } - if(multipart->hasContent(utility::conversions::to_string_t(U("shipDate")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("shipDate")))) { utility::datetime refVal_setShipDate; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("shipDate"))), refVal_setShipDate ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("shipDate"))), refVal_setShipDate ); setShipDate(refVal_setShipDate); } - if(multipart->hasContent(utility::conversions::to_string_t(U("status")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("status")))) { utility::string_t refVal_setStatus; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("status"))), refVal_setStatus ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("status"))), refVal_setStatus ); setStatus(toStatusEnum(refVal_setStatus)); } - if(multipart->hasContent(utility::conversions::to_string_t(U("complete")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("complete")))) { bool refVal_setComplete; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("complete"))), refVal_setComplete ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("complete"))), refVal_setComplete ); setComplete(refVal_setComplete); } return ok; diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/Pet.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/Pet.cpp index 5dc8600ef15..d8226b496ec 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/Pet.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/Pet.cpp @@ -45,33 +45,33 @@ web::json::value Pet::toJson() const if(m_IdIsSet) { - val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); + val[utility::conversions::to_string_t(_XPLATSTR("id"))] = ModelBase::toJson(m_Id); } if(m_CategoryIsSet) { - val[utility::conversions::to_string_t(U("category"))] = ModelBase::toJson(m_Category); + val[utility::conversions::to_string_t(_XPLATSTR("category"))] = ModelBase::toJson(m_Category); } if(m_NameIsSet) { - val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); + val[utility::conversions::to_string_t(_XPLATSTR("name"))] = ModelBase::toJson(m_Name); } if(m_PhotoUrlsIsSet) { - val[utility::conversions::to_string_t(U("photoUrls"))] = ModelBase::toJson(m_PhotoUrls); + val[utility::conversions::to_string_t(_XPLATSTR("photoUrls"))] = ModelBase::toJson(m_PhotoUrls); } if(m_TagsIsSet) { - val[utility::conversions::to_string_t(U("tags"))] = ModelBase::toJson(m_Tags); + val[utility::conversions::to_string_t(_XPLATSTR("tags"))] = ModelBase::toJson(m_Tags); } if(m_StatusIsSet) { utility::string_t refVal = fromStatusEnum(m_Status); - val[utility::conversions::to_string_t(U("status"))] = ModelBase::toJson(refVal); + val[utility::conversions::to_string_t(_XPLATSTR("status"))] = ModelBase::toJson(refVal); } @@ -81,9 +81,9 @@ web::json::value Pet::toJson() const bool Pet::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t(U("id")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("id")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("id"))); if(!fieldValue.is_null()) { int64_t refVal_setId; @@ -92,9 +92,9 @@ bool Pet::fromJson(const web::json::value& val) } } - if(val.has_field(utility::conversions::to_string_t(U("category")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("category")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("category"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("category"))); if(!fieldValue.is_null()) { std::shared_ptr refVal_setCategory; @@ -103,9 +103,9 @@ bool Pet::fromJson(const web::json::value& val) } } - if(val.has_field(utility::conversions::to_string_t(U("name")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("name")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("name"))); if(!fieldValue.is_null()) { utility::string_t refVal_setName; @@ -114,9 +114,9 @@ bool Pet::fromJson(const web::json::value& val) } } - if(val.has_field(utility::conversions::to_string_t(U("photoUrls")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("photoUrls")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("photoUrls"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("photoUrls"))); if(!fieldValue.is_null()) { std::vector refVal_setPhotoUrls; @@ -125,9 +125,9 @@ bool Pet::fromJson(const web::json::value& val) } } - if(val.has_field(utility::conversions::to_string_t(U("tags")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("tags")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("tags"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("tags"))); if(!fieldValue.is_null()) { std::vector> refVal_setTags; @@ -136,9 +136,9 @@ bool Pet::fromJson(const web::json::value& val) } } - if(val.has_field(utility::conversions::to_string_t(U("status")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("status")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("status"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("status"))); if(!fieldValue.is_null()) { utility::string_t refVal_setStatus; @@ -154,33 +154,33 @@ bool Pet::fromJson(const web::json::value& val) void Pet::toMultipart(std::shared_ptr 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(U("."))) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) { - namePrefix += utility::conversions::to_string_t(U(".")); + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); } if(m_IdIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("id")), m_Id)); } if(m_CategoryIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("category")), m_Category)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("category")), m_Category)); } if(m_NameIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("name")), m_Name)); } if(m_PhotoUrlsIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("photoUrls")), m_PhotoUrls)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("photoUrls")), m_PhotoUrls)); } if(m_TagsIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("tags")), m_Tags)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("tags")), m_Tags)); } if(m_StatusIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("status")), fromStatusEnum(m_Status))); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("status")), fromStatusEnum(m_Status))); } } @@ -188,45 +188,45 @@ bool Pet::fromMultiPart(std::shared_ptr 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(U("."))) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) { - namePrefix += utility::conversions::to_string_t(U(".")); + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); } - if(multipart->hasContent(utility::conversions::to_string_t(U("id")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("id")))) { int64_t refVal_setId; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_setId ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("id"))), refVal_setId ); setId(refVal_setId); } - if(multipart->hasContent(utility::conversions::to_string_t(U("category")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("category")))) { std::shared_ptr refVal_setCategory; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("category"))), refVal_setCategory ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("category"))), refVal_setCategory ); setCategory(refVal_setCategory); } - if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("name")))) { utility::string_t refVal_setName; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_setName ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("name"))), refVal_setName ); setName(refVal_setName); } - if(multipart->hasContent(utility::conversions::to_string_t(U("photoUrls")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("photoUrls")))) { std::vector refVal_setPhotoUrls; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("photoUrls"))), refVal_setPhotoUrls ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("photoUrls"))), refVal_setPhotoUrls ); setPhotoUrls(refVal_setPhotoUrls); } - if(multipart->hasContent(utility::conversions::to_string_t(U("tags")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("tags")))) { std::vector> refVal_setTags; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("tags"))), refVal_setTags ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("tags"))), refVal_setTags ); setTags(refVal_setTags); } - if(multipart->hasContent(utility::conversions::to_string_t(U("status")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("status")))) { utility::string_t refVal_setStatus; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("status"))), refVal_setStatus ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("status"))), refVal_setStatus ); setStatus(toStatusEnum(refVal_setStatus)); } return ok; diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/Pet_vaccinationBook.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/Pet_vaccinationBook.cpp deleted file mode 100644 index 082e038bf2e..00000000000 --- a/samples/client/petstore/cpp-restsdk/client/src/model/Pet_vaccinationBook.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/** - * 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 7.6.0-SNAPSHOT. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - - -#include "CppRestPetstoreClient/model/Pet_vaccinationBook.h" - -namespace org { -namespace openapitools { -namespace client { -namespace model { - - - -Pet_vaccinationBook::Pet_vaccinationBook() -{ - m_VaccinesIsSet = false; -} - -Pet_vaccinationBook::~Pet_vaccinationBook() -{ -} - -void Pet_vaccinationBook::validate() -{ - // TODO: implement validation -} - -web::json::value Pet_vaccinationBook::toJson() const -{ - - web::json::value val = web::json::value::object(); - - if(m_VaccinesIsSet) - { - val[utility::conversions::to_string_t(U("vaccines"))] = ModelBase::toJson(m_Vaccines); - } - - return val; -} - -bool Pet_vaccinationBook::fromJson(const web::json::value& val) -{ - bool ok = true; - - if(val.has_field(utility::conversions::to_string_t(U("vaccines")))) - { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("vaccines"))); - if(!fieldValue.is_null()) - { - std::set> refVal_setVaccines; - ok &= ModelBase::fromJson(fieldValue, refVal_setVaccines); - setVaccines(refVal_setVaccines); - } - } - return ok; -} - -void Pet_vaccinationBook::toMultipart(std::shared_ptr 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(U("."))) - { - namePrefix += utility::conversions::to_string_t(U(".")); - } - if(m_VaccinesIsSet) - { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("vaccines")), m_Vaccines)); - } -} - -bool Pet_vaccinationBook::fromMultiPart(std::shared_ptr 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(U("."))) - { - namePrefix += utility::conversions::to_string_t(U(".")); - } - - if(multipart->hasContent(utility::conversions::to_string_t(U("vaccines")))) - { - std::set> refVal_setVaccines; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("vaccines"))), refVal_setVaccines ); - setVaccines(refVal_setVaccines); - } - return ok; -} - -std::set>& Pet_vaccinationBook::getVaccines() -{ - return m_Vaccines; -} - -void Pet_vaccinationBook::setVaccines(const std::set>& value) -{ - m_Vaccines = value; - m_VaccinesIsSet = true; -} - -bool Pet_vaccinationBook::vaccinesIsSet() const -{ - return m_VaccinesIsSet; -} - -void Pet_vaccinationBook::unsetVaccines() -{ - m_VaccinesIsSet = false; -} -} -} -} -} - - diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet.cpp index 95e3b1cce2d..4a5acddcd3f 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet.cpp @@ -39,12 +39,12 @@ web::json::value SchemaWithSet::toJson() const if(m_CertificatesIsSet) { - val[utility::conversions::to_string_t(U("certificates"))] = ModelBase::toJson(m_Certificates); + val[utility::conversions::to_string_t(_XPLATSTR("certificates"))] = ModelBase::toJson(m_Certificates); } if(m_VaccinationBookIsSet) { - val[utility::conversions::to_string_t(U("vaccinationBook"))] = ModelBase::toJson(m_VaccinationBook); + val[utility::conversions::to_string_t(_XPLATSTR("vaccinationBook"))] = ModelBase::toJson(m_VaccinationBook); } return val; @@ -53,9 +53,9 @@ web::json::value SchemaWithSet::toJson() const bool SchemaWithSet::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t(U("certificates")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("certificates")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("certificates"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("certificates"))); if(!fieldValue.is_null()) { std::set refVal_setCertificates; @@ -64,9 +64,9 @@ bool SchemaWithSet::fromJson(const web::json::value& val) } } - if(val.has_field(utility::conversions::to_string_t(U("vaccinationBook")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("vaccinationBook")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("vaccinationBook"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("vaccinationBook"))); if(!fieldValue.is_null()) { std::shared_ptr refVal_setVaccinationBook; @@ -81,17 +81,17 @@ bool SchemaWithSet::fromJson(const web::json::value& val) void SchemaWithSet::toMultipart(std::shared_ptr 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(U("."))) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) { - namePrefix += utility::conversions::to_string_t(U(".")); + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); } if(m_CertificatesIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("certificates")), m_Certificates)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("certificates")), m_Certificates)); } if(m_VaccinationBookIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("vaccinationBook")), m_VaccinationBook)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("vaccinationBook")), m_VaccinationBook)); } } @@ -99,21 +99,21 @@ bool SchemaWithSet::fromMultiPart(std::shared_ptr multipart, { bool ok = true; utility::string_t namePrefix = prefix; - if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) { - namePrefix += utility::conversions::to_string_t(U(".")); + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); } - if(multipart->hasContent(utility::conversions::to_string_t(U("certificates")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("certificates")))) { std::set refVal_setCertificates; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("certificates"))), refVal_setCertificates ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("certificates"))), refVal_setCertificates ); setCertificates(refVal_setCertificates); } - if(multipart->hasContent(utility::conversions::to_string_t(U("vaccinationBook")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("vaccinationBook")))) { std::shared_ptr refVal_setVaccinationBook; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("vaccinationBook"))), refVal_setVaccinationBook ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("vaccinationBook"))), refVal_setVaccinationBook ); setVaccinationBook(refVal_setVaccinationBook); } return ok; diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet_vaccinationBook.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet_vaccinationBook.cpp index 55219675432..5ce8635504e 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet_vaccinationBook.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithSet_vaccinationBook.cpp @@ -38,7 +38,7 @@ web::json::value SchemaWithSet_vaccinationBook::toJson() const if(m_VaccinesIsSet) { - val[utility::conversions::to_string_t(U("vaccines"))] = ModelBase::toJson(m_Vaccines); + val[utility::conversions::to_string_t(_XPLATSTR("vaccines"))] = ModelBase::toJson(m_Vaccines); } return val; @@ -47,9 +47,9 @@ web::json::value SchemaWithSet_vaccinationBook::toJson() const bool SchemaWithSet_vaccinationBook::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t(U("vaccines")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("vaccines")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("vaccines"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("vaccines"))); if(!fieldValue.is_null()) { std::set> refVal_setVaccines; @@ -64,13 +64,13 @@ bool SchemaWithSet_vaccinationBook::fromJson(const web::json::value& val) void SchemaWithSet_vaccinationBook::toMultipart(std::shared_ptr 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(U("."))) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) { - namePrefix += utility::conversions::to_string_t(U(".")); + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); } if(m_VaccinesIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("vaccines")), m_Vaccines)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("vaccines")), m_Vaccines)); } } @@ -78,15 +78,15 @@ bool SchemaWithSet_vaccinationBook::fromMultiPart(std::shared_ptr 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) { - namePrefix += utility::conversions::to_string_t(U(".")); + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); } - if(multipart->hasContent(utility::conversions::to_string_t(U("vaccines")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("vaccines")))) { std::set> refVal_setVaccines; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("vaccines"))), refVal_setVaccines ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("vaccines"))), refVal_setVaccines ); setVaccines(refVal_setVaccines); } return ok; diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/Tag.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/Tag.cpp index f87bca8a854..ab6f736acfa 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/Tag.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/Tag.cpp @@ -41,12 +41,12 @@ web::json::value Tag::toJson() const if(m_IdIsSet) { - val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); + val[utility::conversions::to_string_t(_XPLATSTR("id"))] = ModelBase::toJson(m_Id); } if(m_NameIsSet) { - val[utility::conversions::to_string_t(U("name"))] = ModelBase::toJson(m_Name); + val[utility::conversions::to_string_t(_XPLATSTR("name"))] = ModelBase::toJson(m_Name); } return val; @@ -55,9 +55,9 @@ web::json::value Tag::toJson() const bool Tag::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t(U("id")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("id")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("id"))); if(!fieldValue.is_null()) { int64_t refVal_setId; @@ -66,9 +66,9 @@ bool Tag::fromJson(const web::json::value& val) } } - if(val.has_field(utility::conversions::to_string_t(U("name")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("name")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("name"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("name"))); if(!fieldValue.is_null()) { utility::string_t refVal_setName; @@ -83,17 +83,17 @@ bool Tag::fromJson(const web::json::value& val) void Tag::toMultipart(std::shared_ptr 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(U("."))) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) { - namePrefix += utility::conversions::to_string_t(U(".")); + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); } if(m_IdIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("id")), m_Id)); } if(m_NameIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("name")), m_Name)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("name")), m_Name)); } } @@ -101,21 +101,21 @@ bool Tag::fromMultiPart(std::shared_ptr 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(U("."))) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) { - namePrefix += utility::conversions::to_string_t(U(".")); + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); } - if(multipart->hasContent(utility::conversions::to_string_t(U("id")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("id")))) { int64_t refVal_setId; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_setId ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("id"))), refVal_setId ); setId(refVal_setId); } - if(multipart->hasContent(utility::conversions::to_string_t(U("name")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("name")))) { utility::string_t refVal_setName; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("name"))), refVal_setName ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("name"))), refVal_setName ); setName(refVal_setName); } return ok; diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/User.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/User.cpp index 66ad13c8a46..7acf37ad21d 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/User.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/User.cpp @@ -53,42 +53,42 @@ web::json::value User::toJson() const if(m_IdIsSet) { - val[utility::conversions::to_string_t(U("id"))] = ModelBase::toJson(m_Id); + val[utility::conversions::to_string_t(_XPLATSTR("id"))] = ModelBase::toJson(m_Id); } if(m_UsernameIsSet) { - val[utility::conversions::to_string_t(U("username"))] = ModelBase::toJson(m_Username); + val[utility::conversions::to_string_t(_XPLATSTR("username"))] = ModelBase::toJson(m_Username); } if(m_FirstNameIsSet) { - val[utility::conversions::to_string_t(U("firstName"))] = ModelBase::toJson(m_FirstName); + val[utility::conversions::to_string_t(_XPLATSTR("firstName"))] = ModelBase::toJson(m_FirstName); } if(m_LastNameIsSet) { - val[utility::conversions::to_string_t(U("lastName"))] = ModelBase::toJson(m_LastName); + val[utility::conversions::to_string_t(_XPLATSTR("lastName"))] = ModelBase::toJson(m_LastName); } if(m_EmailIsSet) { - val[utility::conversions::to_string_t(U("email"))] = ModelBase::toJson(m_Email); + val[utility::conversions::to_string_t(_XPLATSTR("email"))] = ModelBase::toJson(m_Email); } if(m_PasswordIsSet) { - val[utility::conversions::to_string_t(U("password"))] = ModelBase::toJson(m_Password); + val[utility::conversions::to_string_t(_XPLATSTR("password"))] = ModelBase::toJson(m_Password); } if(m_PhoneIsSet) { - val[utility::conversions::to_string_t(U("phone"))] = ModelBase::toJson(m_Phone); + val[utility::conversions::to_string_t(_XPLATSTR("phone"))] = ModelBase::toJson(m_Phone); } if(m_UserStatusIsSet) { - val[utility::conversions::to_string_t(U("userStatus"))] = ModelBase::toJson(m_UserStatus); + val[utility::conversions::to_string_t(_XPLATSTR("userStatus"))] = ModelBase::toJson(m_UserStatus); } return val; @@ -97,9 +97,9 @@ web::json::value User::toJson() const bool User::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t(U("id")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("id")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("id"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("id"))); if(!fieldValue.is_null()) { int64_t refVal_setId; @@ -108,9 +108,9 @@ bool User::fromJson(const web::json::value& val) } } - if(val.has_field(utility::conversions::to_string_t(U("username")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("username")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("username"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("username"))); if(!fieldValue.is_null()) { utility::string_t refVal_setUsername; @@ -119,9 +119,9 @@ bool User::fromJson(const web::json::value& val) } } - if(val.has_field(utility::conversions::to_string_t(U("firstName")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("firstName")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("firstName"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("firstName"))); if(!fieldValue.is_null()) { utility::string_t refVal_setFirstName; @@ -130,9 +130,9 @@ bool User::fromJson(const web::json::value& val) } } - if(val.has_field(utility::conversions::to_string_t(U("lastName")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("lastName")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("lastName"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("lastName"))); if(!fieldValue.is_null()) { utility::string_t refVal_setLastName; @@ -141,9 +141,9 @@ bool User::fromJson(const web::json::value& val) } } - if(val.has_field(utility::conversions::to_string_t(U("email")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("email")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("email"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("email"))); if(!fieldValue.is_null()) { utility::string_t refVal_setEmail; @@ -152,9 +152,9 @@ bool User::fromJson(const web::json::value& val) } } - if(val.has_field(utility::conversions::to_string_t(U("password")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("password")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("password"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("password"))); if(!fieldValue.is_null()) { utility::string_t refVal_setPassword; @@ -163,9 +163,9 @@ bool User::fromJson(const web::json::value& val) } } - if(val.has_field(utility::conversions::to_string_t(U("phone")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("phone")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("phone"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("phone"))); if(!fieldValue.is_null()) { utility::string_t refVal_setPhone; @@ -174,9 +174,9 @@ bool User::fromJson(const web::json::value& val) } } - if(val.has_field(utility::conversions::to_string_t(U("userStatus")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("userStatus")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("userStatus"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("userStatus"))); if(!fieldValue.is_null()) { int32_t refVal_setUserStatus; @@ -191,41 +191,41 @@ bool User::fromJson(const web::json::value& val) void User::toMultipart(std::shared_ptr 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(U("."))) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) { - namePrefix += utility::conversions::to_string_t(U(".")); + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); } if(m_IdIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("id")), m_Id)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("id")), m_Id)); } if(m_UsernameIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("username")), m_Username)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("username")), m_Username)); } if(m_FirstNameIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("firstName")), m_FirstName)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("firstName")), m_FirstName)); } if(m_LastNameIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("lastName")), m_LastName)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("lastName")), m_LastName)); } if(m_EmailIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("email")), m_Email)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("email")), m_Email)); } if(m_PasswordIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("password")), m_Password)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("password")), m_Password)); } if(m_PhoneIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("phone")), m_Phone)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("phone")), m_Phone)); } if(m_UserStatusIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("userStatus")), m_UserStatus)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("userStatus")), m_UserStatus)); } } @@ -233,57 +233,57 @@ bool User::fromMultiPart(std::shared_ptr 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(U("."))) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) { - namePrefix += utility::conversions::to_string_t(U(".")); + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); } - if(multipart->hasContent(utility::conversions::to_string_t(U("id")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("id")))) { int64_t refVal_setId; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("id"))), refVal_setId ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("id"))), refVal_setId ); setId(refVal_setId); } - if(multipart->hasContent(utility::conversions::to_string_t(U("username")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("username")))) { utility::string_t refVal_setUsername; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("username"))), refVal_setUsername ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("username"))), refVal_setUsername ); setUsername(refVal_setUsername); } - if(multipart->hasContent(utility::conversions::to_string_t(U("firstName")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("firstName")))) { utility::string_t refVal_setFirstName; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("firstName"))), refVal_setFirstName ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("firstName"))), refVal_setFirstName ); setFirstName(refVal_setFirstName); } - if(multipart->hasContent(utility::conversions::to_string_t(U("lastName")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("lastName")))) { utility::string_t refVal_setLastName; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("lastName"))), refVal_setLastName ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("lastName"))), refVal_setLastName ); setLastName(refVal_setLastName); } - if(multipart->hasContent(utility::conversions::to_string_t(U("email")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("email")))) { utility::string_t refVal_setEmail; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("email"))), refVal_setEmail ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("email"))), refVal_setEmail ); setEmail(refVal_setEmail); } - if(multipart->hasContent(utility::conversions::to_string_t(U("password")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("password")))) { utility::string_t refVal_setPassword; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("password"))), refVal_setPassword ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("password"))), refVal_setPassword ); setPassword(refVal_setPassword); } - if(multipart->hasContent(utility::conversions::to_string_t(U("phone")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("phone")))) { utility::string_t refVal_setPhone; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("phone"))), refVal_setPhone ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("phone"))), refVal_setPhone ); setPhone(refVal_setPhone); } - if(multipart->hasContent(utility::conversions::to_string_t(U("userStatus")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("userStatus")))) { int32_t refVal_setUserStatus; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("userStatus"))), refVal_setUserStatus ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("userStatus"))), refVal_setUserStatus ); setUserStatus(refVal_setUserStatus); } return ok; diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/Vaccine.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/Vaccine.cpp index 0ad7608161e..98b27c8e22e 100644 --- a/samples/client/petstore/cpp-restsdk/client/src/model/Vaccine.cpp +++ b/samples/client/petstore/cpp-restsdk/client/src/model/Vaccine.cpp @@ -40,12 +40,12 @@ web::json::value Vaccine::toJson() const if(m_dateIsSet) { - val[utility::conversions::to_string_t(U("date"))] = ModelBase::toJson(m_date); + val[utility::conversions::to_string_t(_XPLATSTR("date"))] = ModelBase::toJson(m_date); } if(m_BoosterRequiredIsSet) { - val[utility::conversions::to_string_t(U("boosterRequired"))] = ModelBase::toJson(m_BoosterRequired); + val[utility::conversions::to_string_t(_XPLATSTR("boosterRequired"))] = ModelBase::toJson(m_BoosterRequired); } return val; @@ -54,9 +54,9 @@ web::json::value Vaccine::toJson() const bool Vaccine::fromJson(const web::json::value& val) { bool ok = true; - if(val.has_field(utility::conversions::to_string_t(U("date")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("date")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("date"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("date"))); if(!fieldValue.is_null()) { std::shared_ptr refVal_setDate; @@ -65,9 +65,9 @@ bool Vaccine::fromJson(const web::json::value& val) } } - if(val.has_field(utility::conversions::to_string_t(U("boosterRequired")))) + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("boosterRequired")))) { - const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(U("boosterRequired"))); + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("boosterRequired"))); if(!fieldValue.is_null()) { bool refVal_setBoosterRequired; @@ -82,17 +82,17 @@ bool Vaccine::fromJson(const web::json::value& val) void Vaccine::toMultipart(std::shared_ptr 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(U("."))) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) { - namePrefix += utility::conversions::to_string_t(U(".")); + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); } if(m_dateIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("date")), m_date)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("date")), m_date)); } if(m_BoosterRequiredIsSet) { - multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(U("boosterRequired")), m_BoosterRequired)); + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("boosterRequired")), m_BoosterRequired)); } } @@ -100,21 +100,21 @@ bool Vaccine::fromMultiPart(std::shared_ptr multipart, const { bool ok = true; utility::string_t namePrefix = prefix; - if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(U("."))) + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) { - namePrefix += utility::conversions::to_string_t(U(".")); + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); } - if(multipart->hasContent(utility::conversions::to_string_t(U("date")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("date")))) { std::shared_ptr refVal_setDate; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("date"))), refVal_setDate ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("date"))), refVal_setDate ); setDate(refVal_setDate); } - if(multipart->hasContent(utility::conversions::to_string_t(U("boosterRequired")))) + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("boosterRequired")))) { bool refVal_setBoosterRequired; - ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(U("boosterRequired"))), refVal_setBoosterRequired ); + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("boosterRequired"))), refVal_setBoosterRequired ); setBoosterRequired(refVal_setBoosterRequired); } return ok;