| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: wx/fs_arc.h |
| 3 | // Purpose: Archive file system |
| 4 | // Author: Vaclav Slavik, Mike Wetherell |
| 5 | // Copyright: (c) 1999 Vaclav Slavik, (c) 2006 Mike Wetherell |
| 6 | // CVS-ID: $Id$ |
| 7 | // Licence: wxWindows licence |
| 8 | ///////////////////////////////////////////////////////////////////////////// |
| 9 | |
| 10 | #ifndef _WX_FS_ARC_H_ |
| 11 | #define _WX_FS_ARC_H_ |
| 12 | |
| 13 | #include "wx/defs.h" |
| 14 | |
| 15 | #if wxUSE_FS_ARCHIVE |
| 16 | |
| 17 | #include "wx/filesys.h" |
| 18 | #include "wx/hashmap.h" |
| 19 | |
| 20 | WX_DECLARE_STRING_HASH_MAP(int, wxArchiveFilenameHashMap); |
| 21 | |
| 22 | //--------------------------------------------------------------------------- |
| 23 | // wxArchiveFSHandler |
| 24 | //--------------------------------------------------------------------------- |
| 25 | |
| 26 | class WXDLLIMPEXP_BASE wxArchiveFSHandler : public wxFileSystemHandler |
| 27 | { |
| 28 | public: |
| 29 | wxArchiveFSHandler(); |
| 30 | virtual bool CanOpen(const wxString& location); |
| 31 | virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); |
| 32 | virtual wxString FindFirst(const wxString& spec, int flags = 0); |
| 33 | virtual wxString FindNext(); |
| 34 | void Cleanup(); |
| 35 | virtual ~wxArchiveFSHandler(); |
| 36 | |
| 37 | private: |
| 38 | class wxArchiveFSCache *m_cache; |
| 39 | wxFileSystem m_fs; |
| 40 | |
| 41 | // these vars are used by FindFirst/Next: |
| 42 | class wxArchiveFSCacheData *m_Archive; |
| 43 | struct wxArchiveFSEntry *m_FindEntry; |
| 44 | wxString m_Pattern, m_BaseDir, m_ZipFile; |
| 45 | bool m_AllowDirs, m_AllowFiles; |
| 46 | wxArchiveFilenameHashMap *m_DirsFound; |
| 47 | |
| 48 | wxString DoFind(); |
| 49 | |
| 50 | wxDECLARE_NO_COPY_CLASS(wxArchiveFSHandler); |
| 51 | DECLARE_DYNAMIC_CLASS(wxArchiveFSHandler) |
| 52 | }; |
| 53 | |
| 54 | #endif // wxUSE_FS_ARCHIVE |
| 55 | |
| 56 | #endif // _WX_FS_ARC_H_ |