update dev300-m58
[ooovba.git] / hwpfilter / source / hgzip.h
bloba3a96dbf542d760a635ca3e193eeb6b21dcb6ced
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: hgzip.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 /* $Id: hgzip.h,v 1.5 2008-06-04 09:57:59 vg Exp $ */
33 #ifndef _HWPGZIP_H_
34 #define _HWPGZIP_H_
36 // DVO: add zlib/ prefix
37 #ifdef SYSTEM_ZLIB
38 #include <zlib.h>
39 #else
40 #include "zlib/zlib.h"
41 #endif
43 class HStream;
44 /**
45 * @short Structure for using z_stream
47 struct gz_stream
49 z_stream stream;
50 /**
51 * The error code of z_stream operation
53 int z_err;
54 /**
55 * EOF of the input file
57 int z_eof;
58 /**
59 * Stream
61 HStream* _inputstream;
62 /**
63 * Input buffer
65 Byte *inbuf;
66 /**
67 * Output buffer
69 Byte *outbuf;
70 /**
71 * Crc32 of uncompressed data
73 uLong crc;
74 /**
75 * Stream
77 char *msg;
78 /**
79 * It becomes one when the input file type is not gz file
81 int transparent;
82 /**
83 * 'w' or 'r'
85 char mode;
88 /**
89 * Opens a gzipped stream for reading.
90 * gz_open returns NULL if the stream could not be opened or if there was
91 * insufficient memory to allocate the (de)compression state; errno
92 * can be checked to distinguish the two cases (if errno is zero, the
93 * zlib error is Z_MEM_ERROR).
94 * @param _stream Reference of stream object having binary data.
96 gz_stream *gz_open ( HStream& _stream );
97 /**
98 * Flushes all pending output if necessary, closes the compressed stream
99 * and deallocates all the (de)compression state
101 int gz_close ( gz_stream *file );
103 * Reads the given number of uncompressed bytes from the compressed stream
104 * @param file Gzipped stream
105 * @param buf Buffer to have the data to be read
106 * @param len Length of data to be read
107 * @returns The number of bytes actually read
109 int gz_read ( gz_stream *file, voidp buf, unsigned len );
111 * Flushes all pending output into the compressed file
112 * gz_flush should be called only when strictly necessary because it can
113 * degrade compression
114 * @param flush Is as in the deflate() function
116 int gz_flush ( gz_stream *file, int flush );
117 #endif /* _HWPGZIP_H_ */