1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Memory stream classes
4 // Author: Guilhem Lavaux
5 // Modified by: Mike Wetherell
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_WXZSTREAM_H__
12 #define _WX_WXZSTREAM_H__
14 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
15 #pragma interface "zstream.h"
20 #if wxUSE_ZLIB && wxUSE_STREAMS
22 #include "wx/stream.h"
26 wxZ_DEFAULT_COMPRESSION
= -1,
27 wxZ_NO_COMPRESSION
= 0,
29 wxZ_BEST_COMPRESSION
= 9
34 wxZLIB_NO_HEADER
= 1 // required for use in Gzip and Zip files
37 class WXDLLIMPEXP_BASE wxZlibInputStream
: public wxFilterInputStream
{
39 wxZlibInputStream(wxInputStream
& stream
, int flags
= 0);
40 virtual ~wxZlibInputStream();
42 char Peek() { return wxInputStream::Peek(); }
43 size_t GetSize() const { return wxInputStream::GetSize(); }
46 size_t OnSysRead(void *buffer
, size_t size
);
47 off_t
OnSysTell() const { return m_pos
; }
51 unsigned char *m_z_buffer
;
52 struct z_stream_s
*m_inflate
;
55 DECLARE_NO_COPY_CLASS(wxZlibInputStream
)
58 class WXDLLIMPEXP_BASE wxZlibOutputStream
: public wxFilterOutputStream
{
60 wxZlibOutputStream(wxOutputStream
& stream
, int level
= -1, int flags
= 0);
61 virtual ~wxZlibOutputStream();
63 void Sync() { DoFlush(false); }
64 size_t GetSize() const { return (size_t)m_pos
; }
67 size_t OnSysWrite(const void *buffer
, size_t size
);
68 off_t
OnSysTell() const { return m_pos
; }
70 virtual void DoFlush(bool final
);
74 unsigned char *m_z_buffer
;
75 struct z_stream_s
*m_deflate
;
78 DECLARE_NO_COPY_CLASS(wxZlibOutputStream
)
82 // wxUSE_ZLIB && wxUSE_STREAMS