1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 // eigene Klasse fuer IO, die die systemunabhaengige Darstellung
31 // uebernimmt (bytes dreht, Character konvertiert)
32 // das Schreiben erfolgt aus Effizienzgruenden binaer
44 #include <sys/types.h>
48 #ifndef _KEYCOD_HXX //autogen
49 #include <vcl/keycod.hxx>
52 #ifndef _STREAM_HXX //autogen
53 #include <tools/stream.hxx>
67 // ctor oeffnet File im BinearMode, dtor schliesst es
68 BinaryFile(const String &, int eOpenMode);
73 operator int() const { return fd; }
79 SvFileStream aStr
; //$ ifstream
81 // Stream wird im entsprechenden Mode erzeugt.
82 SwIOin(const String
&rFilename
, StreamMode nMode
=
83 STREAM_READ
| STREAM_NOCREATE
);
85 SwIOin
& operator>>(char& val
);
86 SwIOin
& operator>>(unsigned char& val
);
87 SwIOin
& operator>>(char* val
);
88 SwIOin
& operator>>(unsigned char* val
);
89 SwIOin
& operator>>(short& val
);
90 SwIOin
& operator>>(unsigned short& val
);
91 SwIOin
& operator>>(long& val
);
92 SwIOin
& operator>>(unsigned long& val
);
94 KeyCode
ReadKeyCode();
95 // kann erweitert werden fuer weitere Arrays von
96 // Basistypen; nLen ist die Anzahl der Elemente
97 SwIOin
& Read(char *buf
, unsigned nLen
);
99 int operator!() { return aStr
.GetError() != SVSTREAM_OK
; }
100 SvFileStream
&operator()() {
107 void _write(const char *buf
, unsigned size
);
108 SvFileStream aStr
; //$ ofstream
110 // Stream wird im entsprechenden Mode erzeugt.
111 SwIOout( const String
&rFilename
, StreamMode nMode
=
112 STREAM_WRITE
| STREAM_NOCREATE
);
113 SwIOout
& operator<<(char val
);
114 SwIOout
& operator<<(unsigned char val
);
115 SwIOout
& operator<<(char* val
);
116 SwIOout
& operator<<(unsigned char* val
);
117 SwIOout
& operator<<(short val
);
118 SwIOout
& operator<<(unsigned short val
);
119 SwIOout
& operator<<(long val
);
120 SwIOout
& operator<<(unsigned long val
);
121 SwIOout
& operator<<(const String
&);
122 SwIOout
& operator<<(const KeyCode
&);
123 // kann erweitert werden fuer weitere Arrays von
124 // Basistypen; nLen ist die Anzahl der Elemente
125 SwIOout
& Write(const char *buf
, unsigned nLen
);
127 int operator!() { return aStr
.GetError() != SVSTREAM_OK
; }
128 SvFileStream
&operator()() {
136 SvFileStream aStr
; //$ fstream
139 // Stream wird im entsprechenden Mode erzeugt.
140 SwIOinout(const String
&rFilename
, StreamMode nMode
=
141 STREAM_READWRITE
| STREAM_NOCREATE
);
143 SwIOinout
& operator>>(char& val
);
144 SwIOinout
& operator>>(unsigned char& val
);
145 SwIOinout
& operator>>(char* val
);
146 SwIOinout
& operator>>(unsigned char* val
);
147 SwIOinout
& operator>>(short& val
);
148 SwIOinout
& operator>>(unsigned short& val
);
149 SwIOinout
& operator>>(long& val
);
150 SwIOinout
& operator>>(unsigned long& val
);
152 KeyCode
ReadKeyCode();
153 // kann erweitert werden fuer weitere Arrays von
154 // Basistypen; nLen ist die Anzahl der Elemente
155 SwIOinout
& Read(char *buf
, unsigned nLen
);
156 SwIOinout
& Read(unsigned short *buf
, unsigned nLen
);
158 SwIOinout
& operator<<(char val
);
159 SwIOinout
& operator<<(unsigned char val
);
160 SwIOinout
& operator<<(char* val
);
161 SwIOinout
& operator<<(unsigned char* val
);
162 SwIOinout
& operator<<(short val
);
163 SwIOinout
& operator<<(unsigned short val
);
164 SwIOinout
& operator<<(long val
);
165 SwIOinout
& operator<<(unsigned long val
);
166 SwIOinout
& operator<<(const String
&);
167 SwIOinout
& operator<<(const KeyCode
&);
168 // kann erweitert werden fuer weitere Arrays von
169 // Basistypen; nLen ist die Anzahl der Elemente
170 SwIOinout
& Write(const char *buf
, unsigned nLen
);
172 int operator!() { return aStr
.GetError() != SVSTREAM_OK
; }
173 SvFileStream
&operator()() {
182 } //namespace binfilter