1//---------------------------------------------------------------------------
2// This file is generated by wxPython's SIP generator.  Do not edit by hand.
3//
4// Copyright: (c) 2018 by Total Control Software
5// License:   wxWindows License
6//
7// This file will be included by _core.sip
8//
9//---------------------------------------------------------------------------
10
11//---------------------------------------------------------------------------
12
13enum wxFileSystemOpenFlags
14{
15    wxFS_READ,
16    wxFS_SEEKABLE
17};
18
19class wxFileSystem : wxObject
20{
21    %Docstring
22        FileSystem()
23
24        This class provides an interface for opening files on different file
25        systems.
26    %End
27    %TypeHeaderCode
28        #include <wx/filesys.h>
29    %End
30
31public:
32    wxFileSystem();
33
34    void ChangePathTo(
35        const wxString & location,
36        bool is_dir = false
37    );
38    %Docstring
39        ChangePathTo(location, is_dir=False)
40
41        Sets the current location.
42    %End
43
44    bool FindFileInPath(
45        wxString * pStr,
46        const wxString & path,
47        const wxString & file
48    );
49    %Docstring
50        FindFileInPath(pStr, path, file) -> bool
51
52        Looks for the file with the given name file in a colon or semi-colon
53        (depending on the current platform) separated list of directories in
54        path.
55    %End
56
57    wxString FindFirst(
58        const wxString & wildcard,
59        int flags = 0
60    );
61    %Docstring
62        FindFirst(wildcard, flags=0) -> String
63
64        Works like wxFindFirstFile().
65    %End
66
67    wxString FindNext();
68    %Docstring
69        FindNext() -> String
70
71        Returns the next filename that matches the parameters passed to
72        FindFirst().
73    %End
74
75    wxString GetPath() const;
76    %Docstring
77        GetPath() -> String
78
79        Returns the actual path (set by wxFileSystem::ChangePathTo).
80    %End
81
82    wxFSFile * OpenFile(
83        const wxString & location,
84        int flags = wxFS_READ
85    );
86    %Docstring
87        OpenFile(location, flags=FS_READ) -> FSFile
88
89        Opens the file and returns a pointer to a wxFSFile object or NULL if
90        failed.
91    %End
92
93    static
94    void AddHandler(
95        wxFileSystemHandler * handler   /Transfer/
96    );
97    %Docstring
98        AddHandler(handler)
99
100        This static function adds new handler into the list of handlers (see
101        wxFileSystemHandler) which provide access to virtual FS.
102    %End
103
104    static
105    wxFileSystemHandler * RemoveHandler(
106        wxFileSystemHandler * handler
107    )   /TransferBack/;
108    %Docstring
109        RemoveHandler(handler) -> FileSystemHandler
110
111        Remove a filesystem handler from the list of handlers.
112    %End
113
114    static
115    wxString FileNameToURL(
116        const wxFileName & filename
117    );
118    %Docstring
119        FileNameToURL(filename) -> String
120
121        Converts a wxFileName into an URL.
122    %End
123
124    static
125    bool HasHandlerForPath(
126        const wxString & location
127    );
128    %Docstring
129        HasHandlerForPath(location) -> bool
130
131        This static function returns true if there is a registered handler
132        which can open the given location.
133    %End
134
135    static
136    wxFileName URLToFileName(
137        const wxString & url
138    );
139    %Docstring
140        URLToFileName(url) -> FileName
141
142        Converts URL into a well-formed filename.
143    %End
144
145    private:
146        wxFileSystem(const wxFileSystem&);
147
148
149    public:
150
151
152    %Property(name=Path, get=GetPath)
153};  // end of class wxFileSystem
154
155
156class wxFSFile : wxObject
157{
158    %Docstring
159        FSFile(stream, location, mimetype, anchor, modif)
160
161        This class represents a single file opened by wxFileSystem.
162    %End
163    %TypeHeaderCode
164        #include <wx/filesys.h>
165    %End
166
167public:
168    wxFSFile(
169        wxInputStream * stream   /KeepReference/,
170        const wxString & location,
171        const wxString & mimetype,
172        const wxString & anchor,
173        wxDateTime modif
174    );
175
176    wxInputStream * DetachStream();
177    %Docstring
178        DetachStream() -> InputStream
179
180        Detaches the stream from the wxFSFile object.
181    %End
182
183    const wxString & GetAnchor() const;
184    %Docstring
185        GetAnchor() -> String
186
187        Returns anchor (if present).
188    %End
189
190    const wxString & GetLocation() const;
191    %Docstring
192        GetLocation() -> String
193
194        Returns full location of the file, including path and protocol.
195    %End
196
197    const wxString & GetMimeType() const;
198    %Docstring
199        GetMimeType() -> String
200
201        Returns the MIME type of the content of this file.
202    %End
203
204    wxDateTime GetModificationTime() const;
205    %Docstring
206        GetModificationTime() -> DateTime
207
208        Returns time when this file was modified.
209    %End
210
211    wxInputStream * GetStream() const;
212    %Docstring
213        GetStream() -> InputStream
214
215        Returns pointer to the stream.
216    %End
217
218    private:
219        wxFSFile(const wxFSFile&);
220
221
222    public:
223
224
225    %Property(name=Anchor, get=GetAnchor)
226    %Property(name=Location, get=GetLocation)
227    %Property(name=MimeType, get=GetMimeType)
228    %Property(name=ModificationTime, get=GetModificationTime)
229    %Property(name=Stream, get=GetStream)
230};  // end of class wxFSFile
231
232
233class wxFileSystemHandler : wxObject
234{
235    %Docstring
236        FileSystemHandler()
237
238        Classes derived from wxFileSystemHandler are used to access virtual
239        file systems.
240    %End
241    %TypeHeaderCode
242        #include <wx/filesys.h>
243    %End
244
245public:
246    wxFileSystemHandler();
247
248    virtual
249    bool CanOpen(
250        const wxString & location
251    ) = 0;
252    %Docstring
253        CanOpen(location) -> bool
254
255        Returns true if the handler is able to open this file.
256    %End
257
258    virtual
259    wxString FindFirst(
260        const wxString & wildcard,
261        int flags = 0
262    );
263    %Docstring
264        FindFirst(wildcard, flags=0) -> String
265
266        Works like wxFindFirstFile().
267    %End
268
269    virtual
270    wxString FindNext();
271    %Docstring
272        FindNext() -> String
273
274        Returns next filename that matches parameters passed to
275        wxFileSystem::FindFirst.
276    %End
277
278    virtual
279    wxFSFile * OpenFile(
280        wxFileSystem & fs,
281        const wxString & location
282    ) = 0   /Factory/;
283    %Docstring
284        OpenFile(fs, location) -> FSFile
285
286        Opens the file and returns wxFSFile pointer or NULL if failed.
287    %End
288
289    static
290    wxString GetMimeTypeFromExt(
291        const wxString & location
292    );
293    %Docstring
294        GetMimeTypeFromExt(location) -> String
295
296        Returns the MIME type based on extension of location.
297    %End
298
299
300protected:
301    static
302    wxString GetAnchor(
303        const wxString & location
304    );
305    %Docstring
306        GetAnchor(location) -> String
307
308        Returns the anchor if present in the location.
309    %End
310
311    static
312    wxString GetLeftLocation(
313        const wxString & location
314    );
315    %Docstring
316        GetLeftLocation(location) -> String
317
318        Returns the left location string extracted from location.
319    %End
320
321    static
322    wxString GetProtocol(
323        const wxString & location
324    );
325    %Docstring
326        GetProtocol(location) -> String
327
328        Returns the protocol string extracted from location.
329    %End
330
331    static
332    wxString GetRightLocation(
333        const wxString & location
334    );
335    %Docstring
336        GetRightLocation(location) -> String
337
338        Returns the right location string extracted from location.
339    %End
340
341};  // end of class wxFileSystemHandler
342
343
344class wxMemoryFSHandler : wxFileSystemHandler
345{
346    %Docstring
347        MemoryFSHandler()
348
349        This wxFileSystem handler can store arbitrary data in memory stream
350        and make them accessible via an URL.
351    %End
352    %TypeHeaderCode
353        #include <wx/fs_mem.h>
354    %End
355
356public:
357    wxMemoryFSHandler();
358
359    static
360    void AddFile(
361        const wxString & filename,
362        wxImage & image,
363        wxBitmapType type
364    );
365    %Docstring
366        AddFile(filename, image, type)
367        AddFile(filename, bitmap, type)
368        AddFile(filename, textdata)
369        AddFile(filename, binarydata)
370
371        Adds a file to the list of the files stored in memory.
372    %End
373
374    static
375    void AddFile(
376        const wxString & filename,
377        const wxBitmap & bitmap,
378        wxBitmapType type
379    );
380
381    static void AddFile(const wxString& filename,  const wxString& textdata);
382    %MethodCode
383        PyErr_Clear();
384        Py_BEGIN_ALLOW_THREADS
385        _wxMemoryFSHandler_AddFile(filename, textdata);
386        Py_END_ALLOW_THREADS
387        if (PyErr_Occurred()) sipIsErr = 1;
388    %End
389    %TypeCode
390    void _wxMemoryFSHandler_AddFile(const wxString* filename, const wxString* textdata)
391    {
392        wxScopedCharBuffer buf = textdata->utf8_str();
393        wxMemoryFSHandler::AddFile(*filename, (const char*)buf, strlen(buf));
394    }
395    %End
396
397    static void AddFile(const wxString& filename,  wxPyBuffer* binarydata);
398    %MethodCode
399        PyErr_Clear();
400        Py_BEGIN_ALLOW_THREADS
401        _wxMemoryFSHandler_AddFile(filename, binarydata);
402        Py_END_ALLOW_THREADS
403        if (PyErr_Occurred()) sipIsErr = 1;
404    %End
405    %TypeCode
406    void _wxMemoryFSHandler_AddFile(const wxString* filename, wxPyBuffer* binarydata)
407    {
408        wxMemoryFSHandler::AddFile(*filename, binarydata->m_ptr, binarydata->m_len);
409    }
410    %End
411
412    static void AddFileWithMimeType(const wxString& filename,  const wxString& textdata,  const wxString& mimetype);
413    %Docstring
414        AddFileWithMimeType(filename, textdata, mimetype)
415        AddFileWithMimeType(filename, binarydata, mimetype)
416
417        Add a file from text data, which will first be converted to utf-8
418        encoded bytes.
419    %End
420    %MethodCode
421        PyErr_Clear();
422        Py_BEGIN_ALLOW_THREADS
423        _wxMemoryFSHandler_AddFileWithMimeType(filename, textdata, mimetype);
424        Py_END_ALLOW_THREADS
425        if (PyErr_Occurred()) sipIsErr = 1;
426    %End
427    %TypeCode
428    void _wxMemoryFSHandler_AddFileWithMimeType(const wxString* filename, const wxString* textdata, const wxString* mimetype)
429    {
430        wxScopedCharBuffer buf = textdata->utf8_str();
431        wxMemoryFSHandler::AddFileWithMimeType(*filename, (const char*)buf, strlen(buf), *mimetype);
432    }
433    %End
434
435    static void AddFileWithMimeType(const wxString& filename,  wxPyBuffer* binarydata,  const wxString& mimetype);
436    %MethodCode
437        PyErr_Clear();
438        Py_BEGIN_ALLOW_THREADS
439        _wxMemoryFSHandler_AddFileWithMimeType(filename, binarydata, mimetype);
440        Py_END_ALLOW_THREADS
441        if (PyErr_Occurred()) sipIsErr = 1;
442    %End
443    %TypeCode
444    void _wxMemoryFSHandler_AddFileWithMimeType(const wxString* filename, wxPyBuffer* binarydata, const wxString* mimetype)
445    {
446        wxMemoryFSHandler::AddFileWithMimeType(
447                *filename, binarydata->m_ptr, binarydata->m_len, *mimetype);
448    }
449    %End
450
451    static
452    void RemoveFile(
453        const wxString & filename
454    );
455    %Docstring
456        RemoveFile(filename)
457
458        Removes a file from memory FS and frees the occupied memory.
459    %End
460
461                virtual bool CanOpen(const wxString& location);
462                virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) /Factory/;
463                virtual wxString FindFirst(const wxString& spec, int flags = 0);
464                virtual wxString FindNext();
465
466
467    private:
468        wxMemoryFSHandler(const wxMemoryFSHandler&);
469
470
471};  // end of class wxMemoryFSHandler
472
473
474class wxArchiveFSHandler : wxFileSystemHandler
475{
476    %Docstring
477        ArchiveFSHandler()
478
479        A file system handler for accessing files inside of archives.
480    %End
481    %TypeHeaderCode
482        #include <wx/fs_arc.h>
483    %End
484
485public:
486    wxArchiveFSHandler();
487
488    virtual
489    ~wxArchiveFSHandler();
490
491    void Cleanup();
492    %Docstring
493        Cleanup()
494    %End
495
496                virtual bool CanOpen(const wxString& location);
497                virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) /Factory/;
498                virtual wxString FindFirst(const wxString& spec, int flags = 0);
499                virtual wxString FindNext();
500
501
502    private:
503        wxArchiveFSHandler(const wxArchiveFSHandler&);
504
505
506};  // end of class wxArchiveFSHandler
507
508
509class wxFilterFSHandler : wxFileSystemHandler
510{
511    %Docstring
512        FilterFSHandler()
513
514        Filter file system handler.
515    %End
516    %TypeHeaderCode
517        #include <wx/fs_filter.h>
518    %End
519
520public:
521    wxFilterFSHandler();
522
523    virtual
524    ~wxFilterFSHandler();
525
526                virtual bool CanOpen(const wxString& location);
527                virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) /Factory/;
528                virtual wxString FindFirst(const wxString& spec, int flags = 0);
529                virtual wxString FindNext();
530
531
532    private:
533        wxFilterFSHandler(const wxFilterFSHandler&);
534
535
536};  // end of class wxFilterFSHandler
537
538
539class wxInternetFSHandler : wxFileSystemHandler
540{
541    %Docstring
542        InternetFSHandler()
543
544        A file system handler for accessing files from internet servers.
545    %End
546    %TypeHeaderCode
547        #include <wx/fs_inet.h>
548    %End
549
550public:
551    wxInternetFSHandler();
552
553                virtual bool CanOpen(const wxString& location);
554                virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) /Factory/;
555                virtual wxString FindFirst(const wxString& spec, int flags = 0);
556                virtual wxString FindNext();
557
558
559    private:
560        wxInternetFSHandler(const wxInternetFSHandler&);
561
562
563};  // end of class wxInternetFSHandler
564
565
566%Extract(id=pycode_core)
567ZipFSHandler = wx.deprecated(ArchiveFSHandler, "Use ArchiveFSHandler instead.")
568
569%End
570
571
572//---------------------------------------------------------------------------
573
574