0023072: Eliminate compiler warnings (level 3) on Windows / MSVC++
[occt.git] / src / DDF / DDF_IOStream.hxx
CommitLineData
b311480e 1// Created on: 1997-08-22
2// Created by: DAUTRY Philippe
3// Copyright (c) 1997-1999 Matra Datavision
4// Copyright (c) 1999-2012 OPEN CASCADE SAS
5//
6// The content of this file is subject to the Open CASCADE Technology Public
7// License Version 6.5 (the "License"). You may not use the content of this file
8// except in compliance with the License. Please obtain a copy of the License
9// at http://www.opencascade.org and read it completely before using this file.
10//
11// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13//
14// The Original Code and all software distributed under the License is
15// distributed on an "AS IS" basis, without warranty of any kind, and the
16// Initial Developer hereby disclaims all such warranties, including without
17// limitation, any warranties of merchantability, fitness for a particular
18// purpose or non-infringement. Please see the License for the specific terms
19// and conditions governing the rights and limitations under the License.
7fd59977 20
21// This file has been written using FSD_File.hxx as template.
22// This is a specific adaptation for Draw use (save & restore commands).
23// It is not sure at all this code is portable on any other plateform than
24// SUN OS. Don't use it anywhere else.
25// Thanks for comprehension. (22 august 97)
26
27
28#ifndef DDF_IOStream_HeaderFile
29#define DDF_IOStream_HeaderFile
30
7fd59977 31#include <stdio.h>
32
33#ifndef _Storage_BaseDriver_HeaderFile
34#include <Storage_BaseDriver.hxx>
35#endif
36#ifndef _Storage_Error_HeaderFile
37#include <Storage_Error.hxx>
38#endif
39#ifndef _Storage_OpenMode_HeaderFile
40#include <Storage_OpenMode.hxx>
41#endif
42#ifndef _Standard_Boolean_HeaderFile
43#include <Standard_Boolean.hxx>
44#endif
45#ifndef _Standard_Integer_HeaderFile
46#include <Standard_Integer.hxx>
47#endif
48#ifndef _Standard_Character_HeaderFile
49#include <Standard_Character.hxx>
50#endif
51#ifndef _Standard_ExtCharacter_HeaderFile
52#include <Standard_ExtCharacter.hxx>
53#endif
54#ifndef _Standard_Real_HeaderFile
55#include <Standard_Real.hxx>
56#endif
57#ifndef _Standard_ShortReal_HeaderFile
58#include <Standard_ShortReal.hxx>
59#endif
60#ifndef _Standard_CString_HeaderFile
61#include <Standard_CString.hxx>
62#endif
63#include <Storage_Position.hxx>
64
65class Storage_StreamTypeMismatchError;
66class Storage_StreamFormatError;
67class Storage_StreamWriteError;
68class Storage_StreamExtCharParityError;
69
70class TColStd_SequenceOfExtendedString;
71
72#ifndef Standard_EXPORT
73#ifdef WNT
74#define Standard_EXPORT __declspec(dllexport)
75#else
76#define Standard_EXPORT
77#endif
78#endif
79#ifdef WNT
80#pragma warning (disable : 4275)
81#endif
82
83class Standard_EXPORT DDF_IOStream : public Storage_BaseDriver {
84
85public:
86
87 // Methods PUBLIC
88 //
89DDF_IOStream();
90 Storage_Error Open(const TCollection_AsciiString& aName,const Storage_OpenMode aMode) ;
91 Storage_Error Open(istream* anIStream) ;
92 Storage_Error Open(ostream* anOStream) ;
93 Standard_Boolean IsEnd() ;
94 Storage_Position Tell() { return -1; }
95static Storage_Error IsGoodFileType(istream* anIStream) ;
96 Storage_Error BeginWriteInfoSection() ;
97 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) ;
98 Storage_Error EndWriteInfoSection() ;
99 Storage_Error BeginReadInfoSection() ;
100 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) ;
101 Storage_Error EndReadInfoSection() ;
102 Storage_Error BeginWriteCommentSection() ;
103 void WriteComment(const TColStd_SequenceOfExtendedString& userComments) ;
104 Storage_Error EndWriteCommentSection() ;
105 Storage_Error BeginReadCommentSection() ;
106 void ReadComment(TColStd_SequenceOfExtendedString& userComments) ;
107 Storage_Error EndReadCommentSection() ;
108 Storage_Error BeginWriteTypeSection() ;
109 void SetTypeSectionSize(const Standard_Integer aSize) ;
110 void WriteTypeInformations(const Standard_Integer typeNum,const TCollection_AsciiString& typeName) ;
111 Storage_Error EndWriteTypeSection() ;
112 Storage_Error BeginReadTypeSection() ;
113 Standard_Integer TypeSectionSize() ;
114 void ReadTypeInformations(Standard_Integer& typeNum,TCollection_AsciiString& typeName) ;
115 Storage_Error EndReadTypeSection() ;
116 Storage_Error BeginWriteRootSection() ;
117 void SetRootSectionSize(const Standard_Integer aSize) ;
118 void WriteRoot(const TCollection_AsciiString& rootName,const Standard_Integer aRef,const TCollection_AsciiString& aType) ;
119 Storage_Error EndWriteRootSection() ;
120 Storage_Error BeginReadRootSection() ;
121 Standard_Integer RootSectionSize() ;
122 void ReadRoot(TCollection_AsciiString& rootName,Standard_Integer& aRef,TCollection_AsciiString& aType) ;
123 Storage_Error EndReadRootSection() ;
124 Storage_Error BeginWriteRefSection() ;
125 void SetRefSectionSize(const Standard_Integer aSize) ;
126 void WriteReferenceType(const Standard_Integer reference,const Standard_Integer typeNum) ;
127 Storage_Error EndWriteRefSection() ;
128 Storage_Error BeginReadRefSection() ;
129 Standard_Integer RefSectionSize() ;
130 void ReadReferenceType(Standard_Integer& reference,Standard_Integer& typeNum) ;
131 Storage_Error EndReadRefSection() ;
132 Storage_Error BeginWriteDataSection() ;
133 void WritePersistentObjectHeader(const Standard_Integer aRef,const Standard_Integer aType) ;
134 void BeginWritePersistentObjectData() ;
135 void BeginWriteObjectData() ;
136 void EndWriteObjectData() ;
137 void EndWritePersistentObjectData() ;
138 Storage_Error EndWriteDataSection() ;
139 Storage_Error BeginReadDataSection() ;
140 void ReadPersistentObjectHeader(Standard_Integer& aRef,Standard_Integer& aType) ;
141 void BeginReadPersistentObjectData() ;
142 void BeginReadObjectData() ;
143 void EndReadObjectData() ;
144 void EndReadPersistentObjectData() ;
145 Storage_Error EndReadDataSection() ;
146 void SkipObject() ;
147 Storage_BaseDriver& PutReference(const Standard_Integer aValue) ;
148 Storage_BaseDriver& PutCharacter(const Standard_Character aValue) ;
149 Storage_BaseDriver& operator <<(const Standard_Character aValue)
150{
151 return PutCharacter(aValue);
152}
153
154 Storage_BaseDriver& PutExtCharacter(const Standard_ExtCharacter aValue) ;
155 Storage_BaseDriver& operator <<(const Standard_ExtCharacter aValue)
156{
157 return PutExtCharacter(aValue);
158}
159
160 Storage_BaseDriver& PutInteger(const Standard_Integer aValue) ;
161 Storage_BaseDriver& operator <<(const Standard_Integer aValue)
162{
163 return PutInteger(aValue);
164}
165
166 Storage_BaseDriver& PutBoolean(const Standard_Boolean aValue) ;
167 Storage_BaseDriver& operator <<(const Standard_Boolean aValue)
168{
169 return PutBoolean(aValue);
170}
171
172 Storage_BaseDriver& PutReal(const Standard_Real aValue) ;
173 Storage_BaseDriver& operator <<(const Standard_Real aValue)
174{
175 return PutReal(aValue);
176}
177
178 Storage_BaseDriver& PutShortReal(const Standard_ShortReal aValue) ;
179 Storage_BaseDriver& operator <<(const Standard_ShortReal aValue)
180{
181 return PutShortReal(aValue);
182}
183
184 Storage_BaseDriver& GetReference(Standard_Integer& aValue) ;
185 Storage_BaseDriver& GetCharacter(Standard_Character& aValue) ;
186 Storage_BaseDriver& operator >>(Standard_Character& aValue)
187{
188 return GetCharacter(aValue);
189}
190
191 Storage_BaseDriver& GetExtCharacter(Standard_ExtCharacter& aValue) ;
192 Storage_BaseDriver& operator >>(Standard_ExtCharacter& aValue)
193{
194 return GetExtCharacter(aValue);
195}
196
197 Storage_BaseDriver& GetInteger(Standard_Integer& aValue) ;
198 Storage_BaseDriver& operator >>(Standard_Integer& aValue)
199{
200 return GetInteger(aValue);
201}
202
203 Storage_BaseDriver& GetBoolean(Standard_Boolean& aValue) ;
204 Storage_BaseDriver& operator >>(Standard_Boolean& aValue)
205{
206 return GetBoolean(aValue);
207}
208
209 Storage_BaseDriver& GetReal(Standard_Real& aValue) ;
210 Storage_BaseDriver& operator >>(Standard_Real& aValue)
211{
212 return GetReal(aValue);
213}
214
215 Storage_BaseDriver& GetShortReal(Standard_ShortReal& aValue) ;
216 Storage_BaseDriver& operator >>(Standard_ShortReal& aValue)
217{
218 return GetShortReal(aValue);
219}
220
221 Storage_Error Close() ;
222 void Destroy() ;
223~DDF_IOStream()
224{
225 Destroy();
226}
227
228
229
230
231
232
233protected:
234
235 // Methods PROTECTED
236 //
237 void ReadLine(TCollection_AsciiString& buffer) ;
238 void ReadWord(TCollection_AsciiString& buffer) ;
239 void ReadExtendedLine(TCollection_ExtendedString& buffer) ;
240 void WriteExtendedLine(const TCollection_ExtendedString& buffer) ;
241 void ReadChar(TCollection_AsciiString& buffer,const Standard_Integer rsize) ;
242 void ReadString(TCollection_AsciiString& buffer) ;
243 void FlushEndOfLine() ;
244 Storage_Error FindTag(const Standard_CString aTag) ;
245
246
247 // Fields PROTECTED
248 //
249
250
251private:
252
253 // Methods PRIVATE
254 //
255static const Standard_CString MagicNumber() ;
256
257
258 // Fields PRIVATE
259 //
260//FSD_FStream myStream;
261istream* myIStream;
262ostream* myOStream;
263
264
265};
266
267#ifdef WNT
268#pragma warning (default : 4275)
269#endif
270
271
272// other inline functions and methods (like "C++: function call" methods)
273//
274#endif