*SelectBasics_PickResult* structure has been extended, so that it now defines 3D point on detected entity in addition to Depth value along picking ray.
*SelectMgr_SelectingVolumeManager::Overlap()* methods have been corrected to fill in *SelectBasics_PickResult* structure (depth and 3D point) instead of only depth value, so that custom *Select3D_SensitiveEntity* implementation should be updated accordingly (including *Select3D_SensitiveSet* subclasses).
+
+@subsection upgrade_740_ocafpersistence Document format version management improvement.
+
+Previously Document format version after restoring by DocumentRetrievalDriver was propagated using static methods of corresponding units (like MDataStd or MNaming) to static variables of these units and after that became accessible to Drivers of these units.
+Now Document format version is available to drivers via RelocationTable. The Relocation table now keeps HeaderData of the document and a format version can be extracted in next way: theRelocTable.GetHeaderData()->StorageVersion().
+Obsolete methods: *static void SetDocumentVersion (const Standard_Integer DocVersion)* and *static Standard_Integer DocumentVersion()* of *BinMDataStd*, *BinMNaming*, *XmlMDataStd* and *XmlMNaming* are removed.
BinLDrivers_DocumentRetrievalDriver::Clear();
}
-//=======================================================================
-//function : PropagateDocumentVersion
-//purpose :
-//=======================================================================
-void BinDrivers_DocumentRetrievalDriver::PropagateDocumentVersion(
- const Standard_Integer theDocVersion )
-{
- BinMDataStd::SetDocumentVersion(theDocVersion);
- BinMNaming::SetDocumentVersion(theDocVersion);
-}
//! Clears the NamedShape driver
Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
-
- Standard_EXPORT virtual void PropagateDocumentVersion (const Standard_Integer theVersion) Standard_OVERRIDE;
-
-
DEFINE_STANDARD_RTTIEXT(BinDrivers_DocumentRetrievalDriver,BinLDrivers_DocumentRetrievalDriver)
myMsgDriver->Send (aTypeNames(i), Message_Warning);
}
- // propagate the opened document version to data drivers
- PropagateDocumentVersion(aFileVer);
-
// 2. Read document contents
-
// 2a. Retrieve data from the stream:
myRelocTable.Clear();
myRelocTable.SetHeaderData(aHeaderData);
if (aFileVer >= 3) {
BinLDrivers_DocumentSection aSection;
do {
- BinLDrivers_DocumentSection::ReadTOC (aSection, theIStream);
+ BinLDrivers_DocumentSection::ReadTOC (aSection, theIStream, aFileVer);
mySections.Append(aSection);
} while(!aSection.Name().IsEqual((Standard_CString)SHAPESECTION_POS) && !theIStream.eof());
const TDF_Label& theLabel)
{
Standard_Integer nbRead = 0;
- static TCollection_ExtendedString aMethStr
+ TCollection_ExtendedString aMethStr
("BinLDrivers_DocumentRetrievalDriver: ");
// Read attributes:
myMapUnsupported.Clear();
}
-//=======================================================================
-//function : PropagateDocumentVersion
-//purpose :
-//=======================================================================
-void BinLDrivers_DocumentRetrievalDriver::PropagateDocumentVersion(const Standard_Integer theDocVersion )
-{
- BinMDataStd::SetDocumentVersion(theDocVersion);
-}
-
//=======================================================================
//function : CheckDocumentVersion
//purpose :
//! clears the reading-cash data in drivers if any.
Standard_EXPORT virtual void Clear();
-
- //! provides the version of document to all drivers
- Standard_EXPORT virtual void PropagateDocumentVersion (const Standard_Integer theVersion);
//! Check a file version(in which file was written) with a current version.
//! Redefining this method is a chance for application to read files
void BinLDrivers_DocumentSection::ReadTOC
(BinLDrivers_DocumentSection& theSection,
- Standard_IStream& theStream)
+ Standard_IStream& theStream,
+ const Standard_Integer theDocFormatVersion)
{
char aBuf[512];
Standard_Integer aNameBufferSize;
theSection.myName = (Standard_CString)&aBuf[0];
uint64_t aValue[3];
- if (BinMDataStd::DocumentVersion() <= 9)
+ if (theDocFormatVersion <= 9)
{
// Old documents stored file position as 4-bytes values.
Standard_Integer aValInt[3];
//! Fill a DocumentSection instance from the data that are read
//! from TOC.
- Standard_EXPORT static void ReadTOC (BinLDrivers_DocumentSection& theSection, Standard_IStream& theIS);
+ Standard_EXPORT static void ReadTOC (BinLDrivers_DocumentSection& theSection, Standard_IStream& theIS,
+ const Standard_Integer theDocFormatVersion);
(const Handle(Standard_Type)& theType)
{
#ifdef OCCT_DEBUG
- static TCollection_ExtendedString aMsg
+ TCollection_ExtendedString aMsg
("BinDrivers_DocumentStorageDriver: warning: attribute driver for type ");
#endif
if (!myMapUnsupported.Contains(theType)) {
#include <BinMDF_ADriverTable.hxx>
#include <Message_Messenger.hxx>
-static Standard_Integer myDocumentVersion = -1;
//=======================================================================
//function : AddDrivers
//purpose :
theDriverTable->AddDriver (new BinMDataStd_AsciiStringDriver (theMsgDriver) );
theDriverTable->AddDriver (new BinMDataStd_IntPackedMapDriver (theMsgDriver) );
}
-
-//=======================================================================
-//function : SetDocumentVersion
-//purpose : Sets current document version
-//=======================================================================
-void BinMDataStd::SetDocumentVersion(const Standard_Integer theVersion)
-{
- myDocumentVersion = theVersion;
-}
-//=======================================================================
-//function : DocumentVersion
-//purpose : Retrieved document version
-//=======================================================================
-Standard_Integer BinMDataStd::DocumentVersion()
-{
- return myDocumentVersion;
-}
class BinMDF_ADriverTable;
class Message_Messenger;
-class BinMDataStd_NameDriver;
-class BinMDataStd_IntegerDriver;
-class BinMDataStd_RealDriver;
-class BinMDataStd_IntegerArrayDriver;
-class BinMDataStd_RealArrayDriver;
-class BinMDataStd_UAttributeDriver;
-class BinMDataStd_DirectoryDriver;
-class BinMDataStd_CommentDriver;
-class BinMDataStd_VariableDriver;
-class BinMDataStd_ExpressionDriver;
-class BinMDataStd_RelationDriver;
-class BinMDataStd_NoteBookDriver;
-class BinMDataStd_TreeNodeDriver;
-class BinMDataStd_ExtStringArrayDriver;
-class BinMDataStd_TickDriver;
-class BinMDataStd_AsciiStringDriver;
-class BinMDataStd_IntPackedMapDriver;
-class BinMDataStd_IntegerListDriver;
-class BinMDataStd_RealListDriver;
-class BinMDataStd_ExtStringListDriver;
-class BinMDataStd_BooleanListDriver;
-class BinMDataStd_ReferenceListDriver;
-class BinMDataStd_BooleanArrayDriver;
-class BinMDataStd_ReferenceArrayDriver;
-class BinMDataStd_ByteArrayDriver;
-class BinMDataStd_NamedDataDriver;
//! Storage and Retrieval drivers for modelling attributes.
class BinMDataStd
//! Adds the attribute drivers to <theDriverTable>.
Standard_EXPORT static void AddDrivers (const Handle(BinMDF_ADriverTable)& theDriverTable, const Handle(Message_Messenger)& aMsgDrv);
-
- Standard_EXPORT static void SetDocumentVersion (const Standard_Integer DocVersion);
-
- Standard_EXPORT static Standard_Integer DocumentVersion();
template<class T>
-static void SetAttributeID(const BinObjMgt_Persistent& theSource, const Handle(T)& anAtt)
+static void SetAttributeID(const BinObjMgt_Persistent& theSource, const Handle(T)& anAtt, const Standard_Integer aDocFormatVersion)
{
Standard_Boolean ok = Standard_True;
- if(BinMDataStd::DocumentVersion() > 9) { // process user defined guid
+ if(aDocFormatVersion > 9) { // process user defined guid
const Standard_Integer& aPos = theSource.Position();
Standard_GUID aGuid;
ok = theSource >> aGuid;
Standard_Boolean BinMDataStd_AsciiStringDriver::Paste
(const BinObjMgt_Persistent& Source,
const Handle(TDF_Attribute)& Target,
- BinObjMgt_RRelocationTable& /*RelocTable*/) const
+ BinObjMgt_RRelocationTable& RelocTable) const
{
Handle(TDataStd_AsciiString) aStrAtt = Handle(TDataStd_AsciiString)::DownCast(Target);
TCollection_AsciiString aString;
Standard_Boolean ok = Source >> aString;
if (ok)
aStrAtt->Set( aString );
- if(BinMDataStd::DocumentVersion() > 8) { // process user defined guid
+ if(RelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 8) { // process user defined guid
const Standard_Integer& aPos = Source.Position();
Standard_GUID aGuid;
ok = Source >> aGuid;
//=======================================================================
Standard_Boolean BinMDataStd_BooleanArrayDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
- BinObjMgt_RRelocationTable& ) const
+ BinObjMgt_RRelocationTable& theRelocTable) const
{
Standard_Integer aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
bytes->SetValue(i, aTargetArray.Value(i));
}
anAtt->SetInternalArray(bytes);
- BinMDataStd::SetAttributeID(theSource, anAtt);
+ BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
return Standard_True;
}
//=======================================================================
Standard_Boolean BinMDataStd_BooleanListDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
- BinObjMgt_RRelocationTable& ) const
+ BinObjMgt_RRelocationTable& theRelocTable) const
{
Standard_Integer aIndex, aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
}
}
- BinMDataStd::SetAttributeID(theSource, anAtt);
+ BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
return Standard_True;
}
// process user defined guid
if(anAtt->ID() != TDataStd_BooleanList::GetID())
theTarget << anAtt->ID();
-}
\ No newline at end of file
+}
//=======================================================================
Standard_Boolean BinMDataStd_ByteArrayDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
- BinObjMgt_RRelocationTable& ) const
+ BinObjMgt_RRelocationTable& theRelocTable) const
{
Standard_Integer aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
anAtt->ChangeArray(bytes);
Standard_Boolean aDelta(Standard_False);
- if(BinMDataStd::DocumentVersion() > 2) {
+ if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
Standard_Byte aDeltaValue;
if (! (theSource >> aDeltaValue))
return Standard_False;
}
anAtt->SetDelta(aDelta);
- BinMDataStd::SetAttributeID(theSource, anAtt);
+ BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
return Standard_True;
}
Standard_Boolean BinMDataStd_ExtStringArrayDriver::Paste
(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
- BinObjMgt_RRelocationTable& ) const
+ BinObjMgt_RRelocationTable& theRelocTable) const
{
Standard_Integer aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
if(ok) {
Standard_Boolean aDelta(Standard_False);
- if(BinMDataStd::DocumentVersion() > 2) {
+ if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
Standard_Byte aDeltaValue;
if (! (theSource >> aDeltaValue)) {
return Standard_False;
anAtt->SetDelta(aDelta);
}
- BinMDataStd::SetAttributeID(theSource, anAtt);
+ BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
return ok;
}
Standard_Boolean BinMDataStd_ExtStringListDriver::Paste
(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
- BinObjMgt_RRelocationTable& ) const
+ BinObjMgt_RRelocationTable& theRelocTable) const
{
Standard_Integer aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
}
}
- BinMDataStd::SetAttributeID(theSource, anAtt);
+ BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
return Standard_True;
}
Standard_Boolean BinMDataStd_IntPackedMapDriver::Paste
(const BinObjMgt_Persistent& Source,
const Handle(TDF_Attribute)& Target,
- BinObjMgt_RRelocationTable& /*RelocTable*/) const
+ BinObjMgt_RRelocationTable& RelocTable) const
{
Handle(TDataStd_IntPackedMap) aTagAtt = Handle(TDataStd_IntPackedMap)::DownCast(Target);
if(aTagAtt.IsNull()) {
}
Standard_Boolean aDelta(Standard_False);
- if(BinMDataStd::DocumentVersion() > 2) {
+ if(RelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
Standard_Byte aDeltaValue;
if (! (Source >> aDeltaValue))
return Standard_False;
Standard_Boolean BinMDataStd_IntegerArrayDriver::Paste
(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
- BinObjMgt_RRelocationTable& ) const
+ BinObjMgt_RRelocationTable& theRelocTable) const
{
Standard_Integer aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
if(!theSource.GetIntArray (&aTargetArray(aFirstInd), aLength))
return Standard_False;
Standard_Boolean aDelta(Standard_False);
- if(BinMDataStd::DocumentVersion() > 2) {
+ if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
Standard_Byte aDeltaValue;
if (! (theSource >> aDeltaValue))
return Standard_False;
aDelta = (aDeltaValue != 0);
}
#ifdef OCCT_DEBUG
- else if(BinMDataStd::DocumentVersion() == -1)
- cout << "Current DocVersion field is not initialized. " <<endl;
+ //cout << "Current Document Format Version = " << theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() <<endl;
#endif
anAtt->SetDelta(aDelta);
- BinMDataStd::SetAttributeID(theSource, anAtt);
+ BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
return Standard_True;
}
Standard_Boolean BinMDataStd_IntegerDriver::Paste
(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
- BinObjMgt_RRelocationTable& ) const
+ BinObjMgt_RRelocationTable& theRT) const
{
Handle(TDataStd_Integer) anAtt = Handle(TDataStd_Integer)::DownCast(theTarget);
Standard_Integer aValue;
Standard_Boolean ok = theSource >> aValue;
if (ok)
anAtt->Set(aValue);
- if(BinMDataStd::DocumentVersion() > 8) { // process user defined guid
+ if(theRT.GetHeaderData()->StorageVersion().IntegerValue() > 8) { // process user defined guid
const Standard_Integer& aPos = theSource.Position();
Standard_GUID aGuid;
ok = theSource >> aGuid;
//=======================================================================
Standard_Boolean BinMDataStd_IntegerListDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
- BinObjMgt_RRelocationTable& ) const
+ BinObjMgt_RRelocationTable& theRelocTable) const
{
Standard_Integer aIndex, aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
}
}
- BinMDataStd::SetAttributeID(theSource, anAtt);
+ BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
return Standard_True;
}
Standard_Boolean BinMDataStd_NameDriver::Paste
(const BinObjMgt_Persistent& Source,
const Handle(TDF_Attribute)& Target,
- BinObjMgt_RRelocationTable& /*RelocTable*/) const
+ BinObjMgt_RRelocationTable& RelocTable) const
{
Handle(TDataStd_Name) aName = Handle(TDataStd_Name)::DownCast(Target);
TCollection_ExtendedString aStr;
Standard_Boolean ok = Source >> aStr;
if (ok)
aName->Set( aStr );
- if(BinMDataStd::DocumentVersion() > 8) { // process user defined guid
+ if(RelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 8) { // process user defined guid
const Standard_Integer& aPos = Source.Position();
Standard_GUID aGuid;
ok = Source >> aGuid;
Standard_Boolean BinMDataStd_RealArrayDriver::Paste
(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
- BinObjMgt_RRelocationTable& ) const
+ BinObjMgt_RRelocationTable& theRelocTable) const
{
Standard_Integer aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
return Standard_False;
Standard_Boolean aDelta(Standard_False);
- if(BinMDataStd::DocumentVersion() > 2) {
+ if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
Standard_Byte aDeltaValue;
if (! (theSource >> aDeltaValue))
return Standard_False;
}
anAtt->SetDelta(aDelta);
- BinMDataStd::SetAttributeID(theSource, anAtt);
+ BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
return Standard_True;
}
Standard_Boolean BinMDataStd_RealDriver::Paste
(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
- BinObjMgt_RRelocationTable& ) const
+ BinObjMgt_RRelocationTable& theRelocTable) const
{
Handle(TDataStd_Real) anAtt= Handle(TDataStd_Real)::DownCast(theTarget);
Standard_Real aValue;
Standard_Boolean ok = theSource >> aValue;
if (ok)
anAtt->Set(aValue);
- if(BinMDataStd::DocumentVersion() > 8) { // process user defined guid
+ if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 8) { // process user defined guid
const Standard_Integer& aPos = theSource.Position();
Standard_GUID aGuid;
ok = theSource >> aGuid;
//=======================================================================
Standard_Boolean BinMDataStd_RealListDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
- BinObjMgt_RRelocationTable& ) const
+ BinObjMgt_RRelocationTable& theRelocTable) const
{
Standard_Integer aIndex, aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
}
}
- BinMDataStd::SetAttributeID(theSource, anAtt);
+ BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
return Standard_True;
}
//=======================================================================
Standard_Boolean BinMDataStd_ReferenceArrayDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
- BinObjMgt_RRelocationTable& ) const
+ BinObjMgt_RRelocationTable& theRelocTable) const
{
Standard_Integer aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
anAtt->SetValue(i, L);
}
- BinMDataStd::SetAttributeID(theSource, anAtt);
+ BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
return Standard_True;
}
//=======================================================================
Standard_Boolean BinMDataStd_ReferenceListDriver::Paste(const BinObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
- BinObjMgt_RRelocationTable& ) const
+ BinObjMgt_RRelocationTable& theRelocTable) const
{
Standard_Integer aFirstInd, aLastInd;
if (! (theSource >> aFirstInd >> aLastInd))
}
}
- BinMDataStd::SetAttributeID(theSource, anAtt);
+ BinMDataStd::SetAttributeID(theSource, anAtt, theRelocTable.GetHeaderData()->StorageVersion().IntegerValue());
return Standard_True;
}
#include <BinMNaming_NamingDriver.hxx>
#include <Message_Messenger.hxx>
-static Standard_Integer myDocumentVersion = -1;
//=======================================================================
//function : AddDrivers
//purpose :
aDriverTable->AddDriver (new BinMNaming_NamingDriver(aMessageDriver));
}
-//=======================================================================
-//function : SetDocumentVersion
-//purpose : Sets current document version
-//=======================================================================
-void BinMNaming::SetDocumentVersion(const Standard_Integer theVersion)
-{
- myDocumentVersion = theVersion;
-}
-//=======================================================================
-//function : DocumentVersion
-//purpose : Retrieved document version
-//=======================================================================
-Standard_Integer BinMNaming::DocumentVersion()
-{
- return myDocumentVersion;
-}
//! Adds the attribute drivers to <theDriverTable>.
Standard_EXPORT static void AddDrivers (const Handle(BinMDF_ADriverTable)& theDriverTable, const Handle(Message_Messenger)& aMsgDrv);
-
- Standard_EXPORT static void SetDocumentVersion (const Standard_Integer DocVersion);
-
- Standard_EXPORT static Standard_Integer DocumentVersion();
-
-
-
protected:
myMessageDriver->Send (aMsg, Message_Warning);
}
- if(BinMNaming::DocumentVersion() > 3) {
+ if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 3) {
TCollection_AsciiString entry;
ok = theSource >> entry;
if(ok) {
aName.ContextLabel(tLab);
}
}
- if(BinMNaming::DocumentVersion() > 4 && BinMNaming::DocumentVersion() < 7) {
+ if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 4 &&
+ theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() < 7) {
// Orientation processing - converting from old format
Handle(TNaming_NamedShape) aNShape;
if(anAtt->Label().FindAttribute(TNaming_NamedShape::GetID(), aNShape)) {
}
}
}
- if(BinMNaming::DocumentVersion() > 6) {
+ if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 6) {
ok = theSource >> anIndx;
TopAbs_Orientation OrientationToApply(TopAbs_FORWARD);
if(ok) {
}
}
#ifdef OCCT_DEBUG
- else if(BinMNaming::DocumentVersion() == -1)
- cout << "Current DocVersion field is not initialized. " <<endl;
- else
- cout << "Current DocVersion = " << BinMNaming::DocumentVersion() <<endl;
+ cout << "Current Document Format Version = " << theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() <<endl;
#endif
}
}
return Standard_True;
}
- Standard_Integer aFileVer = BinMDataStd::DocumentVersion();
+ Standard_Integer aFileVer = theMap.GetHeaderData()->StorageVersion().IntegerValue();
if( aFileVer > 5 && myLocations == 0 )
{
return Standard_False;
myRequestedNameIsDefined (Standard_False),
myRequestedPreviousVersionIsDefined(Standard_False),
myFileExtensionWasFound (Standard_False),
- myDescriptionWasFound (Standard_False)
+ myDescriptionWasFound (Standard_False),
+ myStorageFormatVersion (0)
{}
{
myActualReferenceIdentifier=aReferenceCounter;
}
+
+//=======================================================================
+//function : StorageFormatVersion
+//purpose :
+//=======================================================================
+Standard_Integer CDM_Document::StorageFormatVersion() const
+{
+ return myStorageFormatVersion;
+}
+
+//!
+//=======================================================================
+//function : ChangeStorageFormatVersion
+//purpose : Sets <theVersion> of the format to be used to store the document
+//=======================================================================
+void CDM_Document::ChangeStorageFormatVersion(const Standard_Integer theVersion)
+{
+ myStorageFormatVersion = theVersion;
+}
Standard_EXPORT void SetReferenceCounter (const Standard_Integer aReferenceCounter);
+ //! Returns version of the format to be used to store the document
+ Standard_EXPORT Standard_Integer StorageFormatVersion() const;
+
+ //! Sets <theVersion> of the format to be used to store the document
+ Standard_EXPORT void ChangeStorageFormatVersion(const Standard_Integer theVersion);
+
friend class CDM_Reference;
friend class CDM_ReferenceIterator;
friend class CDM_Application;
Standard_Boolean myResourcesAreLoaded;
-
private:
Standard_Boolean myFileExtensionWasFound;
Standard_Boolean myDescriptionWasFound;
Handle(CDM_Application) myApplication;
-
+ Standard_Integer myStorageFormatVersion;
};
Standard_Integer nb,
const char** a)
{
- if (nb == 2)
+ if (nb == 3)
{
- const int version = atoi(a[1]);
- XmlLDrivers::SetStorageVersion(version);
+ Handle(TDocStd_Document) D;
+ if (!DDocStd::GetDocument(a[1], D)) return 1;
+ const int version = atoi(a[2]);
+ D->ChangeStorageFormatVersion(version);
return 0;
}
return 1;
//purpose :
//=======================================================================
static Standard_Integer DDocStd_GetStorageVersion (Draw_Interpretor& di,
- Standard_Integer ,
- const char** )
-{
- di << XmlLDrivers::StorageVersion() << "\n" ;
- return 0;
+ Standard_Integer nb,
+ const char** a)
+{
+ if (nb == 2) {
+ Handle(TDocStd_Document) D;
+ if (!DDocStd::GetDocument(a[1], D)) return 1;
+ di << D->StorageFormatVersion() << "\n";
+ return 0;
+ }
+ return 1;
}
//=======================================================================
__FILE__, DDocStd_PrintComments, g);
theCommands.Add("GetStorageVersion",
- "GetStorageVersion",
+ "GetStorageVersion Doc",
__FILE__, DDocStd_GetStorageVersion, g);
theCommands.Add("SetStorageVersion",
- "SetStorageVersion Version",
+ "SetStorageVersion Doc Version",
__FILE__, DDocStd_SetStorageVersion, g);
}
#include <TNaming_NamedShape.hxx>
#include <XmlDrivers.hxx>
#include <XmlDrivers_DocumentRetrievalDriver.hxx>
-#include <XmlMDataStd.hxx>
#include <XmlMDF_ADriver.hxx>
#include <XmlMDF_ADriverTable.hxx>
-#include <XmlMNaming.hxx>
#include <XmlMNaming_NamedShapeDriver.hxx>
#include <XmlObjMgt_Element.hxx>
return XmlDrivers::AttributeDrivers (theMessageDriver);
}
-//=======================================================================
-//function : PropagateDocumentVersion
-//purpose :
-//=======================================================================
-void XmlDrivers_DocumentRetrievalDriver::PropagateDocumentVersion(
- const Standard_Integer theDocVersion )
-{
- XmlMDataStd::SetDocumentVersion(theDocVersion);
- XmlMNaming::SetDocumentVersion(theDocVersion);
-}
-
//=======================================================================
//function : ReadShapeSection
//purpose : Implementation of ReadShapeSection
Standard_EXPORT virtual Handle(XmlMDF_ADriver) ReadShapeSection (const XmlObjMgt_Element& thePDoc, const Handle(Message_Messenger)& theMsgDriver) Standard_OVERRIDE;
- Standard_EXPORT virtual void ShapeSetCleaning (const Handle(XmlMDF_ADriver)& theDriver) Standard_OVERRIDE;
-
- Standard_EXPORT virtual void PropagateDocumentVersion (const Standard_Integer theDocVersion) Standard_OVERRIDE;
-
+ Standard_EXPORT virtual void ShapeSetCleaning (const Handle(XmlMDF_ADriver)& theDriver) Standard_OVERRIDE;
{
return CURRENT_DOCUMENT_VERSION;
}
-void XmlLDrivers::SetStorageVersion(const int version)
-{
- CURRENT_DOCUMENT_VERSION = version;
-}
// Declare entry point PLUGINFACTORY
PLUGIN(XmlLDrivers)
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
#include <UTL.hxx>
#include <XmlLDrivers.hxx>
#include <XmlLDrivers_DocumentRetrievalDriver.hxx>
-#include <XmlMDataStd.hxx>
#include <XmlMDF.hxx>
#include <XmlMDF_ADriver.hxx>
#include <XmlMDF_ADriverTable.hxx>
}
if( aCurDocVersion < 2) aCurDocVersion = 2;
-
- PropagateDocumentVersion(aCurDocVersion);
-
Standard_Boolean isRef = Standard_False;
for (LDOM_Node aNode = anInfoElem.getFirstChild();
aNode != NULL; aNode = aNode.getNextSibling()) {
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
{
{
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();
}
#endif
-//=======================================================================
-//function : PropagateDocumentVersion
-//purpose :
-//=======================================================================
-void XmlLDrivers_DocumentRetrievalDriver::PropagateDocumentVersion(
- const Standard_Integer theDocVersion )
-{
- XmlMDataStd::SetDocumentVersion(theDocVersion);
-}
-
//=======================================================================
//function : ReadShapeSection
//purpose : definition of ReadShapeSection
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:
// 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;
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");
{
TCollection_ExtendedString aMessage;
Handle(TDocStd_Document) TDOC = Handle(TDocStd_Document)::DownCast(theTDoc);
- myRelocTable.Clear();
if (!TDOC.IsNull())
{
// myRelocTable.SetDocument (theElement.getOwnerDocument());
#include <XmlMDataStd_VariableDriver.hxx>
#include <XmlMDF_ADriverTable.hxx>
-static Standard_Integer myDocumentVersion = -1;
//=======================================================================
//function : AddDrivers
//purpose :
aDriverTable-> AddDriver (new XmlMDataStd_AsciiStringDriver (anMsgDrv));
aDriverTable-> AddDriver (new XmlMDataStd_IntPackedMapDriver (anMsgDrv));
}
-
-//=======================================================================
-//function : SetDocumentVersion
-//purpose : Sets current document version
-//=======================================================================
-void XmlMDataStd::SetDocumentVersion(const Standard_Integer theVersion)
-{
- myDocumentVersion = theVersion;
-}
-//=======================================================================
-//function : DocumentVersion
-//purpose : Retrieved document version
-//=======================================================================
-Standard_Integer XmlMDataStd::DocumentVersion()
-{
- return myDocumentVersion;
-}
//! Adds the attribute drivers to <aDriverTable>.
Standard_EXPORT static void AddDrivers (const Handle(XmlMDF_ADriverTable)& aDriverTable, const Handle(Message_Messenger)& anMsgDrv);
-
- Standard_EXPORT static void SetDocumentVersion (const Standard_Integer DocVersion);
-
- Standard_EXPORT static Standard_Integer DocumentVersion();
-
-
protected:
//=======================================================================
Standard_Boolean XmlMDataStd_ByteArrayDriver::Paste(const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
- XmlObjMgt_RRelocationTable& ) const
+ XmlObjMgt_RRelocationTable& theRelocTable) const
{
Standard_Integer aFirstInd, aLastInd, aValue;
const XmlObjMgt_Element& anElement = theSource;
Standard_Boolean aDelta(Standard_False);
- if(XmlMDataStd::DocumentVersion() > 2) {
+ if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
Standard_Integer aDeltaValue;
if (!anElement.getAttribute(::IsDeltaOn()).GetInteger(aDeltaValue))
{
aDelta = aDeltaValue != 0;
}
#ifdef OCCT_DEBUG
- else if(XmlMDataStd::DocumentVersion() == -1)
- cout << "Current DocVersion field is not initialized. " <<endl;
+ cout << "Current Document Format Version = " << theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() <<endl;
#endif
aByteArray->SetDelta(aDelta);
Standard_Boolean XmlMDataStd_ExtStringArrayDriver::Paste
(const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
- XmlObjMgt_RRelocationTable& ) const
+ XmlObjMgt_RRelocationTable& theRelocTable) const
{
Standard_Integer aFirstInd, aLastInd, ind;
TCollection_ExtendedString aValue;
// Read delta-flag.
Standard_Boolean aDelta(Standard_False);
- if(XmlMDataStd::DocumentVersion() > 2) {
+ if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
Standard_Integer aDeltaValue;
if (!anElement.getAttribute(::IsDeltaOn()).GetInteger(aDeltaValue))
{
else
aDelta = aDeltaValue != 0;
}
-#ifdef OCCT_DEBUG
- else if(XmlMDataStd::DocumentVersion() == -1)
- cout << "Current DocVersion field is not initialized. " <<endl;
-#endif
+
aExtStringArray->SetDelta(aDelta);
return Standard_True;
//=======================================================================
void XmlMDataStd_ExtStringArrayDriver::Paste (const Handle(TDF_Attribute)& theSource,
XmlObjMgt_Persistent& theTarget,
- XmlObjMgt_SRelocationTable& ) const
+ XmlObjMgt_SRelocationTable& theRelocTable) const
{
Handle(TDataStd_ExtStringArray) aExtStringArray =
Handle(TDataStd_ExtStringArray)::DownCast(theSource);
// So, if the user wants to save the document under the 7th or earlier versions,
// don't apply this improvement.
Standard_Character c = '-';
- if (XmlLDrivers::StorageVersion() > 7)
+ if (theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 7)
{
// Preferrable symbols for the separator: - _ . : ^ ~
// Don't use a space as a separator: XML low-level parser sometimes "eats" it.
Standard_Boolean XmlMDataStd_IntPackedMapDriver::Paste
(const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
- XmlObjMgt_RRelocationTable& ) const
+ XmlObjMgt_RRelocationTable& theRelocTable) const
{
Handle(TDataStd_IntPackedMap) aPackedMap =
Handle(TDataStd_IntPackedMap)::DownCast(theTarget);
if(Ok) {
Standard_Boolean aDelta(Standard_False);
- if(XmlMDataStd::DocumentVersion() > 2) {
+ if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
Standard_Integer aDeltaValue;
if (!anElement.getAttribute(::IsDeltaOn()).GetInteger(aDeltaValue))
{
else
aDelta = aDeltaValue != 0;
}
-#ifdef OCCT_DEBUG
- else if(XmlMDataStd::DocumentVersion() == -1)
- cout << "Current DocVersion field is not initialized. " <<endl;
-#endif
aPackedMap->SetDelta(aDelta);
return Standard_True;
}
Standard_Boolean XmlMDataStd_IntegerArrayDriver::Paste
(const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
- XmlObjMgt_RRelocationTable& ) const
+ XmlObjMgt_RRelocationTable& theRelocTable) const
{
Standard_Integer aFirstInd, aLastInd, aValue, ind;
const XmlObjMgt_Element& anElement = theSource;
}
Standard_Boolean aDelta(Standard_False);
- if(XmlMDataStd::DocumentVersion() > 2) {
+ if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
Standard_Integer aDeltaValue;
if (!anElement.getAttribute(::IsDeltaOn()).GetInteger(aDeltaValue))
{
else
aDelta = aDeltaValue != 0;
}
-#ifdef OCCT_DEBUG
- else if(XmlMDataStd::DocumentVersion() == -1)
- cout << "Current DocVersion field is not initialized. " <<endl;
-#endif
+
anIntArray->SetDelta(aDelta);
return Standard_True;
Standard_Boolean XmlMDataStd_RealArrayDriver::Paste
(const XmlObjMgt_Persistent& theSource,
const Handle(TDF_Attribute)& theTarget,
- XmlObjMgt_RRelocationTable& ) const
+ XmlObjMgt_RRelocationTable& theRelocTable) const
{
Handle(TDataStd_RealArray) aRealArray = Handle(TDataStd_RealArray)::DownCast(theTarget);
}
Standard_Boolean aDelta(Standard_False);
- if(XmlMDataStd::DocumentVersion() > 2) {
+ if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 2) {
Standard_Integer aDeltaValue;
if (!anElement.getAttribute(::IsDeltaOn()).GetInteger(aDeltaValue))
{
else
aDelta = aDeltaValue != 0;
}
-#ifdef OCCT_DEBUG
- else if(XmlMDataStd::DocumentVersion() == -1)
- cout << "Current DocVersion field is not initialized. " <<endl;
-#endif
aRealArray->SetDelta(aDelta);
return Standard_True;
// tree id
// A not default ID is skipped for storage version 8 and newer.
if (aS->ID() != TDataStd_TreeNode::GetDefaultTreeID() ||
- XmlLDrivers::StorageVersion() < 8)
+ theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() < 8)
{
Standard_Character aGuidStr [40];
Standard_PCharacter pGuidStr=aGuidStr;
#include <XmlMNaming_NamedShapeDriver.hxx>
#include <XmlMNaming_NamingDriver.hxx>
-static Standard_Integer myDocumentVersion = -1;
//=======================================================================
//function : AddStorageDrivers
//purpose :
aDriverTable->AddDriver (new XmlMNaming_NamedShapeDriver(aMessageDriver));
aDriverTable->AddDriver (new XmlMNaming_NamingDriver(aMessageDriver));
}
-
-//=======================================================================
-//function : SetDocumentVersion
-//purpose : Sets current document version
-//=======================================================================
-void XmlMNaming::SetDocumentVersion(const Standard_Integer theVersion)
-{
- myDocumentVersion = theVersion;
-}
-//=======================================================================
-//function : DocumentVersion
-//purpose : Retrieved document version
-//=======================================================================
-Standard_Integer XmlMNaming::DocumentVersion()
-{
- return myDocumentVersion;
-}
//! Adds the attribute drivers to <aDriverTable>.
Standard_EXPORT static void AddDrivers (const Handle(XmlMDF_ADriverTable)& aDriverTable, const Handle(Message_Messenger)& aMessageDriver);
-
- Standard_EXPORT static void SetDocumentVersion (const Standard_Integer DocVersion);
-
- Standard_EXPORT static Standard_Integer DocumentVersion();
-
-
protected:
#include <TNaming_Name.hxx>
#include <TNaming_NamedShape.hxx>
#include <TNaming_Naming.hxx>
-#include <XmlMNaming.hxx>
#include <XmlMNaming_NamingDriver.hxx>
#include <XmlObjMgt.hxx>
#include <XmlObjMgt_Persistent.hxx>
}
aNgName.Index(aNb);
//
- if(XmlMNaming::DocumentVersion() > 3) {
+ if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 3) {
XmlObjMgt_DOMString aDomEntry = anElem.getAttribute(::ContextLabelString());
if (aDomEntry != NULL)
{
cout << "Retrieving Context Label is NULL" <<endl;
#endif
- if(XmlMNaming::DocumentVersion() > 4 && XmlMNaming::DocumentVersion() < 7) {
+ if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 4 &&
+ theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() < 7) {
// Orientation processing - converting from old format
Handle(TNaming_NamedShape) aNS;
if (aNg->Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
}
}
}
- if(XmlMNaming::DocumentVersion() > 6) {
+ if(theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() > 6) {
aDOMStr = anElem.getAttribute(::OrientString());
if (!aDOMStr.GetInteger(aNb))
{
// or. end
}
#ifdef OCCT_DEBUG
- else if(XmlMNaming::DocumentVersion() == -1)
- cout << "Current DocVersion field is not initialized. " <<endl;
else
- cout << "Current DocVersion = " << XmlMNaming::DocumentVersion() <<endl;
+ cout << "Current Document Format Version = " << theRelocTable.GetHeaderData()->StorageVersion().IntegerValue() <<endl;
#endif
return Standard_True;
}
if (aLocElem == NULL)
return Standard_False;
- Standard_Integer aFileVer = XmlMNaming::DocumentVersion();
+ Standard_Integer aFileVer = theMap.GetHeaderData()->StorageVersion().IntegerValue();
if( aFileVer > 5 && myLocations == 0 )
{
return Standard_False;
XmlObjMgt_Persistent.cxx
XmlObjMgt_Persistent.hxx
XmlObjMgt_Persistent.lxx
+XmlObjMgt_RRelocationTable.cxx
XmlObjMgt_RRelocationTable.hxx
+XmlObjMgt_SRelocationTable.cxx
XmlObjMgt_SRelocationTable.hxx
--- /dev/null
+// Created on: 2018-10-02
+// Created by: Sergey ZARITCHNY
+// Copyright (c) 2018 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <XmlObjMgt_RRelocationTable.hxx>
+
+//=======================================================================
+//function : GetHeaderData
+//purpose : getter for the file header data
+//=======================================================================
+
+const Handle(Storage_HeaderData)& XmlObjMgt_RRelocationTable::GetHeaderData() const
+{
+ return myHeaderData;
+}
+
+//=======================================================================
+//function : SetHeaderData
+//purpose : setter for the file header data
+//=======================================================================
+
+void XmlObjMgt_RRelocationTable::SetHeaderData(
+ const Handle(Storage_HeaderData)& theHeaderData)
+{
+ myHeaderData = theHeaderData;
+}
+
+//=======================================================================
+//function : Clear
+//purpose : The relocation table is cleared before/after reading in a document.
+// : In this case the reference to the file header data should also be
+// : cleared, because it is specific to the document.
+//=======================================================================
+void XmlObjMgt_RRelocationTable::Clear(const Standard_Boolean doReleaseMemory)
+{
+ myHeaderData.Nullify();
+ TColStd_DataMapOfIntegerTransient::Clear(doReleaseMemory);
+}
\ No newline at end of file
#include <TColStd_DataMapOfIntegerTransient.hxx>
-typedef TColStd_DataMapOfIntegerTransient XmlObjMgt_RRelocationTable;
+#include <Storage_HeaderData.hxx>
+//! Retrieval relocation table is modeled as a child class of
+//! TColStd_DataMapOfIntegerTransient that stores a handle to the file
+//! header section. With that attribute drivers have access to the file header
+//! section.
+class XmlObjMgt_RRelocationTable : public TColStd_DataMapOfIntegerTransient
+{
+public:
+
+ //! Returns a handle to the header data of the file that is begin read
+ Standard_EXPORT const Handle(Storage_HeaderData)& GetHeaderData() const;
+
+ //! Sets the storage header data.
+ //!
+ //! @param theHeaderData header data of the file that is begin read
+ Standard_EXPORT void SetHeaderData(
+ const Handle(Storage_HeaderData)& theHeaderData);
+
+ Standard_EXPORT void Clear(const Standard_Boolean doReleaseMemory = Standard_True);
+
+
+
+protected:
+
+
+
+private:
+
+ Handle(Storage_HeaderData) myHeaderData;
+};
#endif // _XmlObjMgt_RRelocationTable_HeaderFile
--- /dev/null
+// Created on: 2018-10-04
+// Created by: Sergey ZARITCHNY
+// Copyright (c) 2018 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <XmlObjMgt_SRelocationTable.hxx>
+
+//=======================================================================
+//function : GetHeaderData
+//purpose : getter for the file header data
+//=======================================================================
+
+const Handle(Storage_HeaderData)& XmlObjMgt_SRelocationTable::GetHeaderData() const
+{
+ return myHeaderData;
+}
+
+//=======================================================================
+//function : SetHeaderData
+//purpose : setter for the file header data
+//=======================================================================
+
+void XmlObjMgt_SRelocationTable::SetHeaderData(
+ const Handle(Storage_HeaderData)& theHeaderData)
+{
+ myHeaderData = theHeaderData;
+}
+
+//=======================================================================
+//function : Clear
+//purpose : The relocation table is cleared before/after reading in a document.
+// : In this case the reference to the file header data should also be
+// : cleared, because it is specific to the document.
+//=======================================================================
+void XmlObjMgt_SRelocationTable::Clear(const Standard_Boolean doReleaseMemory)
+{
+ myHeaderData.Nullify();
+ TColStd_IndexedMapOfTransient::Clear(doReleaseMemory);
+}
\ No newline at end of file
#ifndef _XmlObjMgt_SRelocationTable_HeaderFile
#define _XmlObjMgt_SRelocationTable_HeaderFile
-
+#include <Standard_Handle.hxx>
#include <TColStd_IndexedMapOfTransient.hxx>
+#include <Storage_HeaderData.hxx>
+
+//! Stored relocation table is modeled as a child class of
+//! TColStd_DataMapOfIntegerTransient that stores a handle to the file
+//! header section. With that attribute drivers have access to the file header
+//! section.
+class XmlObjMgt_SRelocationTable : public TColStd_IndexedMapOfTransient
+{
+public:
+
+ //! Returns a handle to the header data of the file that is begin read
+ Standard_EXPORT const Handle(Storage_HeaderData)& GetHeaderData() const;
+
+ //! Sets the storage header data.
+ //!
+ //! @param theHeaderData header data of the file that is begin read
+ Standard_EXPORT void SetHeaderData(
+ const Handle(Storage_HeaderData)& theHeaderData);
+
+ Standard_EXPORT void Clear(const Standard_Boolean doReleaseMemory = Standard_True);
+
+
+protected:
+
+
-typedef TColStd_IndexedMapOfTransient XmlObjMgt_SRelocationTable;
+private:
+ Handle(Storage_HeaderData) myHeaderData;
+};
#endif // _XmlObjMgt_SRelocationTable_HeaderFile
SaveAs D ${FileV9}
-SetStorageVersion 7
+SetStorageVersion D 7
SaveAs D ${FileV7}
Close D
puts "Testing for XML file format in new version document"
-SetStorageVersion 9
+
Open ${FileV9} D9
set info [Attributes D9 0:1]