]>
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 | ||
12 | #ifdef __GNUG__ | |
13 | #pragma interface | |
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 | ||
29 | class WXDLLEXPORT wxZipInputStream : public wxInputStream | |
30 | { | |
31 | private: | |
32 | size_t m_Size; | |
33 | off_t m_Pos; | |
34 | void *m_Archive; | |
35 | // this void* is handle of archive . | |
36 | // I'm sorry it is void and not proper type but I don't want | |
37 | // to make unzip.h header public. | |
38 | ||
39 | public: | |
40 | wxZipInputStream(const wxString& archive, const wxString& file); | |
41 | // archive is name of .zip archive, file is name of file to be extracted. | |
42 | // Remember that archive must be local file accesible via fopen, fread functions! | |
43 | ~wxZipInputStream(); | |
44 | ||
45 | protected: | |
46 | virtual size_t StreamSize() const {return m_Size;} | |
47 | virtual size_t OnSysRead(void *buffer, size_t bufsize); | |
48 | virtual off_t OnSysSeek(off_t seek, wxSeekMode mode); | |
49 | virtual off_t OnSysTell() const {return m_Pos;} | |
50 | }; | |
51 | ||
52 | ||
d1af991f RR |
53 | #endif |
54 | // wxUSE_STREAMS && wxUSE_ZIPSTREAM && wxUSE_ZLIB | |
5526e819 | 55 | |
d1af991f RR |
56 | #endif |
57 | // __ZIPSTREAM_H__ | |
5526e819 VS |
58 | |
59 | ||
60 | ||
61 | ||
62 | ||
63 | ||
64 | ||
65 | ||
66 | ||
67 | ||
68 | ||
69 | ||
70 | ||
71 | ||
72 | ||
73 | ||
74 |