]> git.saurik.com Git - wxWidgets.git/blob - include/wx/zstream.h
Calling sizerItem->SetWindow shoudl set the minsize too.
[wxWidgets.git] / include / wx / zstream.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: zstream.h
3 // Purpose: Memory stream classes
4 // Author: Guilhem Lavaux
5 // Modified by: Mike Wetherell
6 // Created: 11/07/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_WXZSTREAM_H__
12 #define _WX_WXZSTREAM_H__
13
14 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
15 #pragma interface "zstream.h"
16 #endif
17
18 #include "wx/defs.h"
19
20 #if wxUSE_ZLIB && wxUSE_STREAMS
21
22 #include "wx/stream.h"
23
24 // Compression level
25 enum {
26 wxZ_DEFAULT_COMPRESSION = -1,
27 wxZ_NO_COMPRESSION = 0,
28 wxZ_BEST_SPEED = 1,
29 wxZ_BEST_COMPRESSION = 9
30 };
31
32 // Flags
33 enum {
34 wxZLIB_NO_HEADER = 1 // required for use in Gzip and Zip files
35 };
36
37 class WXDLLIMPEXP_BASE wxZlibInputStream: public wxFilterInputStream {
38 public:
39 wxZlibInputStream(wxInputStream& stream, int flags = 0);
40 virtual ~wxZlibInputStream();
41
42 char Peek() { return wxInputStream::Peek(); }
43 size_t GetSize() const { return wxInputStream::GetSize(); }
44
45 protected:
46 size_t OnSysRead(void *buffer, size_t size);
47 off_t OnSysTell() const { return m_pos; }
48
49 protected:
50 size_t m_z_size;
51 unsigned char *m_z_buffer;
52 struct z_stream_s *m_inflate;
53 off_t m_pos;
54
55 DECLARE_NO_COPY_CLASS(wxZlibInputStream)
56 };
57
58 class WXDLLIMPEXP_BASE wxZlibOutputStream: public wxFilterOutputStream {
59 public:
60 wxZlibOutputStream(wxOutputStream& stream, int level = -1, int flags = 0);
61 virtual ~wxZlibOutputStream();
62
63 void Sync() { DoFlush(false); }
64 size_t GetSize() const { return (size_t)m_pos; }
65
66 protected:
67 size_t OnSysWrite(const void *buffer, size_t size);
68 off_t OnSysTell() const { return m_pos; }
69
70 virtual void DoFlush(bool final);
71
72 protected:
73 size_t m_z_size;
74 unsigned char *m_z_buffer;
75 struct z_stream_s *m_deflate;
76 off_t m_pos;
77
78 DECLARE_NO_COPY_CLASS(wxZlibOutputStream)
79 };
80
81 #endif
82 // wxUSE_ZLIB && wxUSE_STREAMS
83
84 #endif
85 // _WX_WXZSTREAM_H__
86