mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-29 14:00:49 +03:00
0030169: Application Framework - Document format version management improvement
This commit is contained in:
@@ -132,10 +132,6 @@ int XmlLDrivers::StorageVersion()
|
||||
{
|
||||
return CURRENT_DOCUMENT_VERSION;
|
||||
}
|
||||
void XmlLDrivers::SetStorageVersion(const int version)
|
||||
{
|
||||
CURRENT_DOCUMENT_VERSION = version;
|
||||
}
|
||||
|
||||
// Declare entry point PLUGINFACTORY
|
||||
PLUGIN(XmlLDrivers)
|
||||
|
@@ -43,7 +43,6 @@ public:
|
||||
Standard_EXPORT static Handle(XmlMDF_ADriverTable) AttributeDrivers (const Handle(Message_Messenger)& theMsgDriver);
|
||||
|
||||
Standard_EXPORT static int StorageVersion();
|
||||
Standard_EXPORT static void SetStorageVersion (const int version);
|
||||
};
|
||||
|
||||
#endif // _XmlLDrivers_HeaderFile
|
||||
|
@@ -34,7 +34,6 @@
|
||||
#include <UTL.hxx>
|
||||
#include <XmlLDrivers.hxx>
|
||||
#include <XmlLDrivers_DocumentRetrievalDriver.hxx>
|
||||
#include <XmlMDataStd.hxx>
|
||||
#include <XmlMDF.hxx>
|
||||
#include <XmlMDF_ADriver.hxx>
|
||||
#include <XmlMDF_ADriverTable.hxx>
|
||||
@@ -280,9 +279,6 @@ void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument
|
||||
}
|
||||
|
||||
if( aCurDocVersion < 2) aCurDocVersion = 2;
|
||||
|
||||
PropagateDocumentVersion(aCurDocVersion);
|
||||
|
||||
Standard_Boolean isRef = Standard_False;
|
||||
for (LDOM_Node aNode = anInfoElem.getFirstChild();
|
||||
aNode != NULL; aNode = aNode.getNextSibling()) {
|
||||
@@ -438,6 +434,12 @@ void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument
|
||||
if(!aNSDriver.IsNull())
|
||||
::take_time (0, " +++++ Fin reading Shapes : ", aMsgDriver);
|
||||
|
||||
// 2.1. Keep document format version in RT
|
||||
Handle(Storage_HeaderData) aHeaderData = new Storage_HeaderData();
|
||||
aHeaderData->SetStorageVersion(aCurDocVersion);
|
||||
myRelocTable.Clear();
|
||||
myRelocTable.SetHeaderData(aHeaderData);
|
||||
|
||||
// 5. Read document contents
|
||||
try
|
||||
{
|
||||
@@ -477,7 +479,6 @@ Standard_Boolean XmlLDrivers_DocumentRetrievalDriver::MakeDocument
|
||||
{
|
||||
Standard_Boolean aResult = Standard_False;
|
||||
Handle(TDocStd_Document) TDOC = Handle(TDocStd_Document)::DownCast(theTDoc);
|
||||
myRelocTable.Clear();
|
||||
if (!TDOC.IsNull())
|
||||
{
|
||||
Handle(TDF_Data) aTDF = new TDF_Data();
|
||||
@@ -533,16 +534,6 @@ static void take_time (const Standard_Integer isReset, const char * aHeader,
|
||||
}
|
||||
#endif
|
||||
|
||||
//=======================================================================
|
||||
//function : PropagateDocumentVersion
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void XmlLDrivers_DocumentRetrievalDriver::PropagateDocumentVersion(
|
||||
const Standard_Integer theDocVersion )
|
||||
{
|
||||
XmlMDataStd::SetDocumentVersion(theDocVersion);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadShapeSection
|
||||
//purpose : definition of ReadShapeSection
|
||||
|
@@ -73,12 +73,10 @@ protected:
|
||||
Standard_EXPORT virtual Handle(XmlMDF_ADriver) ReadShapeSection (const XmlObjMgt_Element& thePDoc, const Handle(Message_Messenger)& theMsgDriver);
|
||||
|
||||
Standard_EXPORT virtual void ShapeSetCleaning (const Handle(XmlMDF_ADriver)& theDriver);
|
||||
|
||||
Standard_EXPORT virtual void PropagateDocumentVersion (const Standard_Integer theDocVersion);
|
||||
|
||||
Handle(XmlMDF_ADriverTable) myDrivers;
|
||||
XmlObjMgt_RRelocationTable myRelocTable;
|
||||
TCollection_ExtendedString myFileName;
|
||||
XmlObjMgt_RRelocationTable myRelocTable;
|
||||
TCollection_ExtendedString myFileName;
|
||||
|
||||
|
||||
private:
|
||||
|
@@ -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());
|
||||
|
Reference in New Issue
Block a user