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> |
20 | #include <Standard_Type.hxx> |
21 | |
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 | class BinMDF_ADriverTable; |
32 | class CDM_MessageDriver; |
33 | class TCollection_ExtendedString; |
34 | class PCDM_Document; |
35 | class CDM_Document; |
36 | class CDM_Application; |
37 | class TDF_Label; |
38 | class TCollection_AsciiString; |
39 | class Storage_HeaderData; |
40 | class BinLDrivers_DocumentSection; |
41 | |
42 | |
43 | class BinLDrivers_DocumentRetrievalDriver; |
44 | DEFINE_STANDARD_HANDLE(BinLDrivers_DocumentRetrievalDriver, PCDM_RetrievalDriver) |
45 | |
46 | |
47 | class BinLDrivers_DocumentRetrievalDriver : public PCDM_RetrievalDriver |
48 | { |
49 | |
50 | public: |
51 | |
52 | |
53 | //! Constructor |
54 | Standard_EXPORT BinLDrivers_DocumentRetrievalDriver(); |
55 | |
56 | //! pure virtual method definition |
57 | Standard_EXPORT virtual TCollection_ExtendedString SchemaName() const Standard_OVERRIDE; |
58 | |
59 | //! pure virtual method definition |
60 | Standard_EXPORT virtual void Make (const Handle(PCDM_Document)& PD, const Handle(CDM_Document)& TD) Standard_OVERRIDE; |
61 | |
62 | //! pure virtual method definition |
63 | Standard_EXPORT virtual Handle(CDM_Document) CreateDocument() Standard_OVERRIDE; |
64 | |
65 | //! retrieves the content of the file into a new Document. |
66 | Standard_EXPORT virtual void Read (const TCollection_ExtendedString& theFileName, const Handle(CDM_Document)& theNewDocument, const Handle(CDM_Application)& theApplication) Standard_OVERRIDE; |
67 | |
68 | Standard_EXPORT virtual Handle(BinMDF_ADriverTable) AttributeDrivers (const Handle(CDM_MessageDriver)& theMsgDriver); |
69 | |
70 | |
71 | |
72 | |
92efcf78 |
73 | DEFINE_STANDARD_RTTIEXT(BinLDrivers_DocumentRetrievalDriver,PCDM_RetrievalDriver) |
42cf5bc1 |
74 | |
75 | protected: |
76 | |
77 | |
78 | //! Read the tree from the stream <theIS> to <theLabel> |
79 | Standard_EXPORT virtual Standard_Integer ReadSubTree (Standard_IStream& theIS, const TDF_Label& theData); |
80 | |
81 | //! Read the info section of theFile into theData, |
82 | //! return a file position corresponding to the info |
83 | //! section end |
84 | Standard_EXPORT Storage_Position ReadInfoSection (const TCollection_AsciiString& theFile, Handle(Storage_HeaderData)& theData); |
85 | |
86 | //! define the procedure of reading a section to file. |
87 | Standard_EXPORT virtual void ReadSection (BinLDrivers_DocumentSection& theSection, const Handle(CDM_Document)& theDoc, Standard_IStream& theIS); |
88 | |
89 | Standard_EXPORT virtual void ReadShapeSection (BinLDrivers_DocumentSection& theSection, Standard_IStream& theIS, const Standard_Boolean isMess = Standard_False); |
90 | |
91 | Standard_EXPORT virtual void CheckShapeSection (const Storage_Position& thePos, Standard_IStream& theIS); |
92 | |
93 | Standard_EXPORT virtual void PropagateDocumentVersion (const Standard_Integer theVersion); |
94 | |
95 | //! Check a file version(in which file was written) with a current version. |
96 | //! Redefining this method is a chance for application to read files |
97 | //! written by newer applications. |
98 | //! The default implementation: if the version of the file is greater than the |
99 | //! current or lesser than 2, then return false, else true |
100 | Standard_EXPORT virtual Standard_Boolean CheckDocumentVersion (const Standard_Integer theFileVersion, const Standard_Integer theCurVersion); |
101 | |
102 | //! write theMessage to the MessageDriver of the |
103 | //! Application |
104 | Standard_EXPORT void WriteMessage (const TCollection_ExtendedString& theMessage); |
105 | |
106 | Handle(BinMDF_ADriverTable) myDrivers; |
107 | BinObjMgt_RRelocationTable myRelocTable; |
108 | |
109 | |
110 | private: |
111 | |
112 | |
113 | BinObjMgt_Persistent myPAtt; |
114 | Handle(CDM_MessageDriver) myMsgDriver; |
115 | TColStd_MapOfInteger myMapUnsupported; |
116 | BinLDrivers_VectorOfDocumentSection mySections; |
117 | |
118 | |
119 | }; |
120 | |
121 | |
122 | |
123 | |
124 | |
125 | |
126 | |
127 | #endif // _BinLDrivers_DocumentRetrievalDriver_HeaderFile |