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