forked from loafle/openapi-generator-original
[C++][Pistache] Add comparison operators (#4619)
* [C++][Pistache] Add comparison operators * [C++][Pistache] Update Petstore sample
This commit is contained in:
parent
fac83ce760
commit
e2df6c32e0
@ -24,6 +24,9 @@ struct {{classname}}
|
||||
{{^required}}Pistache::Optional<{{/required}}{{{dataType}}}{{^required}}>{{/required}} {{baseName}};
|
||||
{{/vars}}
|
||||
|
||||
bool operator==(const {{classname}}& other) const;
|
||||
bool operator!=(const {{classname}}& other) const;
|
||||
|
||||
nlohmann::json to_json() const;
|
||||
static {{classname}} from_json(const nlohmann::json& j);
|
||||
};
|
||||
|
@ -21,6 +21,16 @@ nlohmann::json {{classname}}::to_json() const
|
||||
return o;
|
||||
}
|
||||
|
||||
bool {{classname}}::operator==(const {{classname}}& other) const
|
||||
{
|
||||
return {{#vars}}{{baseName}} == other.{{baseName}}{{#hasMore}} && {{/hasMore}}{{/vars}};
|
||||
}
|
||||
|
||||
bool {{classname}}::operator!=(const {{classname}}& other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
void to_json(nlohmann::json& j, const {{classname}}& o)
|
||||
{
|
||||
{{#vars}}
|
||||
|
@ -1 +1 @@
|
||||
4.2.1-SNAPSHOT
|
||||
4.2.2-SNAPSHOT
|
Loading…
x
Reference in New Issue
Block a user