1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: in-memory file system
4 // Author: Vaclav Slavik
5 // Copyright: (c) 2000 Vaclav Slavik
6 // Licence: wxWindows Licence
7 /////////////////////////////////////////////////////////////////////////////
12 #if defined(__GNUG__) && !defined(__APPLE__)
13 #pragma interface "fs_mem.h"
16 #include "wx/wxprec.h"
24 #include "wx/filesys.h"
26 class WXDLLEXPORT wxBitmap
;
27 class WXDLLEXPORT wxImage
;
29 //--------------------------------------------------------------------------------
31 //--------------------------------------------------------------------------------
33 class WXDLLEXPORT wxMemoryFSHandlerBase
: public wxFileSystemHandler
36 wxMemoryFSHandlerBase();
37 ~wxMemoryFSHandlerBase();
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
42 static void AddFile(const wxString
& filename
, const wxString
& textdata
);
43 static void AddFile(const wxString
& filename
, const void *binarydata
, size_t size
);
45 // Remove file from memory FS and free occupied memory
46 static void RemoveFile(const wxString
& filename
);
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();
54 static bool CheckHash(const wxString
& filename
);
55 static wxHashTable
*m_Hash
;
58 class wxMemoryFSHandler
: public wxMemoryFSHandlerBase
63 static void AddFile(const wxString
& filename
, wxImage
& image
, long type
);
65 static void AddFile(const wxString
& filename
, const wxBitmap
& bitmap
, long type
);
69 #endif // wxUSE_FILESYSTEM
71 #endif // _WX_FS_MEM_H_