added wxGzipIOStreams (patch 792932)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23949 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -765,6 +765,17 @@
|
||||
# endif
|
||||
#endif /* wxUSE_PROTOCOL */
|
||||
|
||||
#if wxUSE_GZSTREAM
|
||||
# if !wxUSE_ZLIB
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxUSE_GZSTREAM requires wxUSE_ZLIB"
|
||||
# else
|
||||
# undef wxUSE_ZLIB
|
||||
# define wxUSE_ZLIB 1
|
||||
# endif
|
||||
# endif
|
||||
#endif /* wxUSE_GZSTREAM */
|
||||
|
||||
/* have to test for wxUSE_HTML before wxUSE_FILESYSTEM */
|
||||
#if wxUSE_HTML
|
||||
# if !wxUSE_FILESYSTEM
|
||||
|
87
include/wx/gzstream.h
Normal file
87
include/wx/gzstream.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: gzstream.h
|
||||
// Purpose: Streams for Gzip files
|
||||
// Author: Mike Wetherell
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2003 Mike Wetherell
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GZSTREAM_H__
|
||||
#define _WX_GZSTREAM_H__
|
||||
|
||||
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
||||
#pragma interface "gzstream.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_STREAMS && wxUSE_GZSTREAM && wxUSE_ZLIB
|
||||
|
||||
#include "wx/datetime.h"
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// wxGzipInputStream
|
||||
|
||||
class WXDLLIMPEXP_BASE wxGzipInputStream : public wxFilterInputStream
|
||||
{
|
||||
public:
|
||||
wxGzipInputStream(wxInputStream& stream, wxMBConv& conv = wxConvFile);
|
||||
virtual ~wxGzipInputStream();
|
||||
|
||||
wxString GetName() const { return m_name; }
|
||||
|
||||
#if wxUSE_DATETIME
|
||||
wxDateTime GetDateTime() const { return m_datetime; }
|
||||
#endif
|
||||
|
||||
virtual char Peek() { return wxInputStream::Peek(); }
|
||||
virtual size_t GetSize() const { return m_decomp ? m_decomp->GetSize() : 0; }
|
||||
|
||||
protected:
|
||||
virtual size_t OnSysRead(void *buffer, size_t size);
|
||||
virtual off_t OnSysTell() const { return m_decomp ? m_decomp->TellI() : 0; }
|
||||
|
||||
private:
|
||||
wxInputStream *m_decomp;
|
||||
wxUint32 m_crc;
|
||||
wxString m_name;
|
||||
|
||||
#if wxUSE_DATETIME
|
||||
wxDateTime m_datetime;
|
||||
#endif
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxGzipInputStream)
|
||||
};
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// wxGzipOutputStream
|
||||
|
||||
class WXDLLIMPEXP_BASE wxGzipOutputStream : public wxFilterOutputStream
|
||||
{
|
||||
public:
|
||||
wxGzipOutputStream(wxOutputStream& stream,
|
||||
const wxString& originalName = wxEmptyString,
|
||||
int level = -1,
|
||||
wxMBConv& conv = wxConvFile);
|
||||
virtual ~wxGzipOutputStream();
|
||||
|
||||
virtual void Sync();
|
||||
|
||||
protected:
|
||||
virtual size_t OnSysWrite(const void *buffer, size_t size);
|
||||
virtual off_t OnSysTell() const { return m_comp ? m_comp->TellO() : 0; }
|
||||
|
||||
private:
|
||||
wxOutputStream *m_comp;
|
||||
wxUint32 m_crc;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxGzipOutputStream)
|
||||
};
|
||||
|
||||
|
||||
#endif // wxUSE_STREAMS && wxUSE_GZSTREAM && wxUSE_ZLIB
|
||||
|
||||
#endif // _WX_GZSTREAM_H__
|
@@ -375,9 +375,12 @@
|
||||
#define wxUSE_ZIPSTREAM 1
|
||||
|
||||
// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by
|
||||
// wxUSE_LIBPNG.
|
||||
// wxUSE_LIBPNG and wxUSE_GZSTREAM.
|
||||
#define wxUSE_ZLIB 1
|
||||
|
||||
// Set to 1 to compile wxGzipInput/OutputStream classes. Requires wxUSE_ZLIB.
|
||||
#define wxUSE_GZSTREAM 1
|
||||
|
||||
// If enabled, the code written by Apple will be used to write, in a portable
|
||||
// way, float on the disk. See extended.c for the license which is different
|
||||
// from wxWindows one.
|
||||
|
@@ -395,9 +395,12 @@
|
||||
#define wxUSE_ZIPSTREAM 1
|
||||
|
||||
// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by
|
||||
// wxUSE_LIBPNG.
|
||||
// wxUSE_LIBPNG and wxUSE_GZSTREAM.
|
||||
#define wxUSE_ZLIB 1
|
||||
|
||||
// Set to 1 to compile wxGzipInput/OutputStream classes. Requires wxUSE_ZLIB.
|
||||
#define wxUSE_GZSTREAM 1
|
||||
|
||||
// If enabled, the code written by Apple will be used to write, in a portable
|
||||
// way, float on the disk. See extended.c for the license which is different
|
||||
// from wxWindows one.
|
||||
|
@@ -238,6 +238,9 @@
|
||||
// and make the library thread safe
|
||||
#define wxUSE_ZLIB 1
|
||||
// Use zlib for compression in streams and PNG code
|
||||
#define wxUSE_GZSTREAM 1
|
||||
// Set to 1 to compile wxGzipInput/OutputStream classes.
|
||||
// Requires wxUSE_ZLIB.
|
||||
#define wxUSE_IMAGE 1
|
||||
// Set to 1 for wxImage support (recommended).
|
||||
#define wxUSE_LIBPNG 1
|
||||
|
@@ -424,8 +424,11 @@
|
||||
#define wxUSE_ZIPSTREAM 1
|
||||
|
||||
// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by
|
||||
// wxUSE_LIBPNG.
|
||||
#define wxUSE_ZLIB 1
|
||||
// wxUSE_LIBPNG and wxUSE_GZSTREAM.
|
||||
#define wxUSE_ZLIB 1
|
||||
|
||||
// Set to 1 to compile wxGzipInput/OutputStream classes. Requires wxUSE_ZLIB.
|
||||
#define wxUSE_GZSTREAM 1
|
||||
|
||||
// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM)
|
||||
#define wxUSE_FS_INET 1
|
||||
|
Reference in New Issue
Block a user