1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 * (C) 1999 Mizi Research, All rights are reserved
31 * @short Abstract IO class
33 class DLLEXPORT HIODev
42 virtual bool open() = 0;
43 virtual void close() = 0;
44 virtual void flush() = 0;
45 virtual int state() const = 0;
46 /* gzip routine wrapper */
47 virtual bool setCompressed( bool ) = 0;
49 virtual int read1b() = 0;
50 virtual int read2b() = 0;
51 virtual long read4b() = 0;
52 virtual int readBlock( void *ptr
, int size
) = 0;
53 virtual int skipBlock( int size
) = 0;
55 virtual int read1b( void *ptr
, int nmemb
);
56 virtual int read2b( void *ptr
, int nmemb
);
57 virtual int read4b( void *ptr
, int nmemb
);
62 /* ÆÄÀÏ ÀÔÃâ·Â ÀåÄ¡ */
65 * This controls the HStream given by constructor
66 * @short Stream IO device
68 class HStreamIODev
: public HIODev
71 /* zlibÀ¸·Î ¾ÐÃàÀ» Ç®±â À§ÇÑ ÀÚ·á ±¸Á¶ */
75 HStreamIODev(HStream
& stream
);
76 virtual ~HStreamIODev();
78 * Check whether the stream is available
86 * If the stream is gzipped, flush the stream.
92 virtual int state() const;
94 * Set whether the stream is compressed or not
96 virtual bool setCompressed( bool );
98 * Read one byte from stream
100 using HIODev::read1b
;
101 virtual int read1b();
103 * Read 2 bytes from stream
105 using HIODev::read2b
;
106 virtual int read2b();
108 * Read 4 bytes from stream
110 using HIODev::read4b
;
111 virtual long read4b();
113 * Read some bytes from stream to given pointer as amount of size
115 virtual int readBlock( void *ptr
, int size
);
117 * Move current pointer of stream as amount of size
119 virtual int skipBlock( int size
);
122 * Initialize this object
127 /* ¸Þ¸ð¸® ÀÔÃâ·Â ÀåÄ¡ */
129 * The HMemIODev class controls the Input/Output device.
130 * @short Memory IO device
132 class HMemIODev
: public HIODev
137 HMemIODev(char *s
, int len
);
138 virtual ~HMemIODev();
141 virtual void close();
142 virtual void flush();
143 virtual int state() const;
144 /* gzip routine wrapper */
145 virtual bool setCompressed( bool );
146 using HIODev::read1b
;
147 virtual int read1b();
148 using HIODev::read2b
;
149 virtual int read2b();
150 using HIODev::read4b
;
151 virtual long read4b();
152 virtual int readBlock( void *ptr
, int size
);
153 virtual int skipBlock( int size
);
157 #endif /* _HIODEV_H_*/
159 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */