Commit | Line | Data |
---|---|---|
dcb86da0 VS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: fs_mem.h | |
3 | // Purpose: in-memory file system | |
4 | // Author: Vaclav Slavik | |
5 | // Copyright: (c) 2000 Vaclav Slavik | |
6 | // Licence: wxWindows Licence | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | ||
10 | #ifdef __GNUG__ | |
c3f4609e | 11 | #pragma interface "fs_mem.h" |
dcb86da0 VS |
12 | #endif |
13 | ||
14 | #include "wx/wxprec.h" | |
15 | ||
16 | #ifdef __BORDLANDC__ | |
17 | #pragma hdrstop | |
18 | #endif | |
19 | ||
24528b0c | 20 | #if wxUSE_FILESYSTEM |
dcb86da0 | 21 | |
dcb86da0 | 22 | #include "wx/filesys.h" |
04dbb646 | 23 | |
11eaa981 | 24 | #if wxUSE_GUI |
04dbb646 VZ |
25 | #include "wx/image.h" |
26 | #include "wx/bitmap.h" | |
11eaa981 | 27 | #endif |
dcb86da0 VS |
28 | |
29 | //-------------------------------------------------------------------------------- | |
30 | // wxMemoryFSHandler | |
31 | //-------------------------------------------------------------------------------- | |
32 | ||
33 | class WXDLLEXPORT wxMemoryFSHandler : public wxFileSystemHandler | |
34 | { | |
35 | public: | |
36 | wxMemoryFSHandler(); | |
37 | ~wxMemoryFSHandler(); | |
38 | ||
39 | // Add file to list of files stored in memory. Stored data (bitmap, text or raw data) | |
40 | // will be copied into private memory stream and available under name "memory:" + filename | |
11eaa981 | 41 | #if wxUSE_GUI |
dcb86da0 VS |
42 | static void AddFile(const wxString& filename, wxImage& image, long type); |
43 | static void AddFile(const wxString& filename, const wxBitmap& bitmap, long type); | |
11eaa981 | 44 | #endif |
04dbb646 | 45 | static void AddFile(const wxString& filename, const wxString& textdata); |
dcb86da0 | 46 | static void AddFile(const wxString& filename, const void *binarydata, size_t size); |
04dbb646 | 47 | |
dcb86da0 VS |
48 | // Remove file from memory FS and free occupied memory |
49 | static void RemoveFile(const wxString& filename); | |
04dbb646 | 50 | |
dcb86da0 VS |
51 | virtual bool CanOpen(const wxString& location); |
52 | virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); | |
53 | virtual wxString FindFirst(const wxString& spec, int flags = 0); | |
54 | virtual wxString FindNext(); | |
04dbb646 | 55 | |
dcb86da0 VS |
56 | private: |
57 | static wxHashTable *m_Hash; | |
04dbb646 | 58 | |
dcb86da0 VS |
59 | static bool CheckHash(const wxString& filename); |
60 | }; | |
61 | ||
04dbb646 | 62 | #endif |
24528b0c | 63 | // wxUSE_FILESYSTEM |
dcb86da0 VS |
64 | |
65 |