]>
Commit | Line | Data |
---|---|---|
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__ | |
11 | #pragma implementation | |
12 | #endif | |
13 | ||
14 | #include "wx/wxprec.h" | |
15 | ||
16 | #ifdef __BORDLANDC__ | |
17 | #pragma hdrstop | |
18 | #endif | |
19 | ||
20 | #if wxUSE_FILESYSTEM | |
21 | ||
22 | #ifndef WXPRECOMP | |
23 | #include "wx/wx.h" | |
24 | #endif | |
25 | ||
26 | #include "wx/filesys.h" | |
27 | #if wxUSE_GUI | |
28 | #include "wx/image.h" | |
29 | #include "wx/bitmap.h" | |
30 | #endif | |
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 | |
44 | #if wxUSE_GUI | |
45 | static void AddFile(const wxString& filename, wxImage& image, long type); | |
46 | static void AddFile(const wxString& filename, const wxBitmap& bitmap, long type); | |
47 | #endif | |
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 | |
66 | // wxUSE_FILESYSTEM | |
67 | ||
68 |