Prevent generating pull method for non-default constructable classes
This commit is contained in:
parent
0bb06d5190
commit
bae7cf3414
|
@ -34,9 +34,11 @@ The following table shows the mapping of supported C++ types to supported JSON t
|
||||||
* For the same reason `const char *` strings are only supported for serialization.
|
* For the same reason `const char *` strings are only supported for serialization.
|
||||||
* Enums are (de)serialized as their underlying integer value. When deserializing, it is currently *not* checked
|
* Enums are (de)serialized as their underlying integer value. When deserializing, it is currently *not* checked
|
||||||
whether the present integer value is a valid enumeration item.
|
whether the present integer value is a valid enumeration item.
|
||||||
* For deserialization, iteratables must provide an `emplace_back` method. So deserialization of eg. `std::forward_list`
|
|
||||||
is currently not supported.
|
|
||||||
* The JSON type for smart pointer depends on the type the pointer refers to. It can also be `null`.
|
* The JSON type for smart pointer depends on the type the pointer refers to. It can also be `null`.
|
||||||
|
* For deserialization
|
||||||
|
* iteratables must provide an `emplace_back` method. So deserialization of eg. `std::forward_list`
|
||||||
|
is currently not supported.
|
||||||
|
* custom types must provide a default constructor.
|
||||||
* For custom (de)serialization, see the section below.
|
* For custom (de)serialization, see the section below.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
|
@ -205,6 +205,11 @@ void JsonSerializationCodeGenerator::generate(ostream &os) const
|
||||||
}
|
}
|
||||||
os << "}\n";
|
os << "}\n";
|
||||||
|
|
||||||
|
// skip printing the pull method for classes without default constructor because deserializing those is currently not supported
|
||||||
|
if (!relevantClass.record->hasDefaultConstructor()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// print pull method
|
// print pull method
|
||||||
os << "template <> " << visibility << " void pull<::" << relevantClass.qualifiedName << ">(::" << relevantClass.qualifiedName
|
os << "template <> " << visibility << " void pull<::" << relevantClass.qualifiedName << ">(::" << relevantClass.qualifiedName
|
||||||
<< " &reflectable, const ::RAPIDJSON_NAMESPACE::GenericValue<::RAPIDJSON_NAMESPACE::UTF8<char>>::ConstObject &value, "
|
<< " &reflectable, const ::RAPIDJSON_NAMESPACE::GenericValue<::RAPIDJSON_NAMESPACE::UTF8<char>>::ConstObject &value, "
|
||||||
|
|
Loading…
Reference in New Issue