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"
27 #include "wx/filesys.h"
30 class WXDLLIMPEXP_CORE wxBitmap
;
31 class WXDLLIMPEXP_CORE wxImage
;
34 // ----------------------------------------------------------------------------
35 // wxMemoryFSHandlerBase
36 // ----------------------------------------------------------------------------
38 class WXDLLIMPEXP_BASE wxMemoryFSHandlerBase
: public wxFileSystemHandler
41 wxMemoryFSHandlerBase();
42 ~wxMemoryFSHandlerBase();
44 // Add file to list of files stored in memory. Stored data (bitmap, text or
45 // raw data) will be copied into private memory stream and available under
46 // name "memory:" + filename
47 static void AddFile(const wxString
& filename
, const wxString
& textdata
);
48 static void AddFile(const wxString
& filename
, const void *binarydata
, size_t size
);
50 // Remove file from memory FS and free occupied memory
51 static void RemoveFile(const wxString
& filename
);
53 virtual bool CanOpen(const wxString
& location
);
54 virtual wxFSFile
* OpenFile(wxFileSystem
& fs
, const wxString
& location
);
55 virtual wxString
FindFirst(const wxString
& spec
, int flags
= 0);
56 virtual wxString
FindNext();
59 static bool CheckHash(const wxString
& filename
);
60 static wxHashTable
*m_Hash
;
63 // ----------------------------------------------------------------------------
65 // ----------------------------------------------------------------------------
69 // add GUI-only operations to the base class
70 class WXDLLIMPEXP_CORE wxMemoryFSHandler
: public wxMemoryFSHandlerBase
73 // bring the base class versions into the scope, otherwise they would be
74 // inaccessible in wxMemoryFSHandler
75 // (unfortunately "using" can't be used as gcc 2.95 doesn't have it...)
76 static void AddFile(const wxString
& filename
, const wxString
& textdata
)
78 wxMemoryFSHandlerBase::AddFile(filename
, textdata
);
81 static void AddFile(const wxString
& filename
,
82 const void *binarydata
,
85 wxMemoryFSHandlerBase::AddFile(filename
, binarydata
, size
);
89 static void AddFile(const wxString
& filename
,
93 static void AddFile(const wxString
& filename
,
94 const wxBitmap
& bitmap
,
102 // just the same thing as the base class in wxBase
103 class WXDLLIMPEXP_BASE wxMemoryFSHandler
: public wxMemoryFSHandlerBase
107 #endif // wxUSE_GUI/!wxUSE_GUI
109 #endif // wxUSE_FILESYSTEM
111 #endif // _WX_FS_MEM_H_