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