]> git.saurik.com Git - wxWidgets.git/blame - include/wx/fs_mem.h
Added, documented and used wxGridCellChoiceEditor
[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
6// Licence: wxWindows Licence
7/////////////////////////////////////////////////////////////////////////////
8
4e8e18e2
VZ
9#ifndef _WX_FS_MEM_H_
10#define _WX_FS_MEM_H_
dcb86da0 11
e4844687
SN
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
19// such files.
c3f4609e 20#pragma interface "fs_mem.h"
dcb86da0
VS
21#endif
22
23#include "wx/wxprec.h"
24
2b5f62a0 25#ifdef __BORLANDC__
dcb86da0
VS
26#pragma hdrstop
27#endif
28
24528b0c 29#if wxUSE_FILESYSTEM
dcb86da0 30
dcb86da0 31#include "wx/filesys.h"
04dbb646 32
886dd7d2 33#if wxUSE_GUI
bddd7a8d
VZ
34 class WXDLLIMPEXP_CORE wxBitmap;
35 class WXDLLIMPEXP_CORE wxImage;
886dd7d2 36#endif // wxUSE_GUI
dcb86da0 37
a8f12b67
VZ
38// ----------------------------------------------------------------------------
39// wxMemoryFSHandlerBase
40// ----------------------------------------------------------------------------
dcb86da0 41
bddd7a8d 42class WXDLLIMPEXP_BASE wxMemoryFSHandlerBase : public wxFileSystemHandler
dcb86da0 43{
e2478fde
VZ
44public:
45 wxMemoryFSHandlerBase();
46 ~wxMemoryFSHandlerBase();
dcb86da0 47
e2478fde
VZ
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
e2478fde
VZ
51 static void AddFile(const wxString& filename, const wxString& textdata);
52 static void AddFile(const wxString& filename, const void *binarydata, size_t size);
04dbb646 53
e2478fde
VZ
54 // Remove file from memory FS and free occupied memory
55 static void RemoveFile(const wxString& filename);
04dbb646 56
e2478fde
VZ
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();
04dbb646 61
60c0a8db 62protected:
e2478fde 63 static bool CheckHash(const wxString& filename);
60c0a8db 64 static wxHashTable *m_Hash;
dcb86da0
VS
65};
66
a8f12b67
VZ
67// ----------------------------------------------------------------------------
68// wxMemoryFSHandler
69// ----------------------------------------------------------------------------
70
71#if wxUSE_GUI
72
73// add GUI-only operations to the base class
74class WXDLLIMPEXP_CORE wxMemoryFSHandler : public wxMemoryFSHandlerBase
e2478fde
VZ
75{
76public:
a8f12b67
VZ
77 // bring the base class versions into the scope, otherwise they would be
78 // inaccessible in wxMemoryFSHandler
192a6c88
VZ
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)
81 {
82 wxMemoryFSHandlerBase::AddFile(filename, textdata);
83 }
84
85 static void AddFile(const wxString& filename,
86 const void *binarydata,
87 size_t size)
88 {
89 wxMemoryFSHandlerBase::AddFile(filename, binarydata, size);
90 }
a8f12b67 91
2de5a6ee
VS
92#if wxUSE_IMAGE
93 static void AddFile(const wxString& filename, wxImage& image, long type);
94#endif // wxUSE_IMAGE
a8f12b67 95
192a6c88
VZ
96 static void AddFile(const wxString& filename,
97 const wxBitmap& bitmap,
98 long type);
e2478fde 99};
dcb86da0 100
a8f12b67
VZ
101#else // !wxUSE_GUI
102
103// just the same thing as the base class in wxBase
104class WXDLLIMPEXP_BASE wxMemoryFSHandler : public wxMemoryFSHandlerBase
105{
106};
107
108#endif // wxUSE_GUI/!wxUSE_GUI
109
e2478fde 110#endif // wxUSE_FILESYSTEM
dcb86da0 111
4e8e18e2
VZ
112#endif // _WX_FS_MEM_H_
113