]>
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 VS |
21 | |
22 | #ifndef WXPRECOMP | |
23 | #include "wx/wx.h" | |
24 | #endif | |
25 | ||
26 | #include "wx/filesys.h" | |
11eaa981 | 27 | #if wxUSE_GUI |
dcb86da0 VS |
28 | #include "wx/image.h" |
29 | #include "wx/bitmap.h" | |
11eaa981 | 30 | #endif |
dcb86da0 VS |
31 | |
32 | //-------------------------------------------------------------------------------- | |
33 | // wxMemoryFSHandler | |
34 | //-------------------------------------------------------------------------------- | |
35 | ||
36 | class WXDLLEXPORT wxMemoryFSHandler : public wxFileSystemHandler | |
37 | { | |
38 | public: | |
39 | wxMemoryFSHandler(); | |
40 | ~wxMemoryFSHandler(); | |
41 | ||
42 | // Add file to list of files stored in memory. Stored data (bitmap, text or raw data) | |
43 | // will be copied into private memory stream and available under name "memory:" + filename | |
11eaa981 | 44 | #if wxUSE_GUI |
dcb86da0 VS |
45 | static void AddFile(const wxString& filename, wxImage& image, long type); |
46 | static void AddFile(const wxString& filename, const wxBitmap& bitmap, long type); | |
11eaa981 | 47 | #endif |
dcb86da0 VS |
48 | static void AddFile(const wxString& filename, const wxString& textdata); |
49 | static void AddFile(const wxString& filename, const void *binarydata, size_t size); | |
50 | ||
51 | // Remove file from memory FS and free occupied memory | |
52 | static void RemoveFile(const wxString& filename); | |
53 | ||
54 | virtual bool CanOpen(const wxString& location); | |
55 | virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); | |
56 | virtual wxString FindFirst(const wxString& spec, int flags = 0); | |
57 | virtual wxString FindNext(); | |
58 | ||
59 | private: | |
60 | static wxHashTable *m_Hash; | |
61 | ||
62 | static bool CheckHash(const wxString& filename); | |
63 | }; | |
64 | ||
65 | #endif | |
24528b0c | 66 | // wxUSE_FILESYSTEM |
dcb86da0 VS |
67 | |
68 |