]> git.saurik.com Git - wxWidgets.git/blame - include/wx/zstream.h
added linear and concentric gradient fill functions (modified/fixed patch from Ryan...
[wxWidgets.git] / include / wx / zstream.h
CommitLineData
79c3e0e1
GL
1/////////////////////////////////////////////////////////////////////////////
2// Name: zstream.h
3// Purpose: Memory stream classes
4// Author: Guilhem Lavaux
0915d0b2 5// Modified by: Mike Wetherell
79c3e0e1
GL
6// Created: 11/07/98
7// RCS-ID: $Id$
8// Copyright: (c) Guilhem Lavaux
65571936 9// Licence: wxWindows licence
79c3e0e1 10/////////////////////////////////////////////////////////////////////////////
34138703
JS
11#ifndef _WX_WXZSTREAM_H__
12#define _WX_WXZSTREAM_H__
79c3e0e1 13
124031d5 14#include "wx/defs.h"
ac57418f 15
ce4169a4 16#if wxUSE_ZLIB && wxUSE_STREAMS
ac57418f 17
ed58dbea 18#include "wx/stream.h"
79c3e0e1 19
0915d0b2
VZ
20// Compression level
21enum {
22 wxZ_DEFAULT_COMPRESSION = -1,
23 wxZ_NO_COMPRESSION = 0,
24 wxZ_BEST_SPEED = 1,
25 wxZ_BEST_COMPRESSION = 9
26};
27
28// Flags
29enum {
4c68a102
VS
30#if WXWIN_COMPATIBILITY_2_4
31 wxZLIB_24COMPATIBLE = 4, // read v2.4.x data without error
32#endif
33 wxZLIB_NO_HEADER = 0, // raw deflate stream, no header or checksum
34 wxZLIB_ZLIB = 1, // zlib header and checksum
35 wxZLIB_GZIP = 2, // gzip header and checksum, requires zlib 1.2.1+
36 wxZLIB_AUTO = 3 // autodetect header zlib or gzip
0915d0b2
VZ
37};
38
bddd7a8d 39class WXDLLIMPEXP_BASE wxZlibInputStream: public wxFilterInputStream {
79c3e0e1 40 public:
4c68a102 41 wxZlibInputStream(wxInputStream& stream, int flags = wxZLIB_AUTO);
79c3e0e1
GL
42 virtual ~wxZlibInputStream();
43
0915d0b2 44 char Peek() { return wxInputStream::Peek(); }
588066b7 45 wxFileOffset GetLength() const { return wxInputStream::GetLength(); }
0915d0b2 46
4c68a102
VS
47 static bool CanHandleGZip();
48
79c3e0e1 49 protected:
75ed1d15 50 size_t OnSysRead(void *buffer, size_t size);
4004775e 51 wxFileOffset OnSysTell() const { return m_pos; }
1678ad78
GL
52
53 protected:
79c3e0e1
GL
54 size_t m_z_size;
55 unsigned char *m_z_buffer;
856d2e52 56 struct z_stream_s *m_inflate;
4004775e 57 wxFileOffset m_pos;
4c68a102
VS
58#if WXWIN_COMPATIBILITY_2_4
59 bool m_24compatibilty;
60#endif
22f3361e 61
4c68a102 62 DECLARE_NO_COPY_CLASS(wxZlibInputStream)
79c3e0e1
GL
63};
64
bddd7a8d 65class WXDLLIMPEXP_BASE wxZlibOutputStream: public wxFilterOutputStream {
79c3e0e1 66 public:
301deecc 67 wxZlibOutputStream(wxOutputStream& stream, int level = -1, int flags = wxZLIB_ZLIB);
8f0ff178 68 virtual ~wxZlibOutputStream() { Close(); }
79c3e0e1 69
0915d0b2 70 void Sync() { DoFlush(false); }
8f0ff178 71 bool Close();
588066b7 72 wxFileOffset GetLength() const { return m_pos; }
79c3e0e1 73
4c68a102
VS
74 static bool CanHandleGZip();
75
79c3e0e1 76 protected:
75ed1d15 77 size_t OnSysWrite(const void *buffer, size_t size);
4004775e 78 wxFileOffset OnSysTell() const { return m_pos; }
0915d0b2
VZ
79
80 virtual void DoFlush(bool final);
1678ad78
GL
81
82 protected:
79c3e0e1
GL
83 size_t m_z_size;
84 unsigned char *m_z_buffer;
856d2e52 85 struct z_stream_s *m_deflate;
4004775e 86 wxFileOffset m_pos;
22f3361e 87
4c68a102 88 DECLARE_NO_COPY_CLASS(wxZlibOutputStream)
79c3e0e1
GL
89};
90
91#endif
ce4169a4 92 // wxUSE_ZLIB && wxUSE_STREAMS
ac57418f
RR
93
94#endif
cc985fac
PA
95 // _WX_WXZSTREAM_H__
96