mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0031946: Modeling Data - replace version numbers with enumerations in TopTools and BinTools
Added enumerations BinTools_FormatVersion & TopTools_FormatVersion for more clear version tracking in the code. Added new BinTools::Write() & BRepTools::Write() overloaded functions with version & isWithTriangles parameters. Added new "readbrep"/"writebrep" DRAW commands handling reading and writing of both Binary and ASCII .brep formats and providing arguments to setup writing of triangulation data and of format version. "binrestore" is made an alias to new command "readbrep". "binsave" now is an alias to new "writebrep" saving into binary format by default ("writebrep" writes into ASCII format by default).
This commit is contained in:
@@ -252,22 +252,31 @@ void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument
|
||||
theApplication -> MessageDriver();
|
||||
// 1. Read info // to be done
|
||||
TCollection_AsciiString anAbsoluteDirectory = GetDirFromFile(myFileName);
|
||||
Standard_Integer aCurDocVersion = 0;
|
||||
Standard_Integer aCurDocVersion = TDocStd_FormatVersion_VERSION_2; // minimum supported version
|
||||
TCollection_ExtendedString anInfo;
|
||||
const XmlObjMgt_Element anInfoElem =
|
||||
theElement.GetChildByTagName ("info");
|
||||
if (anInfoElem != NULL) {
|
||||
XmlObjMgt_DOMString aDocVerStr = anInfoElem.getAttribute("DocVersion");
|
||||
if(aDocVerStr == NULL)
|
||||
aCurDocVersion = 2;
|
||||
else if (!aDocVerStr.GetInteger(aCurDocVersion)) {
|
||||
TCollection_ExtendedString aMsg =
|
||||
TCollection_ExtendedString ("Cannot retrieve the current Document version"
|
||||
" attribute as \"") + aDocVerStr + "\"";
|
||||
if(!aMsgDriver.IsNull())
|
||||
aMsgDriver->Send(aMsg.ToExtString(), Message_Fail);
|
||||
if (aDocVerStr != NULL)
|
||||
{
|
||||
Standard_Integer anIntegerVersion = 0;
|
||||
if (aDocVerStr.GetInteger (anIntegerVersion))
|
||||
{
|
||||
aCurDocVersion = anIntegerVersion;
|
||||
}
|
||||
else
|
||||
{
|
||||
TCollection_ExtendedString aMsg =
|
||||
TCollection_ExtendedString ("Cannot retrieve the current Document version"
|
||||
" attribute as \"") + aDocVerStr + "\"";
|
||||
if (!aMsgDriver.IsNull())
|
||||
{
|
||||
aMsgDriver->Send(aMsg.ToExtString(), Message_Fail);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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 > TDocStd_Document::CurrentStorageFormatVersion() )
|
||||
@@ -282,7 +291,6 @@ void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument
|
||||
return;
|
||||
}
|
||||
|
||||
if( aCurDocVersion < 2) aCurDocVersion = 2;
|
||||
Standard_Boolean isRef = Standard_False;
|
||||
for (LDOM_Node aNode = anInfoElem.getFirstChild();
|
||||
aNode != NULL; aNode = aNode.getNextSibling()) {
|
||||
|
@@ -274,11 +274,14 @@ Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument
|
||||
if (TDocStd_Document::CurrentStorageFormatVersion() < aDoc->StorageFormatVersion())
|
||||
{
|
||||
TCollection_ExtendedString anErrorString("Unacceptable storage format version, the last verson is used");
|
||||
aMessageDriver->Send (anErrorString.ToExtString(), Message_Warning);
|
||||
aMessageDriver->Send (anErrorString.ToExtString(), Message_Warning);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
aFormatVersion = aDoc->StorageFormatVersion();
|
||||
anInfoElem.setAttribute ("DocVersion", aFormatVersion);
|
||||
}
|
||||
const TCollection_AsciiString aStringFormatVersion (aFormatVersion);
|
||||
anInfoElem.setAttribute ("DocVersion", aStringFormatVersion.ToCString());
|
||||
|
||||
// User info with Copyright
|
||||
TColStd_SequenceOfAsciiString aUserInfo;
|
||||
|
Reference in New Issue
Block a user