1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-08 14:17:06 +03:00

0030169: Application Framework - Document format version management improvement

This commit is contained in:
szy
2018-10-09 17:30:10 +03:00
committed by apn
parent 90fd614536
commit b34d86cb28
58 changed files with 315 additions and 305 deletions

View File

@@ -264,7 +264,18 @@ Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument (const Ha
// anInfoElem.setAttribute("appv", anAppVersion.ToCString());
// Document version
anInfoElem.setAttribute("DocVersion", XmlLDrivers::StorageVersion());
Standard_Integer aFormatVersion(XmlLDrivers::StorageVersion());// the last version of the format
if (theDocument->StorageFormatVersion() > 0)
{
if (XmlLDrivers::StorageVersion() < theDocument->StorageFormatVersion())
{
TCollection_ExtendedString anErrorString("Unacceptable storage format version, the last verson is used");
aMessageDriver->Send(anErrorString.ToExtString(), Message_Warning);
}
else
aFormatVersion = theDocument->StorageFormatVersion();
}
anInfoElem.setAttribute("DocVersion", aFormatVersion);
// User info with Copyright
TColStd_SequenceOfAsciiString aUserInfo;
@@ -282,6 +293,12 @@ Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument (const Ha
for(i = 1; i <= aRefs.Length(); i++)
aUserInfo.Append(aRefs.Value(i));
// Keep fomat version in Reloc. table
Handle(Storage_HeaderData) aHeaderData = theData->HeaderData();
aHeaderData->SetStorageVersion(aFormatVersion);
myRelocTable.Clear();
myRelocTable.SetHeaderData(aHeaderData);
for (i = 1; i <= aUserInfo.Length(); i++)
{
XmlObjMgt_Element aUIItem = aDOMDoc.createElement ("iitem");
@@ -351,7 +368,6 @@ Standard_Integer XmlLDrivers_DocumentStorageDriver::MakeDocument
{
TCollection_ExtendedString aMessage;
Handle(TDocStd_Document) TDOC = Handle(TDocStd_Document)::DownCast(theTDoc);
myRelocTable.Clear();
if (!TDOC.IsNull())
{
// myRelocTable.SetDocument (theElement.getOwnerDocument());