1999-07-07 22:04:58 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: zipstream.h
|
|
|
|
// Purpose: wxZipInputStream for reading files from ZIP archive
|
|
|
|
// Author: Vaclav Slavik
|
|
|
|
// Copyright: (c) 1999 Vaclav Slavik
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1999-07-07 22:04:58 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __ZIPSTREAM_H__
|
|
|
|
#define __ZIPSTREAM_H__
|
|
|
|
|
2003-08-09 12:38:21 +00:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
1999-08-08 13:58:24 +00:00
|
|
|
#pragma interface "zipstrm.h"
|
1999-07-07 22:04:58 +00:00
|
|
|
#endif
|
|
|
|
|
1999-07-11 15:56:57 +00:00
|
|
|
#include "wx/defs.h"
|
1999-07-07 22:04:58 +00:00
|
|
|
|
2004-09-24 14:32:35 +00:00
|
|
|
#if wxUSE_STREAMS && wxUSE_ZIPSTREAM && wxUSE_ZLIB
|
1999-07-11 15:56:57 +00:00
|
|
|
|
|
|
|
#include "wx/stream.h"
|
1999-07-07 22:04:58 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
// wxZipInputStream
|
|
|
|
// This class is input stream from ZIP archive. The archive
|
|
|
|
// must be local file (accessible via FILE*)
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_BASE wxZipInputStream : public wxInputStream
|
1999-07-07 22:04:58 +00:00
|
|
|
{
|
2000-07-15 19:51:35 +00: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();
|
|
|
|
|
2004-11-10 21:10:30 +00:00
|
|
|
virtual wxFileOffset GetLength() const {return m_Size;}
|
2000-07-15 19:51:35 +00:00
|
|
|
virtual bool Eof() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual size_t OnSysRead(void *buffer, size_t bufsize);
|
2004-09-26 13:18:46 +00:00
|
|
|
virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode);
|
|
|
|
virtual wxFileOffset OnSysTell() const {return m_Pos;}
|
2000-07-15 19:51:35 +00:00
|
|
|
|
|
|
|
private:
|
2004-11-10 21:10:30 +00:00
|
|
|
wxFileOffset m_Size;
|
2004-09-26 13:18:46 +00:00
|
|
|
wxFileOffset m_Pos;
|
2000-07-15 19:51:35 +00:00
|
|
|
|
|
|
|
// 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 23:38:11 +00:00
|
|
|
|
|
|
|
DECLARE_NO_COPY_CLASS(wxZipInputStream)
|
1999-07-07 22:04:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-09-24 14:32:35 +00:00
|
|
|
#endif
|
|
|
|
// wxUSE_STREAMS && wxUSE_ZIPSTREAM && wxUSE_ZLIB
|
1999-07-07 22:04:58 +00:00
|
|
|
|
2004-09-24 14:32:35 +00:00
|
|
|
#endif
|
1999-07-11 15:56:57 +00:00
|
|
|
// __ZIPSTREAM_H__
|