Pass version down to base classes in binary deserializer

So the behavior is consistent with readng members and with serialization.

It should be fine because if the base class is versioned it won't make a
difference but if it is versioned the version from the derived class can be
utilized.
This commit is contained in:
Martchus 2022-05-15 21:00:02 +02:00
parent 9c3bf01c8f
commit 60d761f7ed
2 changed files with 2 additions and 2 deletions

View File

@ -319,7 +319,7 @@ void BinarySerializationCodeGenerator::generate(std::ostream &os) const
}
os << " // read base classes\n";
for (const RelevantClass *baseClass : relevantBases) {
os << " deserializer.read(static_cast<::" << baseClass->qualifiedName << " &>(customObject));\n";
os << " deserializer.read(static_cast<::" << baseClass->qualifiedName << " &>(customObject), version);\n";
}
os << " // read members\n";
for (clang::Decl *const decl : relevantClass.record->decls()) {

View File

@ -57,7 +57,7 @@ class BinarySerializer;
/// \brief Reads \a customType via \a deserializer.
/// \remarks
/// - If \tp Type is versioned, the version is determined from the data. Otherwise \a version is assumed.
/// - The specified \a version shall be passed to nested invocations.
/// - The determined or specified \a version shall be passed to nested invocations.
/// \returns Returns the determined/assumed version.
template <typename Type, Traits::EnableIf<IsCustomType<Type>> * = nullptr>
BinaryVersion readCustomType(BinaryDeserializer &deserializer, Type &customType, BinaryVersion version = 0);