Bump for 3.6-28
[LibreOffice.git] / hwpfilter / source / hiodev.h
blob8857321194a625a27d4f53c8910529c7dc3167ce
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 ************************************************************************/
29 /**
30 * hwpio.h
31 * (C) 1999 Mizi Research, All rights are reserved
34 #ifndef _HIODEV_H_
35 #define _HIODEV_H_
37 #include <stdio.h>
38 #include "hwplib.h"
39 /**
40 * @short Abstract IO class
42 class DLLEXPORT HIODev
44 protected:
45 bool compressed;
46 virtual void init();
47 public:
48 HIODev();
49 virtual ~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 );
69 struct gz_stream;
71 /* ÆÄÀÏ ÀÔÃâ·Â ÀåÄ¡ */
73 /**
74 * This controls the HStream given by constructor
75 * @short Stream IO device
77 class HStreamIODev : public HIODev
79 private:
80 /* zlibÀ¸·Î ¾ÐÃàÀ» Ç®±â À§ÇÑ ÀÚ·á ±¸Á¶ */
81 gz_stream *_gzfp;
82 HStream& _stream;
83 public:
84 HStreamIODev(HStream& stream);
85 virtual ~HStreamIODev();
86 /**
87 * Check whether the stream is available
89 virtual bool open();
90 /**
91 * Free stream object
93 virtual void close();
94 /**
95 * If the stream is gzipped, flush the stream.
97 virtual void flush();
98 /**
99 * Not implemented.
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 );
129 protected:
131 * Initialize this object
133 virtual void init();
136 /* ¸Þ¸ð¸® ÀÔÃâ·Â ÀåÄ¡ */
138 * The HMemIODev class controls the Input/Output device.
139 * @short Memory IO device
141 class HMemIODev : public HIODev
143 uchar *ptr;
144 int pos, length;
145 public:
146 HMemIODev(char *s, int len);
147 virtual ~HMemIODev();
149 virtual bool open();
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 );
163 protected:
164 virtual void init();
166 #endif /* _HIODEV_H_*/
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */