I have a situation where I need to serialize several parts of a document-derived class. Because the standard doc loading / saving mechanism is not quite what I need, I have to construct the CArchive manually. All the serialization is working fine in itself, but the one thing I can't seem to get to work now I need it is the schema business.
My doc-derived class uses IMPLEMENT_SERIAL() with the current schema number correctly. I create the archive correctly and then start serializing out (when saving, this is)... but for some reason it never saves the schema in the binary file. I tried SetObjectSchema() immediately after constructing the CArchive, which certainly sets the internal schema value... but that never gets written to file.
I looked at the code for CDocument where it calls our overriden Serialize() to see how it did it - from that I see it sets the archive's m_pDocument and another member. So I did this also... STILL doesn't save the schema in the file.
Since CDocument::Serialize() does not do anything, calling the base class has no effect.
Any clues as to what I'm missing? Otherwise I'll have to do the schema bit myself. But I'd rather use the built-in stuff as much as possible.
My doc-derived class uses IMPLEMENT_SERIAL() with the current schema number correctly. I create the archive correctly and then start serializing out (when saving, this is)... but for some reason it never saves the schema in the binary file. I tried SetObjectSchema() immediately after constructing the CArchive, which certainly sets the internal schema value... but that never gets written to file.
I looked at the code for CDocument where it calls our overriden Serialize() to see how it did it - from that I see it sets the archive's m_pDocument and another member. So I did this also... STILL doesn't save the schema in the file.
Since CDocument::Serialize() does not do anything, calling the base class has no effect.
Any clues as to what I'm missing? Otherwise I'll have to do the schema bit myself. But I'd rather use the built-in stuff as much as possible.