Impress Remote 1.0.5, tag sdremote-1.0.5
[LibreOffice.git] / hwpfilter / source / hgzip.h
blob4c166afd4682056f86cdfdc5262fd53cf12e776c
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 #ifndef _HWPGZIP_H_
21 #define _HWPGZIP_H_
23 // DVO: add zlib/ prefix
24 #ifdef SYSTEM_ZLIB
25 #include <zlib.h>
26 #else
27 #include "zlib/zlib.h"
28 #endif
30 class HStream;
31 /**
32 * @short Structure for using z_stream
34 struct gz_stream
36 z_stream stream;
37 /**
38 * The error code of z_stream operation
40 int z_err;
41 /**
42 * EOF of the input file
44 int z_eof;
45 /**
46 * Stream
48 HStream* _inputstream;
49 /**
50 * Input buffer
52 Byte *inbuf;
53 /**
54 * Output buffer
56 Byte *outbuf;
57 /**
58 * Crc32 of uncompressed data
60 uLong crc;
61 /**
62 * Stream
64 char *msg;
65 /**
66 * It becomes one when the input file type is not gz file
68 int transparent;
69 /**
70 * 'w' or 'r'
72 char mode;
75 /**
76 * Opens a gzipped stream for reading.
77 * gz_open returns NULL if the stream could not be opened or if there was
78 * insufficient memory to allocate the (de)compression state; errno
79 * can be checked to distinguish the two cases (if errno is zero, the
80 * zlib error is Z_MEM_ERROR).
81 * @param _stream Reference of stream object having binary data.
83 gz_stream *gz_open ( HStream& _stream );
84 /**
85 * Flushes all pending output if necessary, closes the compressed stream
86 * and deallocates all the (de)compression state
88 int gz_close ( gz_stream *file );
89 /**
90 * Reads the given number of uncompressed bytes from the compressed stream
91 * @param file Gzipped stream
92 * @param buf Buffer to have the data to be read
93 * @param len Length of data to be read
94 * @returns The number of bytes actually read
96 int gz_read ( gz_stream *file, voidp buf, unsigned len );
97 /**
98 * Flushes all pending output into the compressed file
99 * gz_flush should be called only when strictly necessary because it can
100 * degrade compression
101 * @param flush Is as in the deflate() function
103 int gz_flush ( gz_stream *file, int flush );
104 #endif /* _HWPGZIP_H_ */
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */