]> git.saurik.com Git - wxWidgets.git/blob - include/wx/zstream.h
speed optimizations: some functions now use wxString::Alloc, wxTextFile::Read
[wxWidgets.git] / include / wx / zstream.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: zstream.h
3 // Purpose: Memory stream classes
4 // Author: Guilhem Lavaux
5 // Modified by:
6 // Created: 11/07/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11 #ifndef __WXZSTREAM_H__
12 #define __WXZSTREAM_H__
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include <wx/stream.h>
19 #include "zlib.h"
20
21 class wxZlibInputStream: public wxFilterInputStream {
22 DECLARE_CLASS(wxZlibInputStream)
23 public:
24 wxZlibInputStream(wxInputStream& stream);
25 virtual ~wxZlibInputStream();
26
27 wxInputStream& Read(void *buffer, size_t size);
28 off_t SeekI(off_t pos, wxSeekMode mode = wxFromStart);
29 off_t TellI() const;
30
31 size_t LastRead() const { return m_lastread; }
32 bool Eof() const;
33
34 protected:
35 size_t m_lastread;
36 size_t m_z_size;
37 unsigned char *m_z_buffer;
38 bool m_eof;
39 struct z_stream_s m_inflate;
40 };
41
42 class wxZlibOutputStream: public wxFilterOutputStream {
43 DECLARE_CLASS(wxZlibOutputStream)
44 public:
45 wxZlibOutputStream(wxOutputStream& stream);
46 virtual ~wxZlibOutputStream();
47
48 wxOutputStream& Write(const void *buffer, size_t size);
49 off_t SeekO(off_t pos, wxSeekMode mode = wxFromStart);
50 off_t TellO() const;
51
52 size_t LastWrite() const { return m_lastwrite; }
53 bool Bad() const;
54
55 protected:
56 size_t m_lastwrite;
57 size_t m_z_size;
58 unsigned char *m_z_buffer;
59 bool m_bad;
60 struct z_stream_s m_deflate;
61 };
62
63 #endif