1999-07-07 18:04:58 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: zipstream.h
|
|
|
|
// Purpose: wxZipInputStream for reading files from ZIP archive
|
|
|
|
// Author: Vaclav Slavik
|
|
|
|
// Copyright: (c) 1999 Vaclav Slavik
|
2004-05-23 10:56:36 -04:00
|
|
|
// Licence: wxWidgets licence
|
1999-07-07 18:04:58 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __ZIPSTREAM_H__
|
|
|
|
#define __ZIPSTREAM_H__
|
|
|
|
|
2003-08-09 08:38:21 -04:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
1999-08-08 09:58:24 -04:00
|
|
|
#pragma interface "zipstrm.h"
|
1999-07-07 18:04:58 -04:00
|
|
|
#endif
|
|
|
|
|
1999-07-11 11:56:57 -04:00
|
|
|
#include "wx/defs.h"
|
1999-07-07 18:04:58 -04:00
|
|
|
|
1999-07-11 11:56:57 -04:00
|
|
|
#if wxUSE_STREAMS && wxUSE_ZIPSTREAM && wxUSE_ZLIB
|
|
|
|
|
|
|
|
#include "wx/stream.h"
|
1999-07-07 18:04:58 -04:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
// wxZipInputStream
|
|
|
|
// This class is input stream from ZIP archive. The archive
|
|
|
|
// must be local file (accessible via FILE*)
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
2003-07-01 21:59:24 -04:00
|
|
|
class WXDLLIMPEXP_BASE wxZipInputStream : public wxInputStream
|
1999-07-07 18:04:58 -04:00
|
|
|
{
|
2000-07-15 15:51:35 -04:00
|
|
|
public:
|
|
|
|
wxZipInputStream(const wxString& archive, const wxString& file);
|
|
|
|
// archive is name of .zip archive, file is name of file to be extracted.
|
|
|
|
// Remember that archive must be local file accesible via fopen, fread functions!
|
|
|
|
~wxZipInputStream();
|
|
|
|
|
|
|
|
virtual size_t GetSize() const {return m_Size;}
|
|
|
|
virtual bool Eof() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual size_t OnSysRead(void *buffer, size_t bufsize);
|
|
|
|
virtual off_t OnSysSeek(off_t seek, wxSeekMode mode);
|
|
|
|
virtual off_t OnSysTell() const {return m_Pos;}
|
|
|
|
|
|
|
|
private:
|
|
|
|
size_t m_Size;
|
|
|
|
off_t m_Pos;
|
|
|
|
|
|
|
|
// this void* is handle of archive . I'm sorry it is void and not proper
|
|
|
|
// type but I don't want to make unzip.h header public.
|
|
|
|
void *m_Archive;
|
2003-01-02 18:38:11 -05:00
|
|
|
|
|
|
|
DECLARE_NO_COPY_CLASS(wxZipInputStream)
|
1999-07-07 18:04:58 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
1999-07-11 11:56:57 -04:00
|
|
|
#endif
|
|
|
|
// wxUSE_STREAMS && wxUSE_ZIPSTREAM && wxUSE_ZLIB
|
1999-07-07 18:04:58 -04:00
|
|
|
|
1999-07-11 11:56:57 -04:00
|
|
|
#endif
|
|
|
|
// __ZIPSTREAM_H__
|