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