]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/zstream.h
Ensure that the overall table border doesn't get overdrawn by cell borders with a...
[wxWidgets.git] / interface / wx / zstream.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: zstream.h
e54c96f1 3// Purpose: interface of wxZlibOutputStream
23324ae1 4// Author: wxWidgets team
526954c5 5// Licence: wxWindows licence
23324ae1
FM
6/////////////////////////////////////////////////////////////////////////////
7
e7d0a28b
FM
8
9/// Compression level
10enum wxZlibCompressionLevels {
11 wxZ_DEFAULT_COMPRESSION = -1,
12 wxZ_NO_COMPRESSION = 0,
13 wxZ_BEST_SPEED = 1,
14 wxZ_BEST_COMPRESSION = 9
15};
16
17/// Flags
18enum wxZLibFlags {
19 wxZLIB_NO_HEADER = 0, //!< raw deflate stream, no header or checksum
20 wxZLIB_ZLIB = 1, //!< zlib header and checksum
21 wxZLIB_GZIP = 2, //!< gzip header and checksum, requires zlib 1.2.1+
22 wxZLIB_AUTO = 3 //!< autodetect header zlib or gzip
23};
24
25
23324ae1
FM
26/**
27 @class wxZlibOutputStream
7c913512 28
e7d0a28b
FM
29 This stream compresses all data written to it.
30
31 The compressed output can be in zlib or gzip format.
23324ae1
FM
32 Note that writing the gzip format requires zlib version 1.2.1 or greater
33 (the builtin version does support gzip format).
7c913512 34
e7d0a28b
FM
35 The stream is not seekable, wxOutputStream::SeekO() returns
36 ::wxInvalidOffset.
7c913512 37
23324ae1 38 @library{wxbase}
0801f345 39 @category{archive,streams}
7c913512 40
e54c96f1 41 @see wxOutputStream, wxZlibInputStream
23324ae1
FM
42*/
43class wxZlibOutputStream : public wxFilterOutputStream
44{
45public:
46 //@{
47 /**
e7d0a28b
FM
48 Creates a new write-only compressed stream.
49
50 @a level means level of compression. It is number between 0 and 9
51 (including these values) where 0 means no compression and 9 best but
52 slowest compression. -1 is default value (currently equivalent to 6).
53
23324ae1
FM
54 If the parent stream is passed as a pointer then the new filter stream
55 takes ownership of it. If it is passed by reference then it does not.
e7d0a28b 56
4cc4bfaf 57 The @a flags wxZLIB_ZLIB and wxZLIB_GZIP specify whether the output data
23324ae1 58 will be in zlib or gzip format. wxZLIB_ZLIB is the default.
e7d0a28b 59
4cc4bfaf 60 If @a flags is wxZLIB_NO_HEADER, then a raw deflate stream is output
e7d0a28b
FM
61 without either zlib or gzip headers. This is a lower level mode, which
62 is not usually used directly. It can be used to embed a raw deflate
63 stream in a higher level protocol.
64
65 The values of the ::wxZlibCompressionLevels and ::wxZLibFlags
66 enumerations can be used.
23324ae1
FM
67 */
68 wxZlibOutputStream(wxOutputStream& stream, int level = -1,
69 int flags = wxZLIB_ZLIB);
7c913512
FM
70 wxZlibOutputStream(wxOutputStream* stream, int level = -1,
71 int flags = wxZLIB_ZLIB);
23324ae1
FM
72 //@}
73
74 /**
75 Returns @true if zlib library in use can handle gzip compressed data.
76 */
77 static bool CanHandleGZip();
51acf83b
VZ
78
79 //@{
80 /**
81 Sets the dictionary to the specified chunk of data. This can improve
82 compression rate but note that the dictionary has to be the same when
83 you deflate the data as when you inflate the data, otherwise you
84 will inflate corrupted data.
85
86 Returns @true if the dictionary was successfully set.
87 */
88 bool SetDictionary(const char *data, const size_t datalen);
89 bool SetDictionary(const wxMemoryBuffer &buf);
90 //@}
23324ae1
FM
91};
92
93
e54c96f1 94
23324ae1
FM
95/**
96 @class wxZlibInputStream
7c913512 97
23324ae1
FM
98 This filter stream decompresses a stream that is in zlib or gzip format.
99 Note that reading the gzip format requires zlib version 1.2.1 or greater,
100 (the builtin version does support gzip format).
7c913512 101
e7d0a28b
FM
102 The stream is not seekable, wxInputStream::SeekI returns ::wxInvalidOffset.
103 Also wxStreamBase::GetSize() is not supported, it always returns 0.
7c913512 104
23324ae1 105 @library{wxbase}
0801f345 106 @category{archive,streams}
7c913512 107
e54c96f1 108 @see wxInputStream, wxZlibOutputStream.
23324ae1
FM
109*/
110class wxZlibInputStream : public wxFilterInputStream
111{
112public:
113 //@{
114 /**
115 If the parent stream is passed as a pointer then the new filter stream
116 takes ownership of it. If it is passed by reference then it does not.
e7d0a28b 117
4cc4bfaf 118 The @a flags wxZLIB_ZLIB and wxZLIB_GZIP specify whether the input data
23324ae1
FM
119 is in zlib or gzip format. If wxZLIB_AUTO is used, then zlib will
120 autodetect the stream type, this is the default.
e7d0a28b 121
4cc4bfaf 122 If @a flags is wxZLIB_NO_HEADER, then the data is assumed to be a raw
23324ae1
FM
123 deflate stream without either zlib or gzip headers. This is a lower level
124 mode, which is not usually used directly. It can be used to read a raw
125 deflate stream embedded in a higher level protocol.
e7d0a28b
FM
126
127 The values of the ::wxZLibFlags enumeration can be used.
23324ae1
FM
128 */
129 wxZlibInputStream(wxInputStream& stream, int flags = wxZLIB_AUTO);
e7d0a28b 130 wxZlibInputStream(wxInputStream* stream, int flags = wxZLIB_AUTO);
23324ae1
FM
131 //@}
132
133 /**
134 Returns @true if zlib library in use can handle gzip compressed data.
135 */
136 static bool CanHandleGZip();
51acf83b
VZ
137
138 //@{
139 /**
140 Sets the dictionary to the specified chunk of data. This can improve
141 compression rate but note that the dictionary has to be the same when
142 you deflate the data as when you inflate the data, otherwise you
143 will inflate corrupted data.
144
145 Returns @true if the dictionary was successfully set.
146 */
147 bool SetDictionary(const char *data, const size_t datalen);
148 bool SetDictionary(const wxMemoryBuffer &buf);
149 //@}
23324ae1 150};
e54c96f1 151