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