]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gzstream.h
restored wxPluginLibrary::ms_classes handling code that was removed by mistake
[wxWidgets.git] / include / wx / gzstream.h
CommitLineData
6f96ac03
VZ
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
27class WXDLLIMPEXP_BASE wxGzipInputStream : public wxFilterInputStream
28{
29public:
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
42protected:
43 virtual size_t OnSysRead(void *buffer, size_t size);
44 virtual off_t OnSysTell() const { return m_decomp ? m_decomp->TellI() : 0; }
45
46private:
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
62class WXDLLIMPEXP_BASE wxGzipOutputStream : public wxFilterOutputStream
63{
64public:
65 wxGzipOutputStream(wxOutputStream& stream,
66 const wxString& originalName = wxEmptyString,
6da1ce61
JS
67#if wxUSE_DATETIME
68 const wxDateTime& originalTime = wxDateTime::Now(),
69#endif
6f96ac03
VZ
70 int level = -1,
71 wxMBConv& conv = wxConvFile);
72 virtual ~wxGzipOutputStream();
73
74 virtual void Sync();
75
76protected:
77 virtual size_t OnSysWrite(const void *buffer, size_t size);
78 virtual off_t OnSysTell() const { return m_comp ? m_comp->TellO() : 0; }
79
80private:
81 wxOutputStream *m_comp;
82 wxUint32 m_crc;
83
84 DECLARE_NO_COPY_CLASS(wxGzipOutputStream)
85};
86
87
88#endif // wxUSE_STREAMS && wxUSE_GZSTREAM && wxUSE_ZLIB
89
90#endif // _WX_GZSTREAM_H__