1 // File: DDF_IOStream.hxx
3 // Author: DAUTRY Philippe
4 // <fid@fox.paris1.matra-dtv.fr>
5 // Copyright: Matra Datavision 1997
8 // History: Version Date Purpose
9 // 0.0 Aug 22 1997 Creation
11 // This file has been written using FSD_File.hxx as template.
12 // This is a specific adaptation for Draw use (save & restore commands).
13 // It is not sure at all this code is portable on any other plateform than
14 // SUN OS. Don't use it anywhere else.
15 // Thanks for comprehension. (22 august 97)
18 #ifndef DDF_IOStream_HeaderFile
19 #define DDF_IOStream_HeaderFile
21 // File generated by CPPExt (Value)
22 // Copyright (C) 1991,1995 by
24 // MATRA DATAVISION, FRANCE
26 // This software is furnished in accordance with the terms and conditions
27 // of the contract and with the inclusion of the above copyright notice.
28 // This software or any other copy thereof may not be provided or otherwise
29 // be made available to any other person. No title to an ownership of the
30 // software is hereby transferred.
32 // At the termination of the contract, the software and all copies of this
33 // software must be deleted.
37 #ifndef _Storage_BaseDriver_HeaderFile
38 #include <Storage_BaseDriver.hxx>
40 #ifndef _Storage_Error_HeaderFile
41 #include <Storage_Error.hxx>
43 #ifndef _Storage_OpenMode_HeaderFile
44 #include <Storage_OpenMode.hxx>
46 #ifndef _Standard_Boolean_HeaderFile
47 #include <Standard_Boolean.hxx>
49 #ifndef _Standard_Integer_HeaderFile
50 #include <Standard_Integer.hxx>
52 #ifndef _Standard_Character_HeaderFile
53 #include <Standard_Character.hxx>
55 #ifndef _Standard_ExtCharacter_HeaderFile
56 #include <Standard_ExtCharacter.hxx>
58 #ifndef _Standard_Real_HeaderFile
59 #include <Standard_Real.hxx>
61 #ifndef _Standard_ShortReal_HeaderFile
62 #include <Standard_ShortReal.hxx>
64 #ifndef _Standard_CString_HeaderFile
65 #include <Standard_CString.hxx>
67 #include <Storage_Position.hxx>
69 class Storage_StreamTypeMismatchError;
70 class Storage_StreamFormatError;
71 class Storage_StreamWriteError;
72 class Storage_StreamExtCharParityError;
74 class TColStd_SequenceOfExtendedString;
76 #ifndef Standard_EXPORT
78 #define Standard_EXPORT __declspec(dllexport)
80 #define Standard_EXPORT
84 #pragma warning (disable : 4275)
87 class Standard_EXPORT DDF_IOStream : public Storage_BaseDriver {
94 Storage_Error Open(const TCollection_AsciiString& aName,const Storage_OpenMode aMode) ;
95 Storage_Error Open(istream* anIStream) ;
96 Storage_Error Open(ostream* anOStream) ;
97 Standard_Boolean IsEnd() ;
98 Storage_Position Tell() { return -1; }
99 static Storage_Error IsGoodFileType(istream* anIStream) ;
100 Storage_Error BeginWriteInfoSection() ;
101 void WriteInfo(const Standard_Integer nbObj,const TCollection_AsciiString& dbVersion,const TCollection_AsciiString& date,const TCollection_AsciiString& schemaName,const TCollection_AsciiString& schemaVersion,const TCollection_ExtendedString& appName,const TCollection_AsciiString& appVersion,const TCollection_ExtendedString& objectType,const TColStd_SequenceOfAsciiString& userInfo) ;
102 Storage_Error EndWriteInfoSection() ;
103 Storage_Error BeginReadInfoSection() ;
104 void ReadInfo(Standard_Integer& nbObj,TCollection_AsciiString& dbVersion,TCollection_AsciiString& date,TCollection_AsciiString& schemaName,TCollection_AsciiString& schemaVersion,TCollection_ExtendedString& appName,TCollection_AsciiString& appVersion,TCollection_ExtendedString& objectType,TColStd_SequenceOfAsciiString& userInfo) ;
105 Storage_Error EndReadInfoSection() ;
106 Storage_Error BeginWriteCommentSection() ;
107 void WriteComment(const TColStd_SequenceOfExtendedString& userComments) ;
108 Storage_Error EndWriteCommentSection() ;
109 Storage_Error BeginReadCommentSection() ;
110 void ReadComment(TColStd_SequenceOfExtendedString& userComments) ;
111 Storage_Error EndReadCommentSection() ;
112 Storage_Error BeginWriteTypeSection() ;
113 void SetTypeSectionSize(const Standard_Integer aSize) ;
114 void WriteTypeInformations(const Standard_Integer typeNum,const TCollection_AsciiString& typeName) ;
115 Storage_Error EndWriteTypeSection() ;
116 Storage_Error BeginReadTypeSection() ;
117 Standard_Integer TypeSectionSize() ;
118 void ReadTypeInformations(Standard_Integer& typeNum,TCollection_AsciiString& typeName) ;
119 Storage_Error EndReadTypeSection() ;
120 Storage_Error BeginWriteRootSection() ;
121 void SetRootSectionSize(const Standard_Integer aSize) ;
122 void WriteRoot(const TCollection_AsciiString& rootName,const Standard_Integer aRef,const TCollection_AsciiString& aType) ;
123 Storage_Error EndWriteRootSection() ;
124 Storage_Error BeginReadRootSection() ;
125 Standard_Integer RootSectionSize() ;
126 void ReadRoot(TCollection_AsciiString& rootName,Standard_Integer& aRef,TCollection_AsciiString& aType) ;
127 Storage_Error EndReadRootSection() ;
128 Storage_Error BeginWriteRefSection() ;
129 void SetRefSectionSize(const Standard_Integer aSize) ;
130 void WriteReferenceType(const Standard_Integer reference,const Standard_Integer typeNum) ;
131 Storage_Error EndWriteRefSection() ;
132 Storage_Error BeginReadRefSection() ;
133 Standard_Integer RefSectionSize() ;
134 void ReadReferenceType(Standard_Integer& reference,Standard_Integer& typeNum) ;
135 Storage_Error EndReadRefSection() ;
136 Storage_Error BeginWriteDataSection() ;
137 void WritePersistentObjectHeader(const Standard_Integer aRef,const Standard_Integer aType) ;
138 void BeginWritePersistentObjectData() ;
139 void BeginWriteObjectData() ;
140 void EndWriteObjectData() ;
141 void EndWritePersistentObjectData() ;
142 Storage_Error EndWriteDataSection() ;
143 Storage_Error BeginReadDataSection() ;
144 void ReadPersistentObjectHeader(Standard_Integer& aRef,Standard_Integer& aType) ;
145 void BeginReadPersistentObjectData() ;
146 void BeginReadObjectData() ;
147 void EndReadObjectData() ;
148 void EndReadPersistentObjectData() ;
149 Storage_Error EndReadDataSection() ;
151 Storage_BaseDriver& PutReference(const Standard_Integer aValue) ;
152 Storage_BaseDriver& PutCharacter(const Standard_Character aValue) ;
153 Storage_BaseDriver& operator <<(const Standard_Character aValue)
155 return PutCharacter(aValue);
158 Storage_BaseDriver& PutExtCharacter(const Standard_ExtCharacter aValue) ;
159 Storage_BaseDriver& operator <<(const Standard_ExtCharacter aValue)
161 return PutExtCharacter(aValue);
164 Storage_BaseDriver& PutInteger(const Standard_Integer aValue) ;
165 Storage_BaseDriver& operator <<(const Standard_Integer aValue)
167 return PutInteger(aValue);
170 Storage_BaseDriver& PutBoolean(const Standard_Boolean aValue) ;
171 Storage_BaseDriver& operator <<(const Standard_Boolean aValue)
173 return PutBoolean(aValue);
176 Storage_BaseDriver& PutReal(const Standard_Real aValue) ;
177 Storage_BaseDriver& operator <<(const Standard_Real aValue)
179 return PutReal(aValue);
182 Storage_BaseDriver& PutShortReal(const Standard_ShortReal aValue) ;
183 Storage_BaseDriver& operator <<(const Standard_ShortReal aValue)
185 return PutShortReal(aValue);
188 Storage_BaseDriver& GetReference(Standard_Integer& aValue) ;
189 Storage_BaseDriver& GetCharacter(Standard_Character& aValue) ;
190 Storage_BaseDriver& operator >>(Standard_Character& aValue)
192 return GetCharacter(aValue);
195 Storage_BaseDriver& GetExtCharacter(Standard_ExtCharacter& aValue) ;
196 Storage_BaseDriver& operator >>(Standard_ExtCharacter& aValue)
198 return GetExtCharacter(aValue);
201 Storage_BaseDriver& GetInteger(Standard_Integer& aValue) ;
202 Storage_BaseDriver& operator >>(Standard_Integer& aValue)
204 return GetInteger(aValue);
207 Storage_BaseDriver& GetBoolean(Standard_Boolean& aValue) ;
208 Storage_BaseDriver& operator >>(Standard_Boolean& aValue)
210 return GetBoolean(aValue);
213 Storage_BaseDriver& GetReal(Standard_Real& aValue) ;
214 Storage_BaseDriver& operator >>(Standard_Real& aValue)
216 return GetReal(aValue);
219 Storage_BaseDriver& GetShortReal(Standard_ShortReal& aValue) ;
220 Storage_BaseDriver& operator >>(Standard_ShortReal& aValue)
222 return GetShortReal(aValue);
225 Storage_Error Close() ;
241 void ReadLine(TCollection_AsciiString& buffer) ;
242 void ReadWord(TCollection_AsciiString& buffer) ;
243 void ReadExtendedLine(TCollection_ExtendedString& buffer) ;
244 void WriteExtendedLine(const TCollection_ExtendedString& buffer) ;
245 void ReadChar(TCollection_AsciiString& buffer,const Standard_Integer rsize) ;
246 void ReadString(TCollection_AsciiString& buffer) ;
247 void FlushEndOfLine() ;
248 Storage_Error FindTag(const Standard_CString aTag) ;
259 static const Standard_CString MagicNumber() ;
264 //FSD_FStream myStream;
272 #pragma warning (default : 4275)
276 // other inline functions and methods (like "C++: function call" methods)