]> git.saurik.com Git - wxWidgets.git/blame - include/wx/fs_mem.h
fix Normalize() test by using dummy working directory allowing the test to work even...
[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
886dd7d2 18#if wxUSE_GUI
bddd7a8d
VZ
19 class WXDLLIMPEXP_CORE wxBitmap;
20 class WXDLLIMPEXP_CORE wxImage;
886dd7d2 21#endif // wxUSE_GUI
dcb86da0 22
a8f12b67
VZ
23// ----------------------------------------------------------------------------
24// wxMemoryFSHandlerBase
25// ----------------------------------------------------------------------------
dcb86da0 26
bddd7a8d 27class WXDLLIMPEXP_BASE wxMemoryFSHandlerBase : public wxFileSystemHandler
dcb86da0 28{
e2478fde
VZ
29public:
30 wxMemoryFSHandlerBase();
d3c7fc99 31 virtual ~wxMemoryFSHandlerBase();
dcb86da0 32
e2478fde
VZ
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
e2478fde
VZ
36 static void AddFile(const wxString& filename, const wxString& textdata);
37 static void AddFile(const wxString& filename, const void *binarydata, size_t size);
04dbb646 38
e2478fde
VZ
39 // Remove file from memory FS and free occupied memory
40 static void RemoveFile(const wxString& filename);
04dbb646 41
e2478fde
VZ
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();
04dbb646 46
60c0a8db 47protected:
e2478fde 48 static bool CheckHash(const wxString& filename);
60c0a8db 49 static wxHashTable *m_Hash;
dcb86da0
VS
50};
51
a8f12b67
VZ
52// ----------------------------------------------------------------------------
53// wxMemoryFSHandler
54// ----------------------------------------------------------------------------
55
56#if wxUSE_GUI
57
58// add GUI-only operations to the base class
59class WXDLLIMPEXP_CORE wxMemoryFSHandler : public wxMemoryFSHandlerBase
e2478fde
VZ
60{
61public:
a8f12b67
VZ
62 // bring the base class versions into the scope, otherwise they would be
63 // inaccessible in wxMemoryFSHandler
192a6c88
VZ
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 }
a8f12b67 76
2de5a6ee 77#if wxUSE_IMAGE
989a2421
VZ
78 static void AddFile(const wxString& filename,
79 const wxImage& image,
80 long type);
a8f12b67 81
192a6c88
VZ
82 static void AddFile(const wxString& filename,
83 const wxBitmap& bitmap,
84 long type);
1904aa72
DS
85#endif // wxUSE_IMAGE
86
e2478fde 87};
dcb86da0 88
a8f12b67
VZ
89#else // !wxUSE_GUI
90
91// just the same thing as the base class in wxBase
92class WXDLLIMPEXP_BASE wxMemoryFSHandler : public wxMemoryFSHandlerBase
93{
94};
95
96#endif // wxUSE_GUI/!wxUSE_GUI
97
e2478fde 98#endif // wxUSE_FILESYSTEM
dcb86da0 99
4e8e18e2
VZ
100#endif // _WX_FS_MEM_H_
101