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