| 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 _WX_WXZSTREAM_H__ |
| 12 | #define _WX_WXZSTREAM_H__ |
| 13 | |
| 14 | #if defined(__GNUG__) && !defined(__APPLE__) |
| 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 | class WXDLLEXPORT wxZlibInputStream: public wxFilterInputStream { |
| 25 | public: |
| 26 | wxZlibInputStream(wxInputStream& stream); |
| 27 | virtual ~wxZlibInputStream(); |
| 28 | |
| 29 | protected: |
| 30 | size_t OnSysRead(void *buffer, size_t size); |
| 31 | |
| 32 | protected: |
| 33 | size_t m_z_size; |
| 34 | unsigned char *m_z_buffer; |
| 35 | struct z_stream_s *m_inflate; |
| 36 | }; |
| 37 | |
| 38 | class WXDLLEXPORT wxZlibOutputStream: public wxFilterOutputStream { |
| 39 | public: |
| 40 | wxZlibOutputStream(wxOutputStream& stream, int level = -1); |
| 41 | virtual ~wxZlibOutputStream(); |
| 42 | |
| 43 | void Sync(); |
| 44 | |
| 45 | protected: |
| 46 | size_t OnSysWrite(const void *buffer, size_t size); |
| 47 | |
| 48 | protected: |
| 49 | size_t m_z_size; |
| 50 | unsigned char *m_z_buffer; |
| 51 | struct z_stream_s *m_deflate; |
| 52 | }; |
| 53 | |
| 54 | #endif |
| 55 | // wxUSE_ZLIB && wxUSE_STREAMS |
| 56 | |
| 57 | #endif |
| 58 | // _WX_WXZSTREAM_H__ |
| 59 | |