]> git.saurik.com Git - wxWidgets.git/blame - include/wx/fs_mem.h
removed the strange __WXMSW__ test in AddFile(bitmap) -- why should this function...
[wxWidgets.git] / include / wx / fs_mem.h
CommitLineData
dcb86da0
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: fs_mem.h
3// Purpose: in-memory file system
4// Author: Vaclav Slavik
5// Copyright: (c) 2000 Vaclav Slavik
65571936 6// Licence: wxWindows licence
dcb86da0
VS
7/////////////////////////////////////////////////////////////////////////////
8
4e8e18e2
VZ
9#ifndef _WX_FS_MEM_H_
10#define _WX_FS_MEM_H_
dcb86da0 11
372c511b 12#include "wx/defs.h"
dcb86da0 13
24528b0c 14#if wxUSE_FILESYSTEM
dcb86da0 15
dcb86da0 16#include "wx/filesys.h"
04dbb646 17
0eb2e510
VZ
18class wxMemoryFSHash;
19
886dd7d2 20#if wxUSE_GUI
f92ef853 21 #include "wx/bitmap.h"
886dd7d2 22#endif // wxUSE_GUI
dcb86da0 23
a8f12b67
VZ
24// ----------------------------------------------------------------------------
25// wxMemoryFSHandlerBase
26// ----------------------------------------------------------------------------
dcb86da0 27
bddd7a8d 28class WXDLLIMPEXP_BASE wxMemoryFSHandlerBase : public wxFileSystemHandler
dcb86da0 29{
e2478fde
VZ
30public:
31 wxMemoryFSHandlerBase();
d3c7fc99 32 virtual ~wxMemoryFSHandlerBase();
dcb86da0 33
e2478fde
VZ
34 // Add file to list of files stored in memory. Stored data (bitmap, text or
35 // raw data) will be copied into private memory stream and available under
36 // name "memory:" + filename
e2478fde
VZ
37 static void AddFile(const wxString& filename, const wxString& textdata);
38 static void AddFile(const wxString& filename, const void *binarydata, size_t size);
c5d7b81e
VS
39 static void AddFileWithMimeType(const wxString& filename,
40 const wxString& textdata,
41 const wxString& mimetype);
42 static void AddFileWithMimeType(const wxString& filename,
43 const void *binarydata, size_t size,
44 const wxString& mimetype);
04dbb646 45
e2478fde
VZ
46 // Remove file from memory FS and free occupied memory
47 static void RemoveFile(const wxString& filename);
04dbb646 48
e2478fde
VZ
49 virtual bool CanOpen(const wxString& location);
50 virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
51 virtual wxString FindFirst(const wxString& spec, int flags = 0);
52 virtual wxString FindNext();
04dbb646 53
60c0a8db 54protected:
e2478fde 55 static bool CheckHash(const wxString& filename);
0eb2e510 56 static wxMemoryFSHash *m_Hash;
dcb86da0
VS
57};
58
a8f12b67
VZ
59// ----------------------------------------------------------------------------
60// wxMemoryFSHandler
61// ----------------------------------------------------------------------------
62
63#if wxUSE_GUI
64
65// add GUI-only operations to the base class
66class WXDLLIMPEXP_CORE wxMemoryFSHandler : public wxMemoryFSHandlerBase
e2478fde
VZ
67{
68public:
a8f12b67
VZ
69 // bring the base class versions into the scope, otherwise they would be
70 // inaccessible in wxMemoryFSHandler
192a6c88
VZ
71 // (unfortunately "using" can't be used as gcc 2.95 doesn't have it...)
72 static void AddFile(const wxString& filename, const wxString& textdata)
73 {
74 wxMemoryFSHandlerBase::AddFile(filename, textdata);
75 }
76
77 static void AddFile(const wxString& filename,
78 const void *binarydata,
79 size_t size)
80 {
81 wxMemoryFSHandlerBase::AddFile(filename, binarydata, size);
82 }
c5d7b81e
VS
83 static void AddFileWithMimeType(const wxString& filename,
84 const wxString& textdata,
85 const wxString& mimetype)
86 {
87 wxMemoryFSHandlerBase::AddFileWithMimeType(filename,
88 textdata,
89 mimetype);
90 }
91 static void AddFileWithMimeType(const wxString& filename,
92 const void *binarydata, size_t size,
93 const wxString& mimetype)
94 {
95 wxMemoryFSHandlerBase::AddFileWithMimeType(filename,
96 binarydata, size,
97 mimetype);
98 }
a8f12b67 99
2de5a6ee 100#if wxUSE_IMAGE
989a2421
VZ
101 static void AddFile(const wxString& filename,
102 const wxImage& image,
d75a69e8 103 wxBitmapType type);
a8f12b67 104
192a6c88
VZ
105 static void AddFile(const wxString& filename,
106 const wxBitmap& bitmap,
d75a69e8 107 wxBitmapType type);
1904aa72
DS
108#endif // wxUSE_IMAGE
109
e2478fde 110};
dcb86da0 111
a8f12b67
VZ
112#else // !wxUSE_GUI
113
114// just the same thing as the base class in wxBase
115class WXDLLIMPEXP_BASE wxMemoryFSHandler : public wxMemoryFSHandlerBase
116{
117};
118
119#endif // wxUSE_GUI/!wxUSE_GUI
120
e2478fde 121#endif // wxUSE_FILESYSTEM
dcb86da0 122
4e8e18e2
VZ
123#endif // _WX_FS_MEM_H_
124