]> git.saurik.com Git - wxWidgets.git/blame - include/wx/zstream.h
Applied patch [ 810585 ] wxTextCtrl::GetTextLine returns empty String
[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
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
34138703
JS
11#ifndef _WX_WXZSTREAM_H__
12#define _WX_WXZSTREAM_H__
79c3e0e1 13
12028905 14#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
af49c4b8 15#pragma interface "zstream.h"
79c3e0e1
GL
16#endif
17
124031d5 18#include "wx/defs.h"
ac57418f 19
ce4169a4 20#if wxUSE_ZLIB && wxUSE_STREAMS
ac57418f 21
ed58dbea 22#include "wx/stream.h"
79c3e0e1 23
0915d0b2
VZ
24// Compression level
25enum {
26 wxZ_DEFAULT_COMPRESSION = -1,
27 wxZ_NO_COMPRESSION = 0,
28 wxZ_BEST_SPEED = 1,
29 wxZ_BEST_COMPRESSION = 9
30};
31
32// Flags
33enum {
34 wxZLIB_NO_HEADER = 1 // required for use in Gzip and Zip files
35};
36
bddd7a8d 37class WXDLLIMPEXP_BASE wxZlibInputStream: public wxFilterInputStream {
79c3e0e1 38 public:
0915d0b2 39 wxZlibInputStream(wxInputStream& stream, int flags = 0);
79c3e0e1
GL
40 virtual ~wxZlibInputStream();
41
0915d0b2
VZ
42 char Peek() { return wxInputStream::Peek(); }
43 size_t GetSize() const { return wxInputStream::GetSize(); }
44
79c3e0e1 45 protected:
75ed1d15 46 size_t OnSysRead(void *buffer, size_t size);
0915d0b2 47 off_t OnSysTell() const { return m_pos; }
1678ad78
GL
48
49 protected:
79c3e0e1
GL
50 size_t m_z_size;
51 unsigned char *m_z_buffer;
856d2e52 52 struct z_stream_s *m_inflate;
0915d0b2 53 off_t m_pos;
22f3361e
VZ
54
55 DECLARE_NO_COPY_CLASS(wxZlibInputStream)
79c3e0e1
GL
56};
57
bddd7a8d 58class WXDLLIMPEXP_BASE wxZlibOutputStream: public wxFilterOutputStream {
79c3e0e1 59 public:
0915d0b2 60 wxZlibOutputStream(wxOutputStream& stream, int level = -1, int flags = 0);
79c3e0e1
GL
61 virtual ~wxZlibOutputStream();
62
0915d0b2
VZ
63 void Sync() { DoFlush(false); }
64 size_t GetSize() const { return (size_t)m_pos; }
79c3e0e1 65
79c3e0e1 66 protected:
75ed1d15 67 size_t OnSysWrite(const void *buffer, size_t size);
0915d0b2
VZ
68 off_t OnSysTell() const { return m_pos; }
69
70 virtual void DoFlush(bool final);
1678ad78
GL
71
72 protected:
79c3e0e1
GL
73 size_t m_z_size;
74 unsigned char *m_z_buffer;
856d2e52 75 struct z_stream_s *m_deflate;
0915d0b2 76 off_t m_pos;
22f3361e
VZ
77
78 DECLARE_NO_COPY_CLASS(wxZlibOutputStream)
79c3e0e1
GL
79};
80
81#endif
ce4169a4 82 // wxUSE_ZLIB && wxUSE_STREAMS
ac57418f
RR
83
84#endif
cc985fac
PA
85 // _WX_WXZSTREAM_H__
86