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