42cf5bc1 |
1 | // Created on: 1997-12-09 |
2 | // Created by: Jean-Louis Frenkel |
3 | // Copyright (c) 1997-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _PCDM_ReadWriter_HeaderFile |
18 | #define _PCDM_ReadWriter_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Standard_Transient.hxx> |
24 | #include <Standard_Integer.hxx> |
25 | #include <PCDM_SequenceOfReference.hxx> |
26 | #include <TColStd_SequenceOfExtendedString.hxx> |
27 | #include <Storage_OpenMode.hxx> |
28 | class TCollection_AsciiString; |
29 | class Storage_Data; |
30 | class CDM_Document; |
31 | class TCollection_ExtendedString; |
83ae3591 |
32 | class Message_Messenger; |
42cf5bc1 |
33 | class Storage_BaseDriver; |
34 | |
35 | |
36 | class PCDM_ReadWriter; |
37 | DEFINE_STANDARD_HANDLE(PCDM_ReadWriter, Standard_Transient) |
38 | |
39 | |
40 | class PCDM_ReadWriter : public Standard_Transient |
41 | { |
42 | |
43 | public: |
44 | |
45 | |
46 | //! returns PCDM_ReadWriter_1. |
47 | Standard_EXPORT virtual TCollection_AsciiString Version() const = 0; |
48 | |
49 | Standard_EXPORT virtual void WriteReferenceCounter (const Handle(Storage_Data)& aData, const Handle(CDM_Document)& aDocument) const = 0; |
50 | |
51 | Standard_EXPORT virtual void WriteReferences (const Handle(Storage_Data)& aData, const Handle(CDM_Document)& aDocument, const TCollection_ExtendedString& theReferencerFileName) const = 0; |
52 | |
53 | Standard_EXPORT virtual void WriteExtensions (const Handle(Storage_Data)& aData, const Handle(CDM_Document)& aDocument) const = 0; |
54 | |
55 | Standard_EXPORT virtual void WriteVersion (const Handle(Storage_Data)& aData, const Handle(CDM_Document)& aDocument) const = 0; |
56 | |
83ae3591 |
57 | Standard_EXPORT virtual Standard_Integer ReadReferenceCounter (const TCollection_ExtendedString& theFileName, const Handle(Message_Messenger)& theMsgDriver) const = 0; |
42cf5bc1 |
58 | |
83ae3591 |
59 | Standard_EXPORT virtual void ReadReferences (const TCollection_ExtendedString& aFileName, PCDM_SequenceOfReference& theReferences, const Handle(Message_Messenger)& theMsgDriver) const = 0; |
42cf5bc1 |
60 | |
83ae3591 |
61 | Standard_EXPORT virtual void ReadExtensions (const TCollection_ExtendedString& aFileName, TColStd_SequenceOfExtendedString& theExtensions, const Handle(Message_Messenger)& theMsgDriver) const = 0; |
42cf5bc1 |
62 | |
83ae3591 |
63 | Standard_EXPORT virtual Standard_Integer ReadDocumentVersion (const TCollection_ExtendedString& aFileName, const Handle(Message_Messenger)& theMsgDriver) const = 0; |
42cf5bc1 |
64 | |
39c8dc70 |
65 | Standard_EXPORT static void Open (const Handle(Storage_BaseDriver)& aDriver, |
66 | const TCollection_ExtendedString& aFileName, |
67 | const Storage_OpenMode anOpenMode); |
42cf5bc1 |
68 | |
69 | //! returns the convenient Reader for a File. |
70 | Standard_EXPORT static Handle(PCDM_ReadWriter) Reader (const TCollection_ExtendedString& aFileName); |
71 | |
72 | Standard_EXPORT static Handle(PCDM_ReadWriter) Writer(); |
73 | |
74 | Standard_EXPORT static void WriteFileFormat (const Handle(Storage_Data)& aData, const Handle(CDM_Document)& aDocument); |
75 | |
76 | //! tries to get a format in the file. returns an empty |
77 | //! string if the file could not be read or does not have |
78 | //! a FileFormat information. |
79 | Standard_EXPORT static TCollection_ExtendedString FileFormat (const TCollection_ExtendedString& aFileName); |
80 | |
4ff92abe |
81 | //! tries to get a format from the stream. returns an empty |
82 | //! string if the file could not be read or does not have |
83 | //! a FileFormat information. |
84 | Standard_EXPORT static TCollection_ExtendedString FileFormat (Standard_IStream& theIStream, Handle(Storage_Data)& theData); |
42cf5bc1 |
85 | |
86 | |
87 | |
92efcf78 |
88 | DEFINE_STANDARD_RTTIEXT(PCDM_ReadWriter,Standard_Transient) |
42cf5bc1 |
89 | |
90 | protected: |
91 | |
92 | |
93 | |
94 | |
95 | private: |
96 | |
97 | |
98 | |
99 | |
100 | }; |
101 | |
102 | |
103 | |
104 | |
105 | |
106 | |
107 | |
108 | #endif // _PCDM_ReadWriter_HeaderFile |