42cf5bc1 |
1 | // Created on: 2002-10-31 |
2 | // Created by: Michael SAZONOV |
3 | // Copyright (c) 2002-2014 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
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. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef _BinLDrivers_DocumentRetrievalDriver_HeaderFile |
17 | #define _BinLDrivers_DocumentRetrievalDriver_HeaderFile |
18 | |
19 | #include <Standard.hxx> |
42cf5bc1 |
20 | |
21 | #include <BinObjMgt_Persistent.hxx> |
22 | #include <BinObjMgt_RRelocationTable.hxx> |
23 | #include <TColStd_MapOfInteger.hxx> |
24 | #include <BinLDrivers_VectorOfDocumentSection.hxx> |
25 | #include <PCDM_RetrievalDriver.hxx> |
26 | #include <Standard_Integer.hxx> |
27 | #include <Standard_IStream.hxx> |
28 | #include <Storage_Position.hxx> |
4ff92abe |
29 | #include <Storage_Data.hxx> |
30 | |
42cf5bc1 |
31 | class BinMDF_ADriverTable; |
83ae3591 |
32 | class Message_Messenger; |
42cf5bc1 |
33 | class TCollection_ExtendedString; |
42cf5bc1 |
34 | class CDM_Document; |
35 | class CDM_Application; |
36 | class TDF_Label; |
42cf5bc1 |
37 | class BinLDrivers_DocumentSection; |
38 | |
39 | |
40 | class BinLDrivers_DocumentRetrievalDriver; |
41 | DEFINE_STANDARD_HANDLE(BinLDrivers_DocumentRetrievalDriver, PCDM_RetrievalDriver) |
42 | |
43 | |
44 | class BinLDrivers_DocumentRetrievalDriver : public PCDM_RetrievalDriver |
45 | { |
46 | |
47 | public: |
48 | |
49 | |
50 | //! Constructor |
51 | Standard_EXPORT BinLDrivers_DocumentRetrievalDriver(); |
52 | |
42cf5bc1 |
53 | //! retrieves the content of the file into a new Document. |
6d8f9f4a |
54 | Standard_EXPORT virtual void Read (const TCollection_ExtendedString& theFileName, |
55 | const Handle(CDM_Document)& theNewDocument, |
56 | const Handle(CDM_Application)& theApplication, |
d5c71e20 |
57 | const Handle(PCDM_ReaderFilter)& theFilter = Handle(PCDM_ReaderFilter)(), |
7e785937 |
58 | const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE; |
4ff92abe |
59 | |
60 | Standard_EXPORT virtual void Read (Standard_IStream& theIStream, |
61 | const Handle(Storage_Data)& theStorageData, |
62 | const Handle(CDM_Document)& theDoc, |
6d8f9f4a |
63 | const Handle(CDM_Application)& theApplication, |
d5c71e20 |
64 | const Handle(PCDM_ReaderFilter)& theFilter = Handle(PCDM_ReaderFilter)(), |
7e785937 |
65 | const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE; |
42cf5bc1 |
66 | |
83ae3591 |
67 | Standard_EXPORT virtual Handle(BinMDF_ADriverTable) AttributeDrivers (const Handle(Message_Messenger)& theMsgDriver); |
42cf5bc1 |
68 | |
69 | |
70 | |
71 | |
92efcf78 |
72 | DEFINE_STANDARD_RTTIEXT(BinLDrivers_DocumentRetrievalDriver,PCDM_RetrievalDriver) |
42cf5bc1 |
73 | |
74 | protected: |
75 | |
76 | |
77 | //! Read the tree from the stream <theIS> to <theLabel> |
6d8f9f4a |
78 | Standard_EXPORT virtual Standard_Integer ReadSubTree |
79 | (Standard_IStream& theIS, |
80 | const TDF_Label& theData, |
d5c71e20 |
81 | const Handle(PCDM_ReaderFilter)& theFilter, |
82 | const Standard_Boolean& theQuickPart, |
d3e00bfa |
83 | const Standard_Boolean theReadMissing, |
d5c71e20 |
84 | const Message_ProgressRange& theRanges = Message_ProgressRange()); |
42cf5bc1 |
85 | |
42cf5bc1 |
86 | |
87 | //! define the procedure of reading a section to file. |
6d8f9f4a |
88 | Standard_EXPORT virtual void ReadSection |
89 | (BinLDrivers_DocumentSection& theSection, |
90 | const Handle(CDM_Document)& theDoc, |
91 | Standard_IStream& theIS); |
42cf5bc1 |
92 | |
bf954475 |
93 | //! define the procedure of reading a shapes section to file. |
6d8f9f4a |
94 | Standard_EXPORT virtual void ReadShapeSection |
d5c71e20 |
95 | (BinLDrivers_DocumentSection& theSection, |
96 | Standard_IStream& theIS, |
97 | const Standard_Boolean isMess = Standard_False, |
98 | const Message_ProgressRange& theRange = Message_ProgressRange()); |
42cf5bc1 |
99 | |
b81b237f |
100 | //! checks the shapes section can be correctly retrieved. |
42cf5bc1 |
101 | Standard_EXPORT virtual void CheckShapeSection (const Storage_Position& thePos, Standard_IStream& theIS); |
bf954475 |
102 | |
103 | //! clears the reading-cash data in drivers if any. |
104 | Standard_EXPORT virtual void Clear(); |
42cf5bc1 |
105 | |
106 | //! Check a file version(in which file was written) with a current version. |
107 | //! Redefining this method is a chance for application to read files |
108 | //! written by newer applications. |
109 | //! The default implementation: if the version of the file is greater than the |
110 | //! current or lesser than 2, then return false, else true |
111 | Standard_EXPORT virtual Standard_Boolean CheckDocumentVersion (const Standard_Integer theFileVersion, const Standard_Integer theCurVersion); |
42cf5bc1 |
112 | |
d5c71e20 |
113 | //! Return true if retrieved document allows to read parts quickly. |
114 | static Standard_Boolean IsQuickPart (const Standard_Integer theFileVer); |
115 | |
116 | //! Enables reading in the quick part access mode. |
117 | Standard_EXPORT virtual void EnableQuickPartReading (const Handle(Message_Messenger)& /*theMessageDriver*/, Standard_Boolean /*theValue*/) {} |
118 | |
42cf5bc1 |
119 | Handle(BinMDF_ADriverTable) myDrivers; |
120 | BinObjMgt_RRelocationTable myRelocTable; |
83ae3591 |
121 | Handle(Message_Messenger) myMsgDriver; |
42cf5bc1 |
122 | |
123 | private: |
124 | |
125 | |
126 | BinObjMgt_Persistent myPAtt; |
42cf5bc1 |
127 | TColStd_MapOfInteger myMapUnsupported; |
128 | BinLDrivers_VectorOfDocumentSection mySections; |
d3e00bfa |
129 | NCollection_Map<Standard_Integer> myUnresolvedLinks; |
42cf5bc1 |
130 | |
131 | |
132 | }; |
133 | |
134 | |
135 | |
136 | |
137 | |
138 | |
139 | |
140 | #endif // _BinLDrivers_DocumentRetrievalDriver_HeaderFile |