merge the formfield patch from ooo-build
[ooovba.git] / hwpfilter / source / hiodev.h
blob429867138a5b4bef912092620e1753e760ab8e76
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: hiodev.h,v $
10 * $Revision: 1.5 $
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 ************************************************************************/
31 /**
32 * hwpio.h
33 * (C) 1999 Mizi Research, All rights are reserved
35 * $Id: hiodev.h,v 1.5 2008-04-10 12:05:55 rt Exp $
38 #ifndef _HIODEV_H_
39 #define _HIODEV_H_
41 #ifdef __GNUG__
42 #pragma interface
43 #endif
45 #include <stdio.h>
46 #include "hwplib.h"
47 /**
48 * @short Abstract IO class
50 class DLLEXPORT HIODev
52 protected:
53 bool compressed;
54 virtual void init();
55 public:
56 HIODev();
57 virtual ~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 );
77 struct gz_stream;
79 /* ÆÄÀÏ ÀÔÃâ·Â ÀåÄ¡ */
81 /**
82 * This controls the HStream given by constructor
83 * @short Stream IO device
85 class HStreamIODev : public HIODev
87 private:
88 /* zlibÀ¸·Î ¾ÐÃàÀ» Ç®±â À§ÇÑ ÀÚ·á ±¸Á¶ */
89 gz_stream *_gzfp;
90 HStream& _stream;
91 public:
92 HStreamIODev(HStream& stream);
93 virtual ~HStreamIODev();
94 /**
95 * Check whether the stream is available
97 virtual bool open();
98 /**
99 * Free stream object
101 virtual void close();
103 * If the stream is gzipped, flush the stream.
105 virtual void flush();
107 * Not implemented.
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 );
137 protected:
139 * Initialize this object
141 virtual void init();
144 /* ¸Þ¸ð¸® ÀÔÃâ·Â ÀåÄ¡ */
146 * The HMemIODev class controls the Input/Output device.
147 * @short Memory IO device
149 class HMemIODev : public HIODev
151 uchar *ptr;
152 int pos, length;
153 public:
154 HMemIODev(char *s, int len);
155 virtual ~HMemIODev();
157 virtual bool open();
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 );
171 protected:
172 virtual void init();
174 #endif /* _HIODEV_H_*/