]> git.saurik.com Git - wxWidgets.git/blob - include/wx/fs_mem.h
Compilation fixes.
[wxWidgets.git] / include / wx / fs_mem.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: fs_mem.h
3 // Purpose: in-memory file system
4 // Author: Vaclav Slavik
5 // Copyright: (c) 2000 Vaclav Slavik
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8
9 #ifndef _WX_FS_MEM_H_
10 #define _WX_FS_MEM_H_
11
12 #include "wx/defs.h"
13
14 #if wxUSE_FILESYSTEM
15
16 #include "wx/filesys.h"
17
18 #if wxUSE_GUI
19 class WXDLLIMPEXP_CORE wxBitmap;
20 class WXDLLIMPEXP_CORE wxImage;
21 #endif // wxUSE_GUI
22
23 // ----------------------------------------------------------------------------
24 // wxMemoryFSHandlerBase
25 // ----------------------------------------------------------------------------
26
27 class WXDLLIMPEXP_BASE wxMemoryFSHandlerBase : public wxFileSystemHandler
28 {
29 public:
30 wxMemoryFSHandlerBase();
31 ~wxMemoryFSHandlerBase();
32
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);
38
39 // Remove file from memory FS and free occupied memory
40 static void RemoveFile(const wxString& filename);
41
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();
46
47 protected:
48 static bool CheckHash(const wxString& filename);
49 static wxHashTable *m_Hash;
50 };
51
52 // ----------------------------------------------------------------------------
53 // wxMemoryFSHandler
54 // ----------------------------------------------------------------------------
55
56 #if wxUSE_GUI
57
58 // add GUI-only operations to the base class
59 class WXDLLIMPEXP_CORE wxMemoryFSHandler : public wxMemoryFSHandlerBase
60 {
61 public:
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)
66 {
67 wxMemoryFSHandlerBase::AddFile(filename, textdata);
68 }
69
70 static void AddFile(const wxString& filename,
71 const void *binarydata,
72 size_t size)
73 {
74 wxMemoryFSHandlerBase::AddFile(filename, binarydata, size);
75 }
76
77 #if wxUSE_IMAGE
78 static void AddFile(const wxString& filename,
79 const wxImage& image,
80 long type);
81
82 static void AddFile(const wxString& filename,
83 const wxBitmap& bitmap,
84 long type);
85 #endif // wxUSE_IMAGE
86
87 };
88
89 #else // !wxUSE_GUI
90
91 // just the same thing as the base class in wxBase
92 class WXDLLIMPEXP_BASE wxMemoryFSHandler : public wxMemoryFSHandlerBase
93 {
94 };
95
96 #endif // wxUSE_GUI/!wxUSE_GUI
97
98 #endif // wxUSE_FILESYSTEM
99
100 #endif // _WX_FS_MEM_H_
101