]>
Commit | Line | Data |
---|---|---|
704a4b75 VS |
1 | % |
2 | % automatically generated by HelpGen from | |
3 | % filesystemhandler.tex at 21/Mar/99 23:00:52 | |
4 | % | |
5 | ||
704a4b75 VS |
6 | \section{\class{wxFileSystemHandler}}\label{wxfilesystemhandler} |
7 | ||
36edded9 JS |
8 | Classes derived from wxFileSystemHandler are used |
9 | to access virtual file systems. Its public interface consists | |
10 | of two methods: \helpref{CanOpen}{wxfilesystemhandlercanopen} | |
704a4b75 | 11 | and \helpref{OpenFile}{wxfilesystemhandleropenfile}. |
36edded9 JS |
12 | It provides additional protected methods to simplify the process |
13 | of opening the file: GetProtocol, GetLeftLocation, GetRightLocation, | |
704a4b75 VS |
14 | GetAnchor, GetMimeTypeFromExt. |
15 | ||
16 | Please have a look at \helpref{overview}{fs} if you don't know how locations | |
17 | are constructed. | |
18 | ||
9704b250 VS |
19 | Also consult \helpref{list of available handlers}{fs}. |
20 | ||
d3f3e857 MB |
21 | \perlnote{In wxPerl, you need to derive your file system handler class |
22 | from Wx::PlFileSystemHandler.} | |
23 | ||
704a4b75 VS |
24 | \wxheading{Notes} |
25 | ||
36edded9 | 26 | \begin{itemize}\itemsep=0pt |
704a4b75 | 27 | \item The handlers are shared by all instances of wxFileSystem. |
704a4b75 | 28 | \item wxHTML library provides handlers for local files and HTTP or FTP protocol |
704a4b75 | 29 | \item The {\it location} parameter passed to OpenFile or CanOpen methods |
36edded9 | 30 | is always an {\bf absolute} path. You don't need to check the FS's current path. |
704a4b75 VS |
31 | \end{itemize} |
32 | ||
33 | \wxheading{Derived from} | |
34 | ||
9704b250 VS |
35 | \helpref{wxObject}{wxobject} |
36 | ||
37 | \wxheading{Include files} | |
38 | ||
39 | <wx/filesys.h> | |
704a4b75 VS |
40 | |
41 | \wxheading{See also} | |
42 | ||
36edded9 JS |
43 | \helpref{wxFileSystem}{wxfilesystem}, |
44 | \helpref{wxFSFile}{wxfsfile}, | |
704a4b75 VS |
45 | \helpref{Overview}{fs} |
46 | ||
9704b250 VS |
47 | \latexignore{\rtfignore{\wxheading{Members}}} |
48 | ||
49 | ||
704a4b75 VS |
50 | \membersection{wxFileSystemHandler::wxFileSystemHandler}\label{wxfilesystemhandlerwxfilesystemhandler} |
51 | ||
52 | \func{}{wxFileSystemHandler}{\void} | |
53 | ||
54 | Constructor. | |
55 | ||
56 | \membersection{wxFileSystemHandler::CanOpen}\label{wxfilesystemhandlercanopen} | |
57 | ||
58 | \func{virtual bool}{CanOpen}{\param{const wxString\& }{location}} | |
59 | ||
36edded9 JS |
60 | Returns TRUE if the handler is able to open this file. This function doesn't |
61 | check whether the file exists or not, it only checks if it knows the protocol. | |
704a4b75 VS |
62 | Example: |
63 | ||
64 | \begin{verbatim} | |
65 | bool MyHand::CanOpen(const wxString& location) | |
66 | { | |
67 | return (GetProtocol(location) == "http"); | |
68 | } | |
69 | \end{verbatim} | |
70 | ||
36edded9 | 71 | Must be overridden in derived handlers. |
704a4b75 | 72 | |
559fe022 | 73 | \membersection{wxFileSystemHandler::GetAnchor}\label{wxfilesystemhandlergetanchor} |
704a4b75 | 74 | |
559fe022 | 75 | \constfunc{wxString}{GetAnchor}{\param{const wxString\& }{location}} |
704a4b75 | 76 | |
36edded9 | 77 | Returns the anchor if present in the location. |
559fe022 | 78 | See \helpref{wxFSFile}{wxfsfilegetanchor} for details. |
704a4b75 | 79 | |
36edded9 | 80 | Example: GetAnchor("index.htm\#chapter2") == "chapter2" |
704a4b75 | 81 | |
36edded9 | 82 | {\bf Note:} the anchor is NOT part of the left location. |
704a4b75 VS |
83 | |
84 | \membersection{wxFileSystemHandler::GetLeftLocation}\label{wxfilesystemhandlergetleftlocation} | |
85 | ||
86 | \constfunc{wxString}{GetLeftLocation}{\param{const wxString\& }{location}} | |
87 | ||
36edded9 | 88 | Returns the left location string extracted from {\it location}. |
704a4b75 | 89 | |
22d6efa8 | 90 | Example: GetLeftLocation("file:myzipfile.zip\#zip:index.htm") == "file:myzipfile.zip" |
704a4b75 | 91 | |
559fe022 | 92 | \membersection{wxFileSystemHandler::GetMimeTypeFromExt}\label{wxfilesystemhandlergetmimetypefromext} |
704a4b75 | 93 | |
559fe022 | 94 | \func{wxString}{GetMimeTypeFromExt}{\param{const wxString\& }{location}} |
704a4b75 | 95 | |
36edded9 JS |
96 | Returns the MIME type based on {\bf extension} of {\it location}. (While wxFSFile::GetMimeType |
97 | returns real MIME type - either extension-based or queried from HTTP.) | |
704a4b75 | 98 | |
559fe022 | 99 | Example : GetMimeTypeFromExt("index.htm") == "text/html" |
704a4b75 | 100 | |
559fe022 VS |
101 | \membersection{wxFileSystemHandler::GetProtocol}\label{wxfilesystemhandlergetprotocol} |
102 | ||
103 | \constfunc{wxString}{GetProtocol}{\param{const wxString\& }{location}} | |
104 | ||
36edded9 | 105 | Returns the protocol string extracted from {\it location}. |
559fe022 VS |
106 | |
107 | Example: GetProtocol("file:myzipfile.zip\#zip:index.htm") == "zip" | |
704a4b75 VS |
108 | |
109 | \membersection{wxFileSystemHandler::GetRightLocation}\label{wxfilesystemhandlergetrightlocation} | |
110 | ||
111 | \constfunc{wxString}{GetRightLocation}{\param{const wxString\& }{location}} | |
112 | ||
36edded9 | 113 | Returns the right location string extracted from {\it location}. |
704a4b75 VS |
114 | |
115 | Example : GetRightLocation("file:myzipfile.zip\#zip:index.htm") == "index.htm" | |
116 | ||
1fb3eae5 | 117 | \membersection{wxFileSystemHandler::FindFirst}\label{wxfilesystemhandlerfindfirst} |
aaa66113 VS |
118 | |
119 | \func{virtual wxString}{FindFirst}{\param{const wxString\& }{wildcard}, \param{int }{flags = 0}} | |
120 | ||
121 | Works like \helpref{wxFindFirstFile}{wxfindfirstfile}. Returns name of the first | |
2edb0bde | 122 | filename (within filesystem's current path) that matches {\it wildcard}. {\it flags} may be one of |
aaa66113 VS |
123 | wxFILE (only files), wxDIR (only directories) or 0 (both). |
124 | ||
125 | This method is only called if \helpref{CanOpen}{wxfilesystemhandlercanopen} returns TRUE. | |
126 | ||
1fb3eae5 | 127 | \membersection{wxFileSystemHandler::FindNext}\label{wxfilesystemhandlerfindnext} |
aaa66113 VS |
128 | |
129 | \func{virtual wxString}{FindNext}{\void} | |
130 | ||
131 | Returns next filename that matches parameters passed to \helpref{FindFirst}{wxfilesystemfindfirst}. | |
132 | ||
7f24fdbf | 133 | This method is only called if \helpref{CanOpen}{wxfilesystemhandlercanopen} returns TRUE and FindFirst |
36edded9 | 134 | returned a non-empty string. |
aaa66113 | 135 | |
559fe022 | 136 | \membersection{wxFileSystemHandler::OpenFile}\label{wxfilesystemhandleropenfile} |
704a4b75 | 137 | |
559fe022 | 138 | \func{virtual wxFSFile*}{OpenFile}{\param{wxFileSystem\& }{fs}, \param{const wxString\& }{location}} |
704a4b75 | 139 | |
559fe022 | 140 | Opens the file and returns wxFSFile pointer or NULL if failed. |
704a4b75 | 141 | |
36edded9 | 142 | Must be overridden in derived handlers. |
559fe022 VS |
143 | |
144 | \wxheading{Parameters} | |
145 | ||
146 | \docparam{fs}{Parent FS (the FS from that OpenFile was called). See ZIP handler | |
36edded9 | 147 | for details of how to use it.} |
559fe022 VS |
148 | |
149 | \docparam{location}{The {\bf absolute} location of file.} | |
704a4b75 | 150 |