1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Streams for Gzip files
4 // Author: Mike Wetherell
6 // Copyright: (c) 2003 Mike Wetherell
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_GZSTREAM_H__
11 #define _WX_GZSTREAM_H__
13 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
14 #pragma interface "gzstream.h"
19 #if wxUSE_STREAMS && wxUSE_GZSTREAM && wxUSE_ZLIB
21 #include "wx/datetime.h"
24 /////////////////////////////////////////////////////////////////////////////
27 class WXDLLIMPEXP_BASE wxGzipInputStream
: public wxFilterInputStream
30 wxGzipInputStream(wxInputStream
& stream
, wxMBConv
& conv
= wxConvFile
);
31 virtual ~wxGzipInputStream();
33 wxString
GetName() const { return m_name
; }
36 wxDateTime
GetDateTime() const { return m_datetime
; }
39 virtual char Peek() { return wxInputStream::Peek(); }
40 virtual size_t GetSize() const { return m_decomp
? m_decomp
->GetSize() : 0; }
43 virtual size_t OnSysRead(void *buffer
, size_t size
);
44 virtual off_t
OnSysTell() const { return m_decomp
? m_decomp
->TellI() : 0; }
47 wxInputStream
*m_decomp
;
52 wxDateTime m_datetime
;
55 DECLARE_NO_COPY_CLASS(wxGzipInputStream
)
59 /////////////////////////////////////////////////////////////////////////////
62 class WXDLLIMPEXP_BASE wxGzipOutputStream
: public wxFilterOutputStream
65 wxGzipOutputStream(wxOutputStream
& stream
,
66 const wxString
& originalName
= wxEmptyString
,
68 wxMBConv
& conv
= wxConvFile
);
69 virtual ~wxGzipOutputStream();
74 virtual size_t OnSysWrite(const void *buffer
, size_t size
);
75 virtual off_t
OnSysTell() const { return m_comp
? m_comp
->TellO() : 0; }
78 wxOutputStream
*m_comp
;
81 DECLARE_NO_COPY_CLASS(wxGzipOutputStream
)
85 #endif // wxUSE_STREAMS && wxUSE_GZSTREAM && wxUSE_ZLIB
87 #endif // _WX_GZSTREAM_H__