1 // Created on: 2002-10-31
2 // Created by: Michael SAZONOV
3 // Copyright (c) 2002-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _BinLDrivers_DocumentRetrievalDriver_HeaderFile
17 #define _BinLDrivers_DocumentRetrievalDriver_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_Type.hxx>
22 #include <BinObjMgt_Persistent.hxx>
23 #include <BinObjMgt_RRelocationTable.hxx>
24 #include <TColStd_MapOfInteger.hxx>
25 #include <BinLDrivers_VectorOfDocumentSection.hxx>
26 #include <PCDM_RetrievalDriver.hxx>
27 #include <Standard_Integer.hxx>
28 #include <Standard_IStream.hxx>
29 #include <Storage_Position.hxx>
30 #include <Standard_Boolean.hxx>
31 #include <Storage_Data.hxx>
33 class BinMDF_ADriverTable;
34 class Message_Messenger;
35 class TCollection_ExtendedString;
38 class CDM_Application;
40 class TCollection_AsciiString;
41 class Storage_HeaderData;
42 class BinLDrivers_DocumentSection;
45 class BinLDrivers_DocumentRetrievalDriver;
46 DEFINE_STANDARD_HANDLE(BinLDrivers_DocumentRetrievalDriver, PCDM_RetrievalDriver)
49 class BinLDrivers_DocumentRetrievalDriver : public PCDM_RetrievalDriver
56 Standard_EXPORT BinLDrivers_DocumentRetrievalDriver();
58 //! pure virtual method definition
59 Standard_EXPORT virtual Handle(CDM_Document) CreateDocument() Standard_OVERRIDE;
61 //! retrieves the content of the file into a new Document.
62 Standard_EXPORT virtual void Read (const TCollection_ExtendedString& theFileName,
63 const Handle(CDM_Document)& theNewDocument,
64 const Handle(CDM_Application)& theApplication,
65 const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
67 Standard_EXPORT virtual void Read (Standard_IStream& theIStream,
68 const Handle(Storage_Data)& theStorageData,
69 const Handle(CDM_Document)& theDoc,
70 const Handle(CDM_Application)& theApplication,
71 const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
73 Standard_EXPORT virtual Handle(BinMDF_ADriverTable) AttributeDrivers (const Handle(Message_Messenger)& theMsgDriver);
78 DEFINE_STANDARD_RTTIEXT(BinLDrivers_DocumentRetrievalDriver,PCDM_RetrievalDriver)
83 //! Read the tree from the stream <theIS> to <theLabel>
84 Standard_EXPORT virtual Standard_Integer ReadSubTree
85 (Standard_IStream& theIS,
86 const TDF_Label& theData,
87 const Message_ProgressRange& theRanges = Message_ProgressRange());
90 //! define the procedure of reading a section to file.
91 Standard_EXPORT virtual void ReadSection
92 (BinLDrivers_DocumentSection& theSection,
93 const Handle(CDM_Document)& theDoc,
94 Standard_IStream& theIS);
96 //! define the procedure of reading a shapes section to file.
97 Standard_EXPORT virtual void ReadShapeSection
98 (BinLDrivers_DocumentSection& theSection,
99 Standard_IStream& theIS,
100 const Standard_Boolean isMess = Standard_False,
101 const Message_ProgressRange& theRange = Message_ProgressRange());
103 //! checks the shapes section can be correctly retreived.
104 Standard_EXPORT virtual void CheckShapeSection (const Storage_Position& thePos, Standard_IStream& theIS);
106 //! clears the reading-cash data in drivers if any.
107 Standard_EXPORT virtual void Clear();
109 //! Check a file version(in which file was written) with a current version.
110 //! Redefining this method is a chance for application to read files
111 //! written by newer applications.
112 //! The default implementation: if the version of the file is greater than the
113 //! current or lesser than 2, then return false, else true
114 Standard_EXPORT virtual Standard_Boolean CheckDocumentVersion (const Standard_Integer theFileVersion, const Standard_Integer theCurVersion);
116 Handle(BinMDF_ADriverTable) myDrivers;
117 BinObjMgt_RRelocationTable myRelocTable;
118 Handle(Message_Messenger) myMsgDriver;
123 BinObjMgt_Persistent myPAtt;
124 TColStd_MapOfInteger myMapUnsupported;
125 BinLDrivers_VectorOfDocumentSection mySections;
136 #endif // _BinLDrivers_DocumentRetrievalDriver_HeaderFile