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>
51 #include <tools/stream.hxx>
63 // ctor oeffnet File im BinearMode, dtor schliesst es
64 BinaryFile(const String &, int eOpenMode);
69 operator int() const { return fd; }
75 SvFileStream aStr
; //$ ifstream
77 // Stream wird im entsprechenden Mode erzeugt.
78 SwIOin(const String
&rFilename
, StreamMode nMode
=
79 STREAM_READ
| STREAM_NOCREATE
);
81 SwIOin
& operator>>(char& val
);
82 SwIOin
& operator>>(unsigned char& val
);
83 SwIOin
& operator>>(char* val
);
84 SwIOin
& operator>>(unsigned char* val
);
85 SwIOin
& operator>>(short& val
);
86 SwIOin
& operator>>(unsigned short& val
);
87 SwIOin
& operator>>(long& val
);
88 SwIOin
& operator>>(unsigned long& val
);
90 KeyCode
ReadKeyCode();
91 // kann erweitert werden fuer weitere Arrays von
92 // Basistypen; nLen ist die Anzahl der Elemente
93 SwIOin
& Read(char *buf
, unsigned nLen
);
95 int operator!() { return aStr
.GetError() != SVSTREAM_OK
; }
96 SvFileStream
&operator()() {
103 void _write(const char *buf
, unsigned size
);
104 SvFileStream aStr
; //$ ofstream
106 // Stream wird im entsprechenden Mode erzeugt.
107 SwIOout( const String
&rFilename
, StreamMode nMode
=
108 STREAM_WRITE
| STREAM_NOCREATE
);
109 SwIOout
& operator<<(char val
);
110 SwIOout
& operator<<(unsigned char val
);
111 SwIOout
& operator<<(char* val
);
112 SwIOout
& operator<<(unsigned char* val
);
113 SwIOout
& operator<<(short val
);
114 SwIOout
& operator<<(unsigned short val
);
115 SwIOout
& operator<<(long val
);
116 SwIOout
& operator<<(unsigned long val
);
117 SwIOout
& operator<<(const String
&);
118 SwIOout
& operator<<(const KeyCode
&);
119 // kann erweitert werden fuer weitere Arrays von
120 // Basistypen; nLen ist die Anzahl der Elemente
121 SwIOout
& Write(const char *buf
, unsigned nLen
);
123 int operator!() { return aStr
.GetError() != SVSTREAM_OK
; }
124 SvFileStream
&operator()() {
132 SvFileStream aStr
; //$ fstream
135 // Stream wird im entsprechenden Mode erzeugt.
136 SwIOinout(const String
&rFilename
, StreamMode nMode
=
137 STREAM_READWRITE
| STREAM_NOCREATE
);
139 SwIOinout
& operator>>(char& val
);
140 SwIOinout
& operator>>(unsigned char& val
);
141 SwIOinout
& operator>>(char* val
);
142 SwIOinout
& operator>>(unsigned char* val
);
143 SwIOinout
& operator>>(short& val
);
144 SwIOinout
& operator>>(unsigned short& val
);
145 SwIOinout
& operator>>(long& val
);
146 SwIOinout
& operator>>(unsigned long& val
);
148 KeyCode
ReadKeyCode();
149 // kann erweitert werden fuer weitere Arrays von
150 // Basistypen; nLen ist die Anzahl der Elemente
151 SwIOinout
& Read(char *buf
, unsigned nLen
);
152 SwIOinout
& Read(unsigned short *buf
, unsigned nLen
);
154 SwIOinout
& operator<<(char val
);
155 SwIOinout
& operator<<(unsigned char val
);
156 SwIOinout
& operator<<(char* val
);
157 SwIOinout
& operator<<(unsigned char* val
);
158 SwIOinout
& operator<<(short val
);
159 SwIOinout
& operator<<(unsigned short val
);
160 SwIOinout
& operator<<(long val
);
161 SwIOinout
& operator<<(unsigned long val
);
162 SwIOinout
& operator<<(const String
&);
163 SwIOinout
& operator<<(const KeyCode
&);
164 // kann erweitert werden fuer weitere Arrays von
165 // Basistypen; nLen ist die Anzahl der Elemente
166 SwIOinout
& Write(const char *buf
, unsigned nLen
);
168 int operator!() { return aStr
.GetError() != SVSTREAM_OK
; }
169 SvFileStream
&operator()() {