Allows serialisation functions to be attached to a specific type without having to modify the declaration of that type. More...
#include <juce_Serialisation.h>
Allows serialisation functions to be attached to a specific type without having to modify the declaration of that type.
A specialisation of SerialisationTraits must include:
If the marshallingVersion converts to a null optional, then all versioning information will be ignored when marshalling the type. Otherwise, if the value converts to a non-null optional, this versioning information will be included when serialising the type.
Inside serialise() and load() you may call archive.getVersion() to find the detected version of the object being deserialised. archive.getVersion() will return an std::optional<int>, where 'nullopt' indicates that no versioning information was detected.
Marshalling functions can also be specified directly inside the type to be marshalled. This approach may be preferable as it is more concise. Internal marshalling functions are written in exactly the same way as external ones; i.e. the type must include a marshallingVersion, and either a single serialise function, or a load/save pair of functions, as specified above.