fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / hwpfilter / source / hiodev.h
blob967be2081cfc88dc2b7414de161710a0d5dfe234
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 INCLUDED_HWPFILTER_SOURCE_HIODEV_H
26 #define INCLUDED_HWPFILTER_SOURCE_HIODEV_H
28 #include <sal/config.h>
30 #include <stdio.h>
32 #include <boost/scoped_ptr.hpp>
33 #include <sal/types.h>
35 #include "hwplib.h"
36 /**
37 * @short Abstract IO class
39 class DLLEXPORT HIODev
41 protected:
42 bool compressed;
43 virtual void init();
44 public:
45 HIODev();
46 virtual ~HIODev();
48 virtual bool open() = 0;
49 virtual void close() = 0;
50 virtual void flush() = 0;
51 virtual int state() const = 0;
52 /* gzip routine wrapper */
53 virtual bool setCompressed( bool ) = 0;
55 virtual bool read1b(unsigned char &out) = 0;
56 virtual bool read1b(char &out) = 0;
57 virtual bool read2b(unsigned short &out) = 0;
58 virtual bool read4b(unsigned int &out) = 0;
59 virtual bool read4b(int &out) = 0;
60 virtual int readBlock( void *ptr, int size ) = 0;
61 virtual int skipBlock( int size ) = 0;
63 int read1b( void *ptr, int nmemb );
64 int read2b( void *ptr, int nmemb );
65 int read4b( void *ptr, int nmemb );
68 struct gz_stream;
70 /* 파일 입출력 장치 */
72 /**
73 * This controls the HStream given by constructor
74 * @short Stream IO device
76 class HStreamIODev : public HIODev
78 private:
79 /* zlib으로 압축을 풀기 위한 자료 구조 */
80 boost::scoped_ptr<HStream> _stream;
81 gz_stream *_gzfp;
82 public:
83 HStreamIODev(HStream* stream);
84 virtual ~HStreamIODev();
85 /**
86 * Check whether the stream is available
88 virtual bool open() SAL_OVERRIDE;
89 /**
90 * Free stream object
92 virtual void close() SAL_OVERRIDE;
93 /**
94 * If the stream is gzipped, flush the stream.
96 virtual void flush() SAL_OVERRIDE;
97 /**
98 * Not implemented.
100 virtual int state() const SAL_OVERRIDE;
102 * Set whether the stream is compressed or not
104 virtual bool setCompressed( bool ) SAL_OVERRIDE;
106 * Read one byte from stream
108 using HIODev::read1b;
109 virtual bool read1b(unsigned char &out) SAL_OVERRIDE;
110 virtual bool read1b(char &out) SAL_OVERRIDE;
112 * Read 2 bytes from stream
114 using HIODev::read2b;
115 virtual bool read2b(unsigned short &out) SAL_OVERRIDE;
117 * Read 4 bytes from stream
119 using HIODev::read4b;
120 virtual bool read4b(unsigned int &out) SAL_OVERRIDE;
121 virtual bool read4b(int &out) SAL_OVERRIDE;
123 * Read some bytes from stream to given pointer as amount of size
125 virtual int readBlock( void *ptr, int size ) SAL_OVERRIDE;
127 * Move current pointer of stream as amount of size
129 virtual int skipBlock( int size ) SAL_OVERRIDE;
130 protected:
132 * Initialize this object
134 virtual void init() SAL_OVERRIDE;
137 /* 메모리 입출력 장치 */
139 * The HMemIODev class controls the Input/Output device.
140 * @short Memory IO device
142 class HMemIODev : public HIODev
144 uchar *ptr;
145 int pos, length;
146 public:
147 HMemIODev(char *s, int len);
148 virtual ~HMemIODev();
150 virtual bool open() SAL_OVERRIDE;
151 virtual void close() SAL_OVERRIDE;
152 virtual void flush() SAL_OVERRIDE;
153 virtual int state() const SAL_OVERRIDE;
154 /* gzip routine wrapper */
155 virtual bool setCompressed( bool ) SAL_OVERRIDE;
156 using HIODev::read1b;
157 virtual bool read1b(unsigned char &out) SAL_OVERRIDE;
158 virtual bool read1b(char &out) SAL_OVERRIDE;
159 using HIODev::read2b;
160 virtual bool read2b(unsigned short &out) SAL_OVERRIDE;
161 using HIODev::read4b;
162 virtual bool read4b(unsigned int &out) SAL_OVERRIDE;
163 virtual bool read4b(int &out) SAL_OVERRIDE;
164 virtual int readBlock( void *ptr, int size ) SAL_OVERRIDE;
165 virtual int skipBlock( int size ) SAL_OVERRIDE;
166 protected:
167 virtual void init() SAL_OVERRIDE;
169 #endif // INCLUDED_HWPFILTER_SOURCE_HIODEV_H
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */