]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gzstream.h
renamed WX_DEFINE_ARRAY_NO_PTR in WX_DEFINE_ARRAY_PTR
[wxWidgets.git] / include / wx / gzstream.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: gzstream.h
3 // Purpose: Streams for Gzip files
4 // Author: Mike Wetherell
5 // RCS-ID: $Id$
6 // Copyright: (c) 2003 Mike Wetherell
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_GZSTREAM_H__
11 #define _WX_GZSTREAM_H__
12
13 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
14 #pragma interface "gzstream.h"
15 #endif
16
17 #include "wx/defs.h"
18
19 #if wxUSE_STREAMS && wxUSE_GZSTREAM && wxUSE_ZLIB
20
21 #include "wx/datetime.h"
22
23
24 /////////////////////////////////////////////////////////////////////////////
25 // wxGzipInputStream
26
27 class WXDLLIMPEXP_BASE wxGzipInputStream : public wxFilterInputStream
28 {
29 public:
30 wxGzipInputStream(wxInputStream& stream, wxMBConv& conv = wxConvFile);
31 virtual ~wxGzipInputStream();
32
33 wxString GetName() const { return m_name; }
34
35 #if wxUSE_DATETIME
36 wxDateTime GetDateTime() const { return m_datetime; }
37 #endif
38
39 virtual char Peek() { return wxInputStream::Peek(); }
40 virtual size_t GetSize() const { return m_decomp ? m_decomp->GetSize() : 0; }
41
42 protected:
43 virtual size_t OnSysRead(void *buffer, size_t size);
44 virtual off_t OnSysTell() const { return m_decomp ? m_decomp->TellI() : 0; }
45
46 private:
47 wxInputStream *m_decomp;
48 wxUint32 m_crc;
49 wxString m_name;
50
51 #if wxUSE_DATETIME
52 wxDateTime m_datetime;
53 #endif
54
55 DECLARE_NO_COPY_CLASS(wxGzipInputStream)
56 };
57
58
59 /////////////////////////////////////////////////////////////////////////////
60 // wxGzipOutputStream
61
62 class WXDLLIMPEXP_BASE wxGzipOutputStream : public wxFilterOutputStream
63 {
64 public:
65 wxGzipOutputStream(wxOutputStream& stream,
66 const wxString& originalName = wxEmptyString,
67 int level = -1,
68 wxMBConv& conv = wxConvFile);
69 virtual ~wxGzipOutputStream();
70
71 virtual void Sync();
72
73 protected:
74 virtual size_t OnSysWrite(const void *buffer, size_t size);
75 virtual off_t OnSysTell() const { return m_comp ? m_comp->TellO() : 0; }
76
77 private:
78 wxOutputStream *m_comp;
79 wxUint32 m_crc;
80
81 DECLARE_NO_COPY_CLASS(wxGzipOutputStream)
82 };
83
84
85 #endif // wxUSE_STREAMS && wxUSE_GZSTREAM && wxUSE_ZLIB
86
87 #endif // _WX_GZSTREAM_H__