bump product version to 4.1.6.2
[LibreOffice.git] / hwpfilter / source / hiodev.h
blobac0ded73bde730c82d10f850f16881b03b01e13a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 /**
21 * hwpio.h
22 * (C) 1999 Mizi Research, All rights are reserved
25 #ifndef _HIODEV_H_
26 #define _HIODEV_H_
28 #include <stdio.h>
29 #include "hwplib.h"
30 /**
31 * @short Abstract IO class
33 class DLLEXPORT HIODev
35 protected:
36 bool compressed;
37 virtual void init();
38 public:
39 HIODev();
40 virtual ~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 );
60 struct gz_stream;
62 /* ÆÄÀÏ ÀÔÃâ·Â ÀåÄ¡ */
64 /**
65 * This controls the HStream given by constructor
66 * @short Stream IO device
68 class HStreamIODev : public HIODev
70 private:
71 /* zlibÀ¸·Î ¾ÐÃàÀ» Ç®±â À§ÇÑ ÀÚ·á ±¸Á¶ */
72 gz_stream *_gzfp;
73 HStream& _stream;
74 public:
75 HStreamIODev(HStream& stream);
76 virtual ~HStreamIODev();
77 /**
78 * Check whether the stream is available
80 virtual bool open();
81 /**
82 * Free stream object
84 virtual void close();
85 /**
86 * If the stream is gzipped, flush the stream.
88 virtual void flush();
89 /**
90 * Not implemented.
92 virtual int state() const;
93 /**
94 * Set whether the stream is compressed or not
96 virtual bool setCompressed( bool );
97 /**
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 );
120 protected:
122 * Initialize this object
124 virtual void init();
127 /* ¸Þ¸ð¸® ÀÔÃâ·Â ÀåÄ¡ */
129 * The HMemIODev class controls the Input/Output device.
130 * @short Memory IO device
132 class HMemIODev : public HIODev
134 uchar *ptr;
135 int pos, length;
136 public:
137 HMemIODev(char *s, int len);
138 virtual ~HMemIODev();
140 virtual bool open();
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 );
154 protected:
155 virtual void init();
157 #endif /* _HIODEV_H_*/
159 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */