]>
Commit | Line | Data |
---|---|---|
5526e819 VS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: zipstream.h | |
3 | // Purpose: wxZipInputStream for reading files from ZIP archive | |
4 | // Author: Vaclav Slavik | |
5 | // Copyright: (c) 1999 Vaclav Slavik | |
6 | // Licence: wxWindows Licence | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | #ifndef __ZIPSTREAM_H__ | |
10 | #define __ZIPSTREAM_H__ | |
11 | ||
12028905 | 12 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
5279a24d | 13 | #pragma interface "zipstrm.h" |
5526e819 VS |
14 | #endif |
15 | ||
d1af991f | 16 | #include "wx/defs.h" |
5526e819 | 17 | |
d1af991f RR |
18 | #if wxUSE_STREAMS && wxUSE_ZIPSTREAM && wxUSE_ZLIB |
19 | ||
20 | #include "wx/stream.h" | |
5526e819 VS |
21 | |
22 | //-------------------------------------------------------------------------------- | |
23 | // wxZipInputStream | |
24 | // This class is input stream from ZIP archive. The archive | |
25 | // must be local file (accessible via FILE*) | |
26 | //-------------------------------------------------------------------------------- | |
27 | ||
28 | ||
bddd7a8d | 29 | class WXDLLIMPEXP_BASE wxZipInputStream : public wxInputStream |
5526e819 | 30 | { |
f6bcfd97 BP |
31 | public: |
32 | wxZipInputStream(const wxString& archive, const wxString& file); | |
33 | // archive is name of .zip archive, file is name of file to be extracted. | |
34 | // Remember that archive must be local file accesible via fopen, fread functions! | |
35 | ~wxZipInputStream(); | |
36 | ||
37 | virtual size_t GetSize() const {return m_Size;} | |
38 | virtual bool Eof() const; | |
39 | ||
40 | protected: | |
41 | virtual size_t OnSysRead(void *buffer, size_t bufsize); | |
42 | virtual off_t OnSysSeek(off_t seek, wxSeekMode mode); | |
43 | virtual off_t OnSysTell() const {return m_Pos;} | |
44 | ||
45 | private: | |
46 | size_t m_Size; | |
47 | off_t m_Pos; | |
48 | ||
49 | // this void* is handle of archive . I'm sorry it is void and not proper | |
50 | // type but I don't want to make unzip.h header public. | |
51 | void *m_Archive; | |
22f3361e VZ |
52 | |
53 | DECLARE_NO_COPY_CLASS(wxZipInputStream) | |
5526e819 VS |
54 | }; |
55 | ||
56 | ||
d1af991f RR |
57 | #endif |
58 | // wxUSE_STREAMS && wxUSE_ZIPSTREAM && wxUSE_ZLIB | |
5526e819 | 59 | |
d1af991f RR |
60 | #endif |
61 | // __ZIPSTREAM_H__ |