1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
31 * (C) 1999 Mizi Research, All rights are reserved
40 * @short Abstract IO class
42 class DLLEXPORT HIODev
51 virtual bool open() = 0;
52 virtual void close() = 0;
53 virtual void flush() = 0;
54 virtual int state() const = 0;
55 /* gzip routine wrapper */
56 virtual bool setCompressed( bool ) = 0;
58 virtual int read1b() = 0;
59 virtual int read2b() = 0;
60 virtual long read4b() = 0;
61 virtual int readBlock( void *ptr
, int size
) = 0;
62 virtual int skipBlock( int size
) = 0;
64 virtual int read1b( void *ptr
, int nmemb
);
65 virtual int read2b( void *ptr
, int nmemb
);
66 virtual int read4b( void *ptr
, int nmemb
);
71 /* ÆÄÀÏ ÀÔÃâ·Â ÀåÄ¡ */
74 * This controls the HStream given by constructor
75 * @short Stream IO device
77 class HStreamIODev
: public HIODev
80 /* zlibÀ¸·Î ¾ÐÃàÀ» Ç®±â À§ÇÑ ÀÚ·á ±¸Á¶ */
84 HStreamIODev(HStream
& stream
);
85 virtual ~HStreamIODev();
87 * Check whether the stream is available
95 * If the stream is gzipped, flush the stream.
101 virtual int state() const;
103 * Set whether the stream is compressed or not
105 virtual bool setCompressed( bool );
107 * Read one byte from stream
109 using HIODev::read1b
;
110 virtual int read1b();
112 * Read 2 bytes from stream
114 using HIODev::read2b
;
115 virtual int read2b();
117 * Read 4 bytes from stream
119 using HIODev::read4b
;
120 virtual long read4b();
122 * Read some bytes from stream to given pointer as amount of size
124 virtual int readBlock( void *ptr
, int size
);
126 * Move current pointer of stream as amount of size
128 virtual int skipBlock( int size
);
131 * Initialize this object
136 /* ¸Þ¸ð¸® ÀÔÃâ·Â ÀåÄ¡ */
138 * The HMemIODev class controls the Input/Output device.
139 * @short Memory IO device
141 class HMemIODev
: public HIODev
146 HMemIODev(char *s
, int len
);
147 virtual ~HMemIODev();
150 virtual void close();
151 virtual void flush();
152 virtual int state() const;
153 /* gzip routine wrapper */
154 virtual bool setCompressed( bool );
155 using HIODev::read1b
;
156 virtual int read1b();
157 using HIODev::read2b
;
158 virtual int read2b();
159 using HIODev::read4b
;
160 virtual long read4b();
161 virtual int readBlock( void *ptr
, int size
);
162 virtual int skipBlock( int size
);
166 #endif /* _HIODEV_H_*/
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */