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