/usr/include/wx-3.0/wx/wxPython/i_files/_filesys.i is in python-wxgtk3.0-dev 3.0.2.0+dfsg-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | /////////////////////////////////////////////////////////////////////////////
// Name: _filesys.i
// Purpose: SWIG definitions of the wxFileSystem family of classes
//
// Author: Robin Dunn
//
// Created: 25-Sept-2000
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
#include "wx/wxPython/pyistream.h"
%}
//---------------------------------------------------------------------------
%newgroup
class wxFSFile : public wxObject
{
public:
%typemap(out) wxFSFile*; // turn off this typemap
wxFSFile(wxInputStream *stream, const wxString& loc,
const wxString& mimetype, const wxString& anchor,
wxDateTime modif);
// Turn it back on.
%typemap(out) wxFSFile* { $result = wxPyMake_wxObject($1, $owner); }
~wxFSFile();
wxInputStream *GetStream();
void DetachStream();
const wxString& GetMimeType();
const wxString& GetLocation();
const wxString& GetAnchor();
wxDateTime GetModificationTime();
%property(Anchor, GetAnchor, doc="See `GetAnchor`");
%property(Location, GetLocation, doc="See `GetLocation`");
%property(MimeType, GetMimeType, doc="See `GetMimeType`");
%property(ModificationTime, GetModificationTime, doc="See `GetModificationTime`");
%property(Stream, GetStream, doc="See `GetStream`");
};
//---------------------------------------------------------------------------
%{
class wxPyFileSystemHandler : public wxFileSystemHandler
{
public:
wxPyFileSystemHandler() : wxFileSystemHandler() {}
DEC_PYCALLBACK_BOOL_STRING_pure(CanOpen);
DEC_PYCALLBACK_FSF_FSSTRING_pure(OpenFile);
DEC_PYCALLBACK_STRING_STRINGINT_pure(FindFirst);
DEC_PYCALLBACK_STRING__pure(FindNext);
static wxString GetProtocol(const wxString& location) {
return wxFileSystemHandler::GetProtocol(location);
}
static wxString GetLeftLocation(const wxString& location) {
return wxFileSystemHandler::GetLeftLocation(location);
}
static wxString GetAnchor(const wxString& location) {
return wxFileSystemHandler::GetAnchor(location);
}
static wxString GetRightLocation(const wxString& location) {
return wxFileSystemHandler::GetRightLocation(location);
}
static wxString GetMimeTypeFromExt(const wxString& location) {
return wxFileSystemHandler::GetMimeTypeFromExt(location);
}
PYPRIVATE;
};
IMP_PYCALLBACK_BOOL_STRING_pure(wxPyFileSystemHandler, wxFileSystemHandler, CanOpen);
IMP_PYCALLBACK_FSF_FSSTRING_pure(wxPyFileSystemHandler, wxFileSystemHandler, OpenFile);
IMP_PYCALLBACK_STRING_STRINGINT_pure(wxPyFileSystemHandler, wxFileSystemHandler, FindFirst);
IMP_PYCALLBACK_STRING__pure(wxPyFileSystemHandler, wxFileSystemHandler, FindNext);
%}
%rename(CPPFileSystemHandler) wxFileSystemHandler;
class wxFileSystemHandler //: public wxObject
{
public:
//wxFileSystemHandler();
~wxFileSystemHandler();
};
%rename(FileSystemHandler) wxPyFileSystemHandler;
class wxPyFileSystemHandler : public wxFileSystemHandler
{
public:
%pythonAppend wxPyFileSystemHandler setCallbackInfo(FileSystemHandler)
wxPyFileSystemHandler();
void _setCallbackInfo(PyObject* self, PyObject* _class);
bool CanOpen(const wxString& location);
%newobject OpenFile;
wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
wxString FindFirst(const wxString& spec, int flags = 0);
wxString FindNext();
static wxString GetProtocol(const wxString& location);
static wxString GetLeftLocation(const wxString& location);
static wxString GetAnchor(const wxString& location);
static wxString GetRightLocation(const wxString& location);
static wxString GetMimeTypeFromExt(const wxString& location);
};
// //---------------------------------------------------------------------------
class wxFileSystem : public wxObject {
public:
// turn off this typemap
%typemap(out) wxFileSystem*;
wxFileSystem();
~wxFileSystem();
// Turn it back on again
%typemap(out) wxFileSystem* { $result = wxPyMake_wxObject($1, $owner); }
void ChangePathTo(const wxString& location, bool is_dir = false);
wxString GetPath();
%newobject OpenFile;
wxFSFile* OpenFile(const wxString& location);
wxString FindFirst(const wxString& spec, int flags = 0);
wxString FindNext();
%disownarg(wxFileSystemHandler *handler);
static void AddHandler(wxFileSystemHandler *handler);
%cleardisown(wxFileSystemHandler *handler);
// Removes FS handler
%newobject RemoveHandler;
static wxFileSystemHandler* RemoveHandler(wxFileSystemHandler *handler);
static void CleanUpHandlers();
// Returns the file URL for a native path
static wxString FileNameToURL(const wxString& filename);
// Returns the native path for a file URL
//static wxFileName URLToFileName(const wxString& url);
%extend {
static wxString URLToFileName(const wxString& url) {
wxFileName fname = wxFileSystem::URLToFileName(url);
return fname.GetFullPath();
}
}
%property(Path, GetPath, doc="See `GetPath`");
};
//---------------------------------------------------------------------------
class wxInternetFSHandler : public wxFileSystemHandler {
public:
wxInternetFSHandler();
bool CanOpen(const wxString& location);
%newobject OpenFile;
wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
};
//---------------------------------------------------------------------------
class wxZipFSHandler : public wxFileSystemHandler {
public:
wxZipFSHandler();
bool CanOpen(const wxString& location);
%newobject OpenFile;
wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
wxString FindFirst(const wxString& spec, int flags = 0);
wxString FindNext();
};
//---------------------------------------------------------------------------
// TODO: Use SWIG's overloading feature to fix this mess?
// getting the overloaded static AddFile method right
%inline %{
void __wxMemoryFSHandler_AddFile_wxImage(const wxString& filename,
wxImage& image,
wxBitmapType type) {
wxMemoryFSHandler::AddFile(filename, image, type);
}
void __wxMemoryFSHandler_AddFile_wxBitmap(const wxString& filename,
const wxBitmap& bitmap,
wxBitmapType type) {
wxMemoryFSHandler::AddFile(filename, bitmap, type);
}
void __wxMemoryFSHandler_AddFile_Data(const wxString& filename,
buffer data, int DATASIZE) {
wxMemoryFSHandler::AddFile(filename, (void*)data, DATASIZE);
}
%}
// case switch for overloading
%pythoncode {
def MemoryFSHandler_AddFile(filename, dataItem, imgType=-1):
"""
Add 'file' to the memory filesystem. The dataItem parameter can
either be a `wx.Bitmap`, `wx.Image` or a string that can contain
arbitrary data. If a bitmap or image is used then the imgType
parameter should specify what kind of image file it should be
written as, wx.BITMAP_TYPE_PNG, etc.
"""
if isinstance(dataItem, wx.Image):
__wxMemoryFSHandler_AddFile_wxImage(filename, dataItem, imgType)
elif isinstance(dataItem, wx.Bitmap):
__wxMemoryFSHandler_AddFile_wxBitmap(filename, dataItem, imgType)
else:
try:
__wxMemoryFSHandler_AddFile_Data(filename, dataItem)
except TypeError:
raise TypeError, 'wx.Image, wx.Bitmap or buffer object expected'
}
class wxMemoryFSHandler : public wxFileSystemHandler {
public:
wxMemoryFSHandler();
// Remove file from memory FS and free occupied memory
static void RemoveFile(const wxString& filename);
// Add a file to the memory FS
%pythoncode { AddFile = staticmethod(MemoryFSHandler_AddFile) }
%extend {
static void AddFileWithMimeType(const wxString& filename,
buffer data, int DATASIZE,
const wxString& mimetype)
{
wxMemoryFSHandler::AddFileWithMimeType(filename,
(void*)data, DATASIZE,
mimetype);
}
}
bool CanOpen(const wxString& location);
%newobject OpenFile;
wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
wxString FindFirst(const wxString& spec, int flags = 0);
virtual wxString FindNext();
};
//---------------------------------------------------------------------------
%init %{
wxPyPtrTypeMap_Add("wxFileSystemHandler", "wxPyFileSystemHandler");
%}
//---------------------------------------------------------------------------
|