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"
27 class WXDLLIMPEXP_CORE wxBitmap
;
28 class WXDLLIMPEXP_CORE wxImage
;
31 // ----------------------------------------------------------------------------
32 // wxMemoryFSHandlerBase
33 // ----------------------------------------------------------------------------
35 class WXDLLIMPEXP_BASE wxMemoryFSHandlerBase
: public wxFileSystemHandler
38 wxMemoryFSHandlerBase();
39 ~wxMemoryFSHandlerBase();
41 // Add file to list of files stored in memory. Stored data (bitmap, text or
42 // raw data) will be copied into private memory stream and available under
43 // name "memory:" + filename
44 static void AddFile(const wxString
& filename
, const wxString
& textdata
);
45 static void AddFile(const wxString
& filename
, const void *binarydata
, size_t size
);
47 // Remove file from memory FS and free occupied memory
48 static void RemoveFile(const wxString
& filename
);
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();
56 static bool CheckHash(const wxString
& filename
);
57 static wxHashTable
*m_Hash
;
60 // ----------------------------------------------------------------------------
62 // ----------------------------------------------------------------------------
66 // add GUI-only operations to the base class
67 class WXDLLIMPEXP_CORE wxMemoryFSHandler
: public wxMemoryFSHandlerBase
70 // bring the base class versions into the scope, otherwise they would be
71 // inaccessible in wxMemoryFSHandler
72 // (unfortunately "using" can't be used as gcc 2.95 doesn't have it...)
73 static void AddFile(const wxString
& filename
, const wxString
& textdata
)
75 wxMemoryFSHandlerBase::AddFile(filename
, textdata
);
78 static void AddFile(const wxString
& filename
,
79 const void *binarydata
,
82 wxMemoryFSHandlerBase::AddFile(filename
, binarydata
, size
);
86 static void AddFile(const wxString
& filename
, wxImage
& image
, long type
);
89 static void AddFile(const wxString
& filename
,
90 const wxBitmap
& bitmap
,
96 // just the same thing as the base class in wxBase
97 class WXDLLIMPEXP_BASE wxMemoryFSHandler
: public wxMemoryFSHandlerBase
101 #endif // wxUSE_GUI/!wxUSE_GUI
103 #endif // wxUSE_FILESYSTEM
105 #endif // _WX_FS_MEM_H_