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(NO_GCC_PRAGMA) && !defined(__EMX__)
13 // Some older compilers (such as EMX) cannot handle
14 // #pragma interface/implementation correctly, iff
15 // #pragma implementation is used in _two_ translation
16 // units (as created by e.g. event.cpp compiled for
17 // libwx_base and event.cpp compiled for libwx_gui_core).
18 // So we must not use those pragmas for those compilers in
20 #pragma interface "fs_mem.h"
23 #include "wx/wxprec.h"
31 #include "wx/filesys.h"
34 class WXDLLIMPEXP_CORE wxBitmap
;
35 class WXDLLIMPEXP_CORE wxImage
;
38 // ----------------------------------------------------------------------------
39 // wxMemoryFSHandlerBase
40 // ----------------------------------------------------------------------------
42 class WXDLLIMPEXP_BASE wxMemoryFSHandlerBase
: public wxFileSystemHandler
45 wxMemoryFSHandlerBase();
46 ~wxMemoryFSHandlerBase();
48 // Add file to list of files stored in memory. Stored data (bitmap, text or
49 // raw data) will be copied into private memory stream and available under
50 // name "memory:" + filename
51 static void AddFile(const wxString
& filename
, const wxString
& textdata
);
52 static void AddFile(const wxString
& filename
, const void *binarydata
, size_t size
);
54 // Remove file from memory FS and free occupied memory
55 static void RemoveFile(const wxString
& filename
);
57 virtual bool CanOpen(const wxString
& location
);
58 virtual wxFSFile
* OpenFile(wxFileSystem
& fs
, const wxString
& location
);
59 virtual wxString
FindFirst(const wxString
& spec
, int flags
= 0);
60 virtual wxString
FindNext();
63 static bool CheckHash(const wxString
& filename
);
64 static wxHashTable
*m_Hash
;
67 // ----------------------------------------------------------------------------
69 // ----------------------------------------------------------------------------
73 // add GUI-only operations to the base class
74 class WXDLLIMPEXP_CORE wxMemoryFSHandler
: public wxMemoryFSHandlerBase
77 // bring the base class versions into the scope, otherwise they would be
78 // inaccessible in wxMemoryFSHandler
79 // (unfortunately "using" can't be used as gcc 2.95 doesn't have it...)
80 static void AddFile(const wxString
& filename
, const wxString
& textdata
)
82 wxMemoryFSHandlerBase::AddFile(filename
, textdata
);
85 static void AddFile(const wxString
& filename
,
86 const void *binarydata
,
89 wxMemoryFSHandlerBase::AddFile(filename
, binarydata
, size
);
93 static void AddFile(const wxString
& filename
, wxImage
& image
, long type
);
96 static void AddFile(const wxString
& filename
,
97 const wxBitmap
& bitmap
,
103 // just the same thing as the base class in wxBase
104 class WXDLLIMPEXP_BASE wxMemoryFSHandler
: public wxMemoryFSHandlerBase
108 #endif // wxUSE_GUI/!wxUSE_GUI
110 #endif // wxUSE_FILESYSTEM
112 #endif // _WX_FS_MEM_H_