Tomers
asked on
Serialization with version
I added a data member to a class that had a Serialize() function. The Serialize() function didn't support versioning. Now I want to serialize the new data member but to be compatible with previous serializaions.
My class has DECLARE_SERIAL(...) and IMPLEMENT_SERIAL(...,...,V ERSIONABLE _SCHEMA|1) but when I use the function CArchive::GetObjectSchema( ) I always get -1.
I can't distinguish between old versions and new ones.
The class I serialize is an item in a CMap object that I serialize in another class.
How can I distinguish the different versions?
Thanks, Tomer
My class has DECLARE_SERIAL(...) and IMPLEMENT_SERIAL(...,...,V
I can't distinguish between old versions and new ones.
The class I serialize is an item in a CMap object that I serialize in another class.
How can I distinguish the different versions?
Thanks, Tomer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
is it didn't work, maybe because it was items in a CMap.
Anyway I solved it by trying to read it once with 3 arguments and if I encounter an
exception, I close the archive and open it again trying to read 2 arguments.