#include "Serializer.h"
//////////////////////////////////////////////////////////////////////////
size_t JsonStructSizeLock::TotalSize = 0;
//////////////////////////////////////////////////////////////////////////
bool SerializedBase::Serialize(JsonSerializerBase& serializer)
{
bool success = false;
if (serializer.BeginRootObject())
{
success = SerializeInternal(serializer);
// #TEST OM: the return logic here is a little convoluted, but it should cover all
// our cases correctly
bool migrated = serializer.EndRootObject();
if (serializer.IsWriter())
{
// We get no migration here, test for it anyway to be somehow future-proof
return success && migrated;
}
else
{
// ONLY the migration result matters here
// (if a field is not serialized - i.e. SerializeInternal returns false - migration will
// have to deal with it, else false will be returned from EndRootObject() as well
return migrated;
}
}
return success;
}