fs_arc.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. // Licence: wxWindows licence
  7. /////////////////////////////////////////////////////////////////////////////
  8. #ifndef _WX_FS_ARC_H_
  9. #define _WX_FS_ARC_H_
  10. #include "wx/defs.h"
  11. #if wxUSE_FS_ARCHIVE
  12. #include "wx/filesys.h"
  13. #include "wx/hashmap.h"
  14. WX_DECLARE_STRING_HASH_MAP(int, wxArchiveFilenameHashMap);
  15. //---------------------------------------------------------------------------
  16. // wxArchiveFSHandler
  17. //---------------------------------------------------------------------------
  18. class WXDLLIMPEXP_BASE wxArchiveFSHandler : public wxFileSystemHandler
  19. {
  20. public:
  21. wxArchiveFSHandler();
  22. virtual bool CanOpen(const wxString& location);
  23. virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
  24. virtual wxString FindFirst(const wxString& spec, int flags = 0);
  25. virtual wxString FindNext();
  26. void Cleanup();
  27. virtual ~wxArchiveFSHandler();
  28. private:
  29. class wxArchiveFSCache *m_cache;
  30. wxFileSystem m_fs;
  31. // these vars are used by FindFirst/Next:
  32. class wxArchiveFSCacheData *m_Archive;
  33. struct wxArchiveFSEntry *m_FindEntry;
  34. wxString m_Pattern, m_BaseDir, m_ZipFile;
  35. bool m_AllowDirs, m_AllowFiles;
  36. wxArchiveFilenameHashMap *m_DirsFound;
  37. wxString DoFind();
  38. wxDECLARE_NO_COPY_CLASS(wxArchiveFSHandler);
  39. DECLARE_DYNAMIC_CLASS(wxArchiveFSHandler)
  40. };
  41. #endif // wxUSE_FS_ARCHIVE
  42. #endif // _WX_FS_ARC_H_