]> git.saurik.com Git - wxWidgets.git/blob - src/common/fs_zip.cpp
Removed USING_CONFIGURE define. As VZ pointed out, checking HAVE_CONFIG_H
[wxWidgets.git] / src / common / fs_zip.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: fs_zip.cpp
3 // Purpose: ZIP file system
4 // Author: Vaclav Slavik
5 // Copyright: (c) 1999 Vaclav Slavik
6 // Licence: wxWindows Licence
7 /////////////////////////////////////////////////////////////////////////////
8
9
10 #ifdef __GNUG__
11 #pragma implementation
12 #endif
13
14 #include <wx/wxprec.h>
15
16 #ifdef __BORDLANDC__
17 #pragma hdrstop
18 #endif
19
20 #if wxUSE_FS_ZIP
21
22 #ifndef WXPRECOMP
23 #include <wx/wx.h>
24 #endif
25
26 #include "wx/filesys.h"
27 #include "wx/zipstream.h"
28 #include "wx/fs_zip.h"
29
30
31 //--------------------------------------------------------------------------------
32 // wxZipFSHandler
33 //--------------------------------------------------------------------------------
34
35
36
37 bool wxZipFSHandler::CanOpen(const wxString& location)
38 {
39 wxString p = GetProtocol(location);
40 return (p == "zip");
41 }
42
43
44
45
46 wxFSFile* wxZipFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxString& location)
47 {
48 wxString right = GetRightLocation(location);
49 wxString left = GetLeftLocation(location);
50 wxInputStream *s;
51
52 if (GetProtocol(left) != "file") {
53 return NULL;
54 }
55
56 s = new wxZipInputStream(left, right);
57 if (s && (s -> LastError() == wxStream_NOERROR)) {
58 return new wxFSFile(s,
59 left + "#zip:" + right,
60 GetMimeTypeFromExt(location),
61 GetAnchor(location));
62 }
63 else return NULL;
64 }
65
66
67
68 wxZipFSHandler::~wxZipFSHandler()
69 {
70 }
71
72 #endif // wxUSE_FS_ZIP