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
9 * $RCSfile: hiodev.h,v $
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 ************************************************************************/
33 * (C) 1999 Mizi Research, All rights are reserved
35 * $Id: hiodev.h,v 1.5 2008-04-10 12:05:55 rt Exp $
48 * @short Abstract IO class
50 class DLLEXPORT HIODev
59 virtual bool open() = 0;
60 virtual void close() = 0;
61 virtual void flush() = 0;
62 virtual int state() const = 0;
63 /* gzip routine wrapper */
64 virtual bool setCompressed( bool ) = 0;
66 virtual int read1b() = 0;
67 virtual int read2b() = 0;
68 virtual long read4b() = 0;
69 virtual int readBlock( void *ptr
, int size
) = 0;
70 virtual int skipBlock( int size
) = 0;
72 virtual int read1b( void *ptr
, int nmemb
);
73 virtual int read2b( void *ptr
, int nmemb
);
74 virtual int read4b( void *ptr
, int nmemb
);
79 /* ÆÄÀÏ ÀÔÃâ·Â ÀåÄ¡ */
82 * This controls the HStream given by constructor
83 * @short Stream IO device
85 class HStreamIODev
: public HIODev
88 /* zlibÀ¸·Î ¾ÐÃàÀ» Ç®±â À§ÇÑ ÀÚ·á ±¸Á¶ */
92 HStreamIODev(HStream
& stream
);
93 virtual ~HStreamIODev();
95 * Check whether the stream is available
101 virtual void close();
103 * If the stream is gzipped, flush the stream.
105 virtual void flush();
109 virtual int state() const;
111 * Set whether the stream is compressed or not
113 virtual bool setCompressed( bool );
115 * Read one byte from stream
117 using HIODev::read1b
;
118 virtual int read1b();
120 * Read 2 bytes from stream
122 using HIODev::read2b
;
123 virtual int read2b();
125 * Read 4 bytes from stream
127 using HIODev::read4b
;
128 virtual long read4b();
130 * Read some bytes from stream to given pointer as amount of size
132 virtual int readBlock( void *ptr
, int size
);
134 * Move current pointer of stream as amount of size
136 virtual int skipBlock( int size
);
139 * Initialize this object
144 /* ¸Þ¸ð¸® ÀÔÃâ·Â ÀåÄ¡ */
146 * The HMemIODev class controls the Input/Output device.
147 * @short Memory IO device
149 class HMemIODev
: public HIODev
154 HMemIODev(char *s
, int len
);
155 virtual ~HMemIODev();
158 virtual void close();
159 virtual void flush();
160 virtual int state() const;
161 /* gzip routine wrapper */
162 virtual bool setCompressed( bool );
163 using HIODev::read1b
;
164 virtual int read1b();
165 using HIODev::read2b
;
166 virtual int read2b();
167 using HIODev::read4b
;
168 virtual long read4b();
169 virtual int readBlock( void *ptr
, int size
);
170 virtual int skipBlock( int size
);
174 #endif /* _HIODEV_H_*/