]>
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 | ||
704a4b75 VS |
19 | \wxheading{Notes} |
20 | ||
36edded9 | 21 | \begin{itemize}\itemsep=0pt |
704a4b75 | 22 | \item The handlers are shared by all instances of wxFileSystem. |
704a4b75 | 23 | \item wxHTML library provides handlers for local files and HTTP or FTP protocol |
704a4b75 | 24 | \item The {\it location} parameter passed to OpenFile or CanOpen methods |
36edded9 | 25 | is always an {\bf absolute} path. You don't need to check the FS's current path. |
704a4b75 VS |
26 | \end{itemize} |
27 | ||
28 | \wxheading{Derived from} | |
29 | ||
30 | wxObject | |
31 | ||
32 | \wxheading{See also} | |
33 | ||
36edded9 JS |
34 | \helpref{wxFileSystem}{wxfilesystem}, |
35 | \helpref{wxFSFile}{wxfsfile}, | |
704a4b75 VS |
36 | \helpref{Overview}{fs} |
37 | ||
704a4b75 VS |
38 | \membersection{wxFileSystemHandler::wxFileSystemHandler}\label{wxfilesystemhandlerwxfilesystemhandler} |
39 | ||
40 | \func{}{wxFileSystemHandler}{\void} | |
41 | ||
42 | Constructor. | |
43 | ||
44 | \membersection{wxFileSystemHandler::CanOpen}\label{wxfilesystemhandlercanopen} | |
45 | ||
46 | \func{virtual bool}{CanOpen}{\param{const wxString\& }{location}} | |
47 | ||
36edded9 JS |
48 | Returns TRUE if the handler is able to open this file. This function doesn't |
49 | check whether the file exists or not, it only checks if it knows the protocol. | |
704a4b75 VS |
50 | Example: |
51 | ||
52 | \begin{verbatim} | |
53 | bool MyHand::CanOpen(const wxString& location) | |
54 | { | |
55 | return (GetProtocol(location) == "http"); | |
56 | } | |
57 | \end{verbatim} | |
58 | ||
36edded9 | 59 | Must be overridden in derived handlers. |
704a4b75 | 60 | |
559fe022 | 61 | \membersection{wxFileSystemHandler::GetAnchor}\label{wxfilesystemhandlergetanchor} |
704a4b75 | 62 | |
559fe022 | 63 | \constfunc{wxString}{GetAnchor}{\param{const wxString\& }{location}} |
704a4b75 | 64 | |
36edded9 | 65 | Returns the anchor if present in the location. |
559fe022 | 66 | See \helpref{wxFSFile}{wxfsfilegetanchor} for details. |
704a4b75 | 67 | |
36edded9 | 68 | Example: GetAnchor("index.htm\#chapter2") == "chapter2" |
704a4b75 | 69 | |
36edded9 | 70 | {\bf Note:} the anchor is NOT part of the left location. |
704a4b75 VS |
71 | |
72 | \membersection{wxFileSystemHandler::GetLeftLocation}\label{wxfilesystemhandlergetleftlocation} | |
73 | ||
74 | \constfunc{wxString}{GetLeftLocation}{\param{const wxString\& }{location}} | |
75 | ||
36edded9 | 76 | Returns the left location string extracted from {\it location}. |
704a4b75 | 77 | |
22d6efa8 | 78 | Example: GetLeftLocation("file:myzipfile.zip\#zip:index.htm") == "file:myzipfile.zip" |
704a4b75 | 79 | |
559fe022 | 80 | \membersection{wxFileSystemHandler::GetMimeTypeFromExt}\label{wxfilesystemhandlergetmimetypefromext} |
704a4b75 | 81 | |
559fe022 | 82 | \func{wxString}{GetMimeTypeFromExt}{\param{const wxString\& }{location}} |
704a4b75 | 83 | |
36edded9 JS |
84 | Returns the MIME type based on {\bf extension} of {\it location}. (While wxFSFile::GetMimeType |
85 | returns real MIME type - either extension-based or queried from HTTP.) | |
704a4b75 | 86 | |
559fe022 | 87 | Example : GetMimeTypeFromExt("index.htm") == "text/html" |
704a4b75 | 88 | |
559fe022 VS |
89 | \membersection{wxFileSystemHandler::GetProtocol}\label{wxfilesystemhandlergetprotocol} |
90 | ||
91 | \constfunc{wxString}{GetProtocol}{\param{const wxString\& }{location}} | |
92 | ||
36edded9 | 93 | Returns the protocol string extracted from {\it location}. |
559fe022 VS |
94 | |
95 | Example: GetProtocol("file:myzipfile.zip\#zip:index.htm") == "zip" | |
704a4b75 VS |
96 | |
97 | \membersection{wxFileSystemHandler::GetRightLocation}\label{wxfilesystemhandlergetrightlocation} | |
98 | ||
99 | \constfunc{wxString}{GetRightLocation}{\param{const wxString\& }{location}} | |
100 | ||
36edded9 | 101 | Returns the right location string extracted from {\it location}. |
704a4b75 VS |
102 | |
103 | Example : GetRightLocation("file:myzipfile.zip\#zip:index.htm") == "index.htm" | |
104 | ||
1fb3eae5 | 105 | \membersection{wxFileSystemHandler::FindFirst}\label{wxfilesystemhandlerfindfirst} |
aaa66113 VS |
106 | |
107 | \func{virtual wxString}{FindFirst}{\param{const wxString\& }{wildcard}, \param{int }{flags = 0}} | |
108 | ||
109 | Works like \helpref{wxFindFirstFile}{wxfindfirstfile}. Returns name of the first | |
110 | filename (withing filesystem's current path) that matches {\it wildcard}. {\it flags} may be one of | |
111 | wxFILE (only files), wxDIR (only directories) or 0 (both). | |
112 | ||
113 | This method is only called if \helpref{CanOpen}{wxfilesystemhandlercanopen} returns TRUE. | |
114 | ||
1fb3eae5 | 115 | \membersection{wxFileSystemHandler::FindNext}\label{wxfilesystemhandlerfindnext} |
aaa66113 VS |
116 | |
117 | \func{virtual wxString}{FindNext}{\void} | |
118 | ||
119 | Returns next filename that matches parameters passed to \helpref{FindFirst}{wxfilesystemfindfirst}. | |
120 | ||
7f24fdbf | 121 | This method is only called if \helpref{CanOpen}{wxfilesystemhandlercanopen} returns TRUE and FindFirst |
36edded9 | 122 | returned a non-empty string. |
aaa66113 | 123 | |
559fe022 | 124 | \membersection{wxFileSystemHandler::OpenFile}\label{wxfilesystemhandleropenfile} |
704a4b75 | 125 | |
559fe022 | 126 | \func{virtual wxFSFile*}{OpenFile}{\param{wxFileSystem\& }{fs}, \param{const wxString\& }{location}} |
704a4b75 | 127 | |
559fe022 | 128 | Opens the file and returns wxFSFile pointer or NULL if failed. |
704a4b75 | 129 | |
36edded9 | 130 | Must be overridden in derived handlers. |
559fe022 VS |
131 | |
132 | \wxheading{Parameters} | |
133 | ||
134 | \docparam{fs}{Parent FS (the FS from that OpenFile was called). See ZIP handler | |
36edded9 | 135 | for details of how to use it.} |
559fe022 VS |
136 | |
137 | \docparam{location}{The {\bf absolute} location of file.} | |
704a4b75 | 138 |