1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: in-memory file system
4 // Author: Vaclav Slavik
5 // Copyright: (c) 2000 Vaclav Slavik
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
16 #include "wx/filesys.h"
19 class WXDLLIMPEXP_CORE wxBitmap
;
20 class WXDLLIMPEXP_CORE wxImage
;
23 // ----------------------------------------------------------------------------
24 // wxMemoryFSHandlerBase
25 // ----------------------------------------------------------------------------
27 class WXDLLIMPEXP_BASE wxMemoryFSHandlerBase
: public wxFileSystemHandler
30 wxMemoryFSHandlerBase();
31 ~wxMemoryFSHandlerBase();
33 // Add file to list of files stored in memory. Stored data (bitmap, text or
34 // raw data) will be copied into private memory stream and available under
35 // name "memory:" + filename
36 static void AddFile(const wxString
& filename
, const wxString
& textdata
);
37 static void AddFile(const wxString
& filename
, const void *binarydata
, size_t size
);
39 // Remove file from memory FS and free occupied memory
40 static void RemoveFile(const wxString
& filename
);
42 virtual bool CanOpen(const wxString
& location
);
43 virtual wxFSFile
* OpenFile(wxFileSystem
& fs
, const wxString
& location
);
44 virtual wxString
FindFirst(const wxString
& spec
, int flags
= 0);
45 virtual wxString
FindNext();
48 static bool CheckHash(const wxString
& filename
);
49 static wxHashTable
*m_Hash
;
52 // ----------------------------------------------------------------------------
54 // ----------------------------------------------------------------------------
58 // add GUI-only operations to the base class
59 class WXDLLIMPEXP_CORE wxMemoryFSHandler
: public wxMemoryFSHandlerBase
62 // bring the base class versions into the scope, otherwise they would be
63 // inaccessible in wxMemoryFSHandler
64 // (unfortunately "using" can't be used as gcc 2.95 doesn't have it...)
65 static void AddFile(const wxString
& filename
, const wxString
& textdata
)
67 wxMemoryFSHandlerBase::AddFile(filename
, textdata
);
70 static void AddFile(const wxString
& filename
,
71 const void *binarydata
,
74 wxMemoryFSHandlerBase::AddFile(filename
, binarydata
, size
);
78 static void AddFile(const wxString
& filename
,
82 static void AddFile(const wxString
& filename
,
83 const wxBitmap
& bitmap
,
91 // just the same thing as the base class in wxBase
92 class WXDLLIMPEXP_BASE wxMemoryFSHandler
: public wxMemoryFSHandlerBase
96 #endif // wxUSE_GUI/!wxUSE_GUI
98 #endif // wxUSE_FILESYSTEM
100 #endif // _WX_FS_MEM_H_