1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0029217: Application Framework - nonsense API method XmlLDrivers::SetStorageVersion()

1. Unification of usage of a storage version of an OCAF document by XML and binary file formats.
2. A new format version enumeration in TDocStd package: TDocStd_FormatVersion.
3. Removal of unnecessary methods for storage version like XmlLDrivers::StorageVersion() and BinLDrivers::StorageVersion().
4. Support of old documents (storage version <= 9) in binary file format (came from ESA).

New files:
- TDocStd_FormatVersion.hxx: a new storage format version enumeration for an OCAF document.

Modified files:
- CDM_Document.hxx and cxx: removal of storage format version property (moved to TDocStd_Document).
- TDocStd_Document.hxx and cxx: a storage format version property (moved from CDM_Document).
- BinLDrivers_DocumentSection.hxx and cxx: support of old document storage version in binary file format.
- BinDrivers_DocumentStorageDriver.hxx and cxx,
- BinLDrivers_DocumentStorageDriver.hxx and cxx,
- BinLDrivers_DocumentRetrievalDriver.cxx,
- XmlLDrivers_DocumentRetrievalDriver.cxx,
- XmlLDrivers_DocumentStorageDriver.cxx: usage of document storage version from TDocStd_Document in storage and retrieval drivers.
- DDocStd_ApplicationCommands.cxx: draw-command name StorageVersion is replaced by StorageFormatVersion (to be the same everywhere). A corresponding script is corrected too.

New test:
- bugs caf bug29217: a test case for old document storage version in binary file format. It checks several attributes saved by the version TDocStd_FormatVersion_VERSION_7 (old) and the latest version.

Modified test:
- caf presentation M1: the test used a file in the current folder, not in {imagedir} like all other tests.
- bugs caf bug28691

Documentation:
- dox/upgrade/upgrade.md

// All remarks are fixed.
This commit is contained in:
vro
2020-12-02 09:38:28 +03:00
committed by bugmaster
parent 4268c64672
commit 716cf4d96b
26 changed files with 343 additions and 141 deletions

View File

@@ -33,8 +33,6 @@
static Standard_GUID XmlLStorageDriver ("13a56820-8269-11d5-aab2-0050044b1af1");
static Standard_GUID XmlLRetrievalDriver("13a56822-8269-11d5-aab2-0050044b1af1");
static int CURRENT_DOCUMENT_VERSION(9);
//=======================================================================
//function : Factory
//purpose : PLUGIN FACTORY
@@ -123,15 +121,5 @@ Handle(XmlMDF_ADriverTable) XmlLDrivers::AttributeDrivers
return aTable;
}
//=======================================================================
//function : StorageVersion
//purpose : Document storage version
//=======================================================================
int XmlLDrivers::StorageVersion()
{
return CURRENT_DOCUMENT_VERSION;
}
// Declare entry point PLUGINFACTORY
PLUGIN(XmlLDrivers)

View File

@@ -41,8 +41,6 @@ public:
Standard_EXPORT static void DefineFormat (const Handle(TDocStd_Application)& theApp);
Standard_EXPORT static Handle(XmlMDF_ADriverTable) AttributeDrivers (const Handle(Message_Messenger)& theMsgDriver);
Standard_EXPORT static int StorageVersion();
};
#endif // _XmlLDrivers_HeaderFile

View File

@@ -270,12 +270,12 @@ void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument
// oan: OCC22305 - check a document verison and if it's greater than
// current version of storage driver set an error status and return
if( aCurDocVersion > XmlLDrivers::StorageVersion() )
if( aCurDocVersion > TDocStd_Document::CurrentStorageFormatVersion() )
{
TCollection_ExtendedString aMsg =
TCollection_ExtendedString ("error: wrong file version: ") +
aDocVerStr + " while current is " +
XmlLDrivers::StorageVersion();
TDocStd_Document::CurrentStorageFormatVersion();
myReaderStatus = PCDM_RS_NoVersion;
if(!aMsgDriver.IsNull())
aMsgDriver->Send(aMsg.ToExtString(), Message_Fail);

View File

@@ -269,18 +269,16 @@ Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument
// anInfoElem.setAttribute("appv", anAppVersion.ToCString());
// Document version
Standard_Integer aFormatVersion(XmlLDrivers::StorageVersion());// the last version of the format
if (theDocument->StorageFormatVersion() > 0)
Handle(TDocStd_Document) aDoc = Handle(TDocStd_Document)::DownCast (theDocument);
Standard_Integer aFormatVersion = TDocStd_Document::CurrentStorageFormatVersion(); // the last version of the format
if (TDocStd_Document::CurrentStorageFormatVersion() < aDoc->StorageFormatVersion())
{
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();
TCollection_ExtendedString anErrorString("Unacceptable storage format version, the last verson is used");
aMessageDriver->Send (anErrorString.ToExtString(), Message_Warning);
}
anInfoElem.setAttribute("DocVersion", aFormatVersion);
else
aFormatVersion = aDoc->StorageFormatVersion();
anInfoElem.setAttribute ("DocVersion", aFormatVersion);
// User info with Copyright
TColStd_SequenceOfAsciiString aUserInfo;