C++ was the last language owning its own invocation, and it gave two reasons. `templates:` retired the first one for rust already; this retires the second, which needs saying precisely because it was true when it was written. The floor said generator 7.24.0 against the 7.14.0 pinned here, because on 7.14.0 ten translation units would not compile through two defects in the generator's type resolution that no template reaches — mustache interpolates the strings resolution produces, it cannot recompute a type. Both defects were real. Both lived in SCHEMAS THE DOCUMENT NO LONGER CARRIES: vector_NamedVectors / vector_DenseVector under additionalProperties (9 TUs), and an integer-backed enum declared over utility::string_t and defined over int32_t, framework_Document.docstatus (1 TU). Neither schema exists at the ref this fleet reads, so neither defect is reachable and the floor expired with its cause. Re-measured rather than argued: at cloud@49389cf9, ignoring blank lines and the generator string each file's header carries, exactly one of 5327 files differs between 7.14.0 and 7.24.0 — a doc comment on ConsoleSettings::getOidcConfig. On 7.14.0 the library builds with 0 errors (2663 sources, 192 API classes, 2462 models, 2502 operations) and the six example flows build with 0 errors, on aarch64 Ubuntu 24.04 with g++ 13.3. So the row needs no version of its own and this does not raise the pin. The four cpp-restsdk overrides move here as templates/cpp-restsdk/, next to the flags they go with. They are load-bearing and measured: generating without them fails with 8 errors, all in ModelBase.h. One flag, and it is the one six other rows already carry. o11y.GettableAgentCheckIn publishes integration_config beside integrationConfig and removed_at beside removedAt so older agents keep working; C++ camel-cases a property into its accessor, so each pair declared one method twice. Renaming the accessor keeps both wire keys — measured, all four are present in the emitted model, each under the document's own name. `take` is include/ and src/. The generator's CMakeLists.txt, Config.cmake.in, git_push.sh and README.md sit at the output root under neither, so they are never copied and need no `drop` entry — the repo keeps its own build contract. Verified against the tree the departed script produced: `generate.py cpp --check` reports clean, byte for byte, 5327 files. Co-authored-by: Hanzo Dev <[email protected]>
530 lines
21 KiB
Plaintext
530 lines
21 KiB
Plaintext
{{! openapi-generator 7.24.0 cpp-rest-sdk-client/modelbase-header.mustache, overridden.
|
|
Forked from the stock template at that exact version, so a bump
|
|
re-derives these rather than merging them. Every changed hunk carries
|
|
a comment saying which generator defect it fixes; the measurement is
|
|
in LLM.md. Nothing here says anything about the Hanzo API. }}
|
|
{{>licenseInfo}}
|
|
/*
|
|
* ModelBase.h
|
|
*
|
|
* This is the base class for all model classes
|
|
*/
|
|
|
|
#ifndef {{modelHeaderGuardPrefix}}_ModelBase_H_
|
|
#define {{modelHeaderGuardPrefix}}_ModelBase_H_
|
|
|
|
{{{defaultInclude}}}
|
|
|
|
#include "{{packageName}}/HttpContent.h"
|
|
#include "{{packageName}}/MultipartFormData.h"
|
|
|
|
#include <cpprest/details/basic_types.h>
|
|
#include <cpprest/json.h>
|
|
|
|
#include <map>
|
|
#include <memory>
|
|
#include <set>
|
|
#include <sstream>
|
|
#include <type_traits>
|
|
#include <vector>
|
|
|
|
{{#modelNamespaceDeclarations}}
|
|
namespace {{this}} {
|
|
{{/modelNamespaceDeclarations}}
|
|
|
|
class {{declspec}} ModelBase
|
|
{
|
|
public:
|
|
ModelBase();
|
|
virtual ~ModelBase();
|
|
|
|
virtual void validate() = 0;
|
|
|
|
virtual web::json::value toJson() const = 0;
|
|
virtual bool fromJson( const web::json::value& json ) = 0;
|
|
|
|
virtual void toMultipart( std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix ) const = 0;
|
|
virtual bool fromMultiPart( std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix ) = 0;
|
|
|
|
virtual bool isSet() const;
|
|
|
|
static utility::string_t toString( const bool val );
|
|
static utility::string_t toString( const float val );
|
|
static utility::string_t toString( const double val );
|
|
static utility::string_t toString( const int32_t val );
|
|
static utility::string_t toString( const int64_t val );
|
|
static utility::string_t toString( const utility::string_t &val );
|
|
static utility::string_t toString( const utility::datetime &val );
|
|
static utility::string_t toString( const web::json::value &val );
|
|
static utility::string_t toString( const std::shared_ptr<HttpContent>& val );
|
|
template <typename T>
|
|
static utility::string_t toString( const std::shared_ptr<T>& val );
|
|
template <typename T>
|
|
static utility::string_t toString( const std::vector<T> & val );
|
|
template <typename T>
|
|
static utility::string_t toString( const std::set<T> & val );
|
|
|
|
{{! A free-form `object` schema maps to Object, a ModelBase subclass held BY
|
|
VALUE (std::vector<Object>, and so on). The overload set below covers
|
|
primitives and std::shared_ptr<T> but not that, so toJson/fromJson on a
|
|
container of Object finds no overload. A model carries itself. }}
|
|
template <typename T, typename std::enable_if<std::is_base_of<ModelBase, T>::value, int>::type = 0>
|
|
static web::json::value toJson( const T& val ) { return val.toJson(); }
|
|
template <typename T, typename std::enable_if<std::is_base_of<ModelBase, T>::value, int>::type = 0>
|
|
static bool fromJson( const web::json::value& val, T& outVal ) { return outVal.fromJson(val); }
|
|
|
|
template <typename T, typename std::enable_if<std::is_base_of<ModelBase, T>::value, int>::type = 0>
|
|
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, const T& val, const utility::string_t& contentType = utility::conversions::to_string_t("application/json") )
|
|
{
|
|
std::shared_ptr<HttpContent> content = std::make_shared<HttpContent>();
|
|
content->setName( name );
|
|
content->setContentDisposition( utility::conversions::to_string_t("form-data") );
|
|
content->setContentType( contentType );
|
|
content->setData( std::make_shared<std::stringstream>( utility::conversions::to_utf8string(val.toJson().serialize()) ) );
|
|
return content;
|
|
}
|
|
template <typename T, typename std::enable_if<std::is_base_of<ModelBase, T>::value, int>::type = 0>
|
|
static bool fromHttpContent( std::shared_ptr<HttpContent> val, T& outVal )
|
|
{
|
|
if (val == nullptr) return false;
|
|
utility::string_t str;
|
|
ModelBase::fromHttpContent(val, str);
|
|
return outVal.fromJson(web::json::value::parse(str));
|
|
}
|
|
|
|
static web::json::value toJson( bool val );
|
|
static web::json::value toJson( float val );
|
|
static web::json::value toJson( double val );
|
|
static web::json::value toJson( int32_t val );
|
|
static web::json::value toJson( int64_t val );
|
|
static web::json::value toJson( const utility::string_t& val );
|
|
static web::json::value toJson( const utility::datetime& val );
|
|
static web::json::value toJson( const web::json::value& val );
|
|
static web::json::value toJson( const std::shared_ptr<HttpContent>& val );
|
|
template<typename T>
|
|
static web::json::value toJson( const std::shared_ptr<T>& val );
|
|
static web::json::value toJson( const std::shared_ptr<utility::datetime>& val );
|
|
template<typename T>
|
|
static web::json::value toJson( const std::vector<T>& val );
|
|
template<typename T>
|
|
static web::json::value toJson( const std::set<T>& val );
|
|
template<typename T>
|
|
static web::json::value toJson( const std::map<utility::string_t, T>& val );
|
|
|
|
static bool fromString( const utility::string_t& val, bool & );
|
|
static bool fromString( const utility::string_t& val, float & );
|
|
static bool fromString( const utility::string_t& val, double & );
|
|
static bool fromString( const utility::string_t& val, int32_t & );
|
|
static bool fromString( const utility::string_t& val, int64_t & );
|
|
static bool fromString( const utility::string_t& val, utility::string_t & );
|
|
static bool fromString( const utility::string_t& val, utility::datetime & );
|
|
static bool fromString( const utility::string_t& val, web::json::value & );
|
|
static bool fromString( const utility::string_t& val, std::shared_ptr<HttpContent> & );
|
|
template<typename T>
|
|
static bool fromString( const utility::string_t& val, std::shared_ptr<T>& );
|
|
static bool fromString( const utility::string_t& val, std::shared_ptr<utility::datetime>& outVal );
|
|
template<typename T>
|
|
static bool fromString( const utility::string_t& val, std::vector<T> & );
|
|
template<typename T>
|
|
static bool fromString( const utility::string_t& val, std::set<T> & );
|
|
template<typename T>
|
|
static bool fromString( const utility::string_t& val, std::map<utility::string_t, T> & );
|
|
|
|
static bool fromJson( const web::json::value& val, bool & );
|
|
static bool fromJson( const web::json::value& val, float & );
|
|
static bool fromJson( const web::json::value& val, double & );
|
|
static bool fromJson( const web::json::value& val, int32_t & );
|
|
static bool fromJson( const web::json::value& val, int64_t & );
|
|
static bool fromJson( const web::json::value& val, utility::string_t & );
|
|
static bool fromJson( const web::json::value& val, utility::datetime & );
|
|
static bool fromJson( const web::json::value& val, web::json::value & );
|
|
static bool fromJson( const web::json::value& val, std::shared_ptr<HttpContent> & );
|
|
template<typename T>
|
|
static bool fromJson( const web::json::value& val, std::shared_ptr<T>& );
|
|
static bool fromJson( const web::json::value& val, std::shared_ptr<utility::datetime> &outVal );
|
|
template<typename T>
|
|
static bool fromJson( const web::json::value& val, std::vector<T> & );
|
|
template<typename T>
|
|
static bool fromJson( const web::json::value& val, std::set<T> & );
|
|
template<typename T>
|
|
static bool fromJson( const web::json::value& val, std::map<utility::string_t, T> & );
|
|
|
|
|
|
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, bool value, const utility::string_t& contentType = utility::conversions::to_string_t("") );
|
|
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, float value, const utility::string_t& contentType = utility::conversions::to_string_t("") );
|
|
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, double value, const utility::string_t& contentType = utility::conversions::to_string_t("") );
|
|
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, int32_t value, const utility::string_t& contentType = utility::conversions::to_string_t("") );
|
|
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, int64_t value, const utility::string_t& contentType = utility::conversions::to_string_t("") );
|
|
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, const utility::string_t& value, const utility::string_t& contentType = utility::conversions::to_string_t(""));
|
|
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, const utility::datetime& value, const utility::string_t& contentType = utility::conversions::to_string_t(""));
|
|
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, const web::json::value& value, const utility::string_t& contentType = utility::conversions::to_string_t("application/json") );
|
|
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, const std::shared_ptr<HttpContent>& );
|
|
template <typename T>
|
|
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, const std::shared_ptr<T>& , const utility::string_t& contentType = utility::conversions::to_string_t("application/json") );
|
|
static std::shared_ptr<HttpContent> toHttpContent(const utility::string_t& name, const std::shared_ptr<utility::datetime>& value , const utility::string_t& contentType = utility::conversions::to_string_t("application/json") );
|
|
template <typename T>
|
|
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, const std::vector<T>& value, const utility::string_t& contentType = utility::conversions::to_string_t("") );
|
|
template <typename T>
|
|
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, const std::set<T>& value, const utility::string_t& contentType = utility::conversions::to_string_t("") );
|
|
template <typename T>
|
|
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, const std::map<utility::string_t, T>& value, const utility::string_t& contentType = utility::conversions::to_string_t("") );
|
|
|
|
static bool fromHttpContent( std::shared_ptr<HttpContent> val, bool & );
|
|
static bool fromHttpContent( std::shared_ptr<HttpContent> val, float & );
|
|
static bool fromHttpContent( std::shared_ptr<HttpContent> val, double & );
|
|
static bool fromHttpContent( std::shared_ptr<HttpContent> val, int64_t & );
|
|
static bool fromHttpContent( std::shared_ptr<HttpContent> val, int32_t & );
|
|
static bool fromHttpContent( std::shared_ptr<HttpContent> val, utility::string_t & );
|
|
static bool fromHttpContent( std::shared_ptr<HttpContent> val, utility::datetime & );
|
|
static bool fromHttpContent( std::shared_ptr<HttpContent> val, web::json::value & );
|
|
static bool fromHttpContent( std::shared_ptr<HttpContent> val, std::shared_ptr<HttpContent>& );
|
|
template <typename T>
|
|
static bool fromHttpContent( std::shared_ptr<HttpContent> val, std::shared_ptr<T>& );
|
|
template <typename T>
|
|
static bool fromHttpContent( std::shared_ptr<HttpContent> val, std::vector<T> & );
|
|
template <typename T>
|
|
static bool fromHttpContent( std::shared_ptr<HttpContent> val, std::set<T> & );
|
|
template <typename T>
|
|
static bool fromHttpContent( std::shared_ptr<HttpContent> val, std::map<utility::string_t, T> & );
|
|
|
|
static utility::string_t toBase64( utility::string_t value );
|
|
static utility::string_t toBase64( std::shared_ptr<std::istream> value );
|
|
static std::shared_ptr<std::istream> fromBase64( const utility::string_t& encoded );
|
|
protected:
|
|
bool m_IsSet;
|
|
};
|
|
|
|
template <typename T>
|
|
utility::string_t ModelBase::toString( const std::shared_ptr<T>& val )
|
|
{
|
|
utility::stringstream_t ss;
|
|
if( val != nullptr )
|
|
{
|
|
val->toJson().serialize(ss);
|
|
}
|
|
return utility::string_t(ss.str());
|
|
}
|
|
|
|
// std::vector to string
|
|
template<typename T>
|
|
utility::string_t ModelBase::toString( const std::vector<T> & val )
|
|
{
|
|
utility::string_t strArray;
|
|
for ( const auto &item : val )
|
|
{
|
|
strArray.append( toString(item) + "," );
|
|
}
|
|
if (val.count() > 0)
|
|
{
|
|
strArray.pop_back();
|
|
}
|
|
return strArray;
|
|
}
|
|
|
|
// std::set to string
|
|
template<typename T>
|
|
utility::string_t ModelBase::toString( const std::set<T> & val )
|
|
{
|
|
utility::string_t strArray;
|
|
for ( const auto &item : val )
|
|
{
|
|
strArray.append( toString(item) + "," );
|
|
}
|
|
if (val.count() > 0)
|
|
{
|
|
strArray.pop_back();
|
|
}
|
|
return strArray;
|
|
}
|
|
|
|
|
|
template<typename T>
|
|
web::json::value ModelBase::toJson( const std::shared_ptr<T>& val )
|
|
{
|
|
web::json::value retVal;
|
|
if(val != nullptr)
|
|
{
|
|
retVal = val->toJson();
|
|
}
|
|
return retVal;
|
|
}
|
|
|
|
// std::vector to json
|
|
template<typename T>
|
|
web::json::value ModelBase::toJson( const std::vector<T>& value )
|
|
{
|
|
std::vector<web::json::value> ret;
|
|
for ( const auto& x : value )
|
|
{
|
|
ret.push_back( toJson(x) );
|
|
}
|
|
return web::json::value::array(ret);
|
|
}
|
|
|
|
// std::set to json
|
|
template<typename T>
|
|
web::json::value ModelBase::toJson( const std::set<T>& value )
|
|
{
|
|
// There's no prototype web::json::value::array(...) taking a std::set parameter. Converting to std::vector to get an array.
|
|
std::vector<web::json::value> ret;
|
|
for ( const auto& x : value )
|
|
{
|
|
ret.push_back( toJson(x) );
|
|
}
|
|
return web::json::value::array(ret);
|
|
}
|
|
|
|
|
|
template<typename T>
|
|
web::json::value ModelBase::toJson( const std::map<utility::string_t, T>& val )
|
|
{
|
|
web::json::value obj;
|
|
for ( const auto &itemkey : val )
|
|
{
|
|
obj[itemkey.first] = toJson( itemkey.second );
|
|
}
|
|
return obj;
|
|
}
|
|
template<typename T>
|
|
bool ModelBase::fromString( const utility::string_t& val, std::shared_ptr<T>& outVal )
|
|
{
|
|
bool ok = false;
|
|
if(outVal == nullptr)
|
|
{
|
|
outVal = std::make_shared<T>();
|
|
}
|
|
if( outVal != nullptr )
|
|
{
|
|
ok = outVal->fromJson(web::json::value::parse(val));
|
|
}
|
|
return ok;
|
|
}
|
|
template<typename T>
|
|
bool ModelBase::fromString(const utility::string_t& val, std::vector<T>& outVal )
|
|
{
|
|
bool ok = true;
|
|
web::json::value jsonValue = web::json::value::parse(val);
|
|
if (jsonValue.is_array())
|
|
{
|
|
for (const web::json::value& jitem : jsonValue.as_array())
|
|
{
|
|
T item;
|
|
ok &= fromJson(jitem, item);
|
|
outVal.push_back(item);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
T item;
|
|
ok = fromJson(jsonValue, item);
|
|
outVal.push_back(item);
|
|
}
|
|
return ok;
|
|
}
|
|
template<typename T>
|
|
bool ModelBase::fromString(const utility::string_t& val, std::set<T>& outVal )
|
|
{
|
|
bool ok = true;
|
|
web::json::value jsonValue = web::json::value::parse(val);
|
|
if (jsonValue.is_array())
|
|
{
|
|
for (const web::json::value& jitem : jsonValue.as_array())
|
|
{
|
|
T item;
|
|
ok &= fromJson(jitem, item);
|
|
outVal.insert(item);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
T item;
|
|
ok = fromJson(jsonValue, item);
|
|
outVal.insert(item);
|
|
}
|
|
return ok;
|
|
}
|
|
template<typename T>
|
|
bool ModelBase::fromString(const utility::string_t& val, std::map<utility::string_t, T>& outVal )
|
|
{
|
|
bool ok = false;
|
|
web::json::value jsonValue = web::json::value::parse(val);
|
|
if (jsonValue.is_array())
|
|
{
|
|
for (const web::json::value& jitem : jsonValue.as_array())
|
|
{
|
|
T item;
|
|
ok &= fromJson(jitem, item);
|
|
outVal.insert({ val, item });
|
|
}
|
|
}
|
|
else
|
|
{
|
|
T item;
|
|
ok = fromJson(jsonValue, item);
|
|
outVal.insert({ val, item });
|
|
}
|
|
return ok;
|
|
}
|
|
template<typename T>
|
|
bool ModelBase::fromJson( const web::json::value& val, std::shared_ptr<T> &outVal )
|
|
{
|
|
bool ok = false;
|
|
if(outVal == nullptr)
|
|
{
|
|
outVal = std::make_shared<T>();
|
|
}
|
|
if( outVal != nullptr )
|
|
{
|
|
ok = outVal->fromJson(val);
|
|
}
|
|
return ok;
|
|
}
|
|
template<typename T>
|
|
bool ModelBase::fromJson( const web::json::value& val, std::vector<T> &outVal )
|
|
{
|
|
bool ok = true;
|
|
if (val.is_array())
|
|
{
|
|
for (const web::json::value & jitem : val.as_array())
|
|
{
|
|
T item;
|
|
ok &= fromJson(jitem, item);
|
|
outVal.push_back(item);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ok = false;
|
|
}
|
|
return ok;
|
|
}
|
|
template<typename T>
|
|
bool ModelBase::fromJson(const web::json::value& val, std::set<T>& outVal )
|
|
{
|
|
bool ok = true;
|
|
if (val.is_array())
|
|
{
|
|
for (const web::json::value& jitem : val.as_array())
|
|
{
|
|
T item;
|
|
ok &= fromJson(jitem, item);
|
|
outVal.insert(item);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
T item;
|
|
ok = fromJson(val, item);
|
|
outVal.insert(item);
|
|
}
|
|
return ok;
|
|
}
|
|
template<typename T>
|
|
bool ModelBase::fromJson( const web::json::value& jval, std::map<utility::string_t, T> &outVal )
|
|
{
|
|
bool ok = true;
|
|
if ( jval.is_object() )
|
|
{
|
|
auto obj = jval.as_object();
|
|
for( auto objItr = obj.begin() ; objItr != obj.end() ; objItr++ )
|
|
{
|
|
T itemVal;
|
|
ok &= fromJson(objItr->second, itemVal);
|
|
outVal.insert(std::pair<utility::string_t, T>(objItr->first, itemVal));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ok = false;
|
|
}
|
|
return ok;
|
|
}
|
|
template <typename T>
|
|
std::shared_ptr<HttpContent> ModelBase::toHttpContent(const utility::string_t& name, const std::shared_ptr<T>& value , const utility::string_t& contentType )
|
|
{
|
|
std::shared_ptr<HttpContent> content = std::make_shared<HttpContent>();
|
|
if (value != nullptr )
|
|
{
|
|
content->setName( name );
|
|
content->setContentDisposition( utility::conversions::to_string_t("form-data") );
|
|
content->setContentType( contentType );
|
|
content->setData( std::make_shared<std::stringstream>( utility::conversions::to_utf8string(value->toJson().serialize()) ) );
|
|
}
|
|
return content;
|
|
}
|
|
|
|
template <typename T>
|
|
std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t& name, const std::vector<T>& value, const utility::string_t& contentType )
|
|
{
|
|
web::json::value json_array = ModelBase::toJson(value);
|
|
std::shared_ptr<HttpContent> content = std::make_shared<HttpContent>();
|
|
content->setName( name );
|
|
content->setContentDisposition( utility::conversions::to_string_t("form-data") );
|
|
content->setContentType( contentType );
|
|
content->setData( std::make_shared<std::stringstream>( utility::conversions::to_utf8string(json_array.serialize()) ) );
|
|
return content;
|
|
}
|
|
template <typename T>
|
|
std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t& name, const std::set<T>& value, const utility::string_t& contentType )
|
|
{
|
|
web::json::value json_array = ModelBase::toJson(value);
|
|
std::shared_ptr<HttpContent> content = std::make_shared<HttpContent>();
|
|
content->setName(name);
|
|
content->setContentDisposition(utility::conversions::to_string_t("form-data"));
|
|
content->setContentType(contentType);
|
|
content->setData( std::make_shared<std::stringstream>( utility::conversions::to_utf8string(json_array.serialize()) ) );
|
|
return content;
|
|
}
|
|
template <typename T>
|
|
std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t& name, const std::map<utility::string_t, T>& value, const utility::string_t& contentType )
|
|
{
|
|
web::json::value jobj = ModelBase::toJson(value);
|
|
std::shared_ptr<HttpContent> content = std::make_shared<HttpContent>();
|
|
content->setName( name );
|
|
content->setContentDisposition( utility::conversions::to_string_t("form-data") );
|
|
content->setContentType( contentType );
|
|
content->setData( std::make_shared<std::stringstream>( utility::conversions::to_utf8string(jobj.serialize()) ) );
|
|
return content;
|
|
}
|
|
template <typename T>
|
|
bool ModelBase::fromHttpContent( std::shared_ptr<HttpContent> val, std::shared_ptr<T>& outVal )
|
|
{
|
|
utility::string_t str;
|
|
if(val == nullptr) return false;
|
|
if( outVal == nullptr )
|
|
{
|
|
outVal = std::make_shared<T>();
|
|
}
|
|
ModelBase::fromHttpContent(val, str);
|
|
return fromString(str, outVal);
|
|
}
|
|
template <typename T>
|
|
bool ModelBase::fromHttpContent( std::shared_ptr<HttpContent> val, std::vector<T> & outVal )
|
|
{
|
|
utility::string_t str;
|
|
if (val == nullptr) return false;
|
|
ModelBase::fromHttpContent(val, str);
|
|
return fromString(str, outVal);
|
|
}
|
|
template <typename T>
|
|
bool ModelBase::fromHttpContent(std::shared_ptr<HttpContent> val, std::set<T>& outVal )
|
|
{
|
|
utility::string_t str;
|
|
if (val == nullptr) return false;
|
|
ModelBase::fromHttpContent(val, str);
|
|
return fromString(str, outVal);
|
|
}
|
|
template <typename T>
|
|
bool ModelBase::fromHttpContent( std::shared_ptr<HttpContent> val, std::map<utility::string_t, T> & outVal )
|
|
{
|
|
utility::string_t str;
|
|
if (val == nullptr) return false;
|
|
ModelBase::fromHttpContent(val, str);
|
|
return fromString(str, outVal);
|
|
}
|
|
{{#modelNamespaceDeclarations}}
|
|
}
|
|
{{/modelNamespaceDeclarations}}
|
|
|
|
#endif /* {{modelHeaderGuardPrefix}}_ModelBase_H_ */
|