]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/filesysh.tex
If somebody ever decides to actually check in fsfile.tex and
[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
6
7\section{\class{wxFileSystemHandler}}\label{wxfilesystemhandler}
8
9wxFileSystemHandler (or derived classes to be exact) is used
10to access virtual file systems. It's public interface consists
11from two methods: \helpref{CanOpen}{wxfilesystemhandlercanopen}
12and \helpref{OpenFile}{wxfilesystemhandleropenfile}.
13It provides additional protected methods to simplify process
14of opening the file : GetProtocol, GetLeftLocation, GetRightLocation,
15GetAnchor, GetMimeTypeFromExt.
16
17Please have a look at \helpref{overview}{fs} if you don't know how locations
18are constructed.
19
20
21\wxheading{Notes}
22
23\begin{itemize}
24\item The handlers are shared by all instances of wxFileSystem.
25
26\item wxHTML library provides handlers for local files and HTTP or FTP protocol
27
28\item The {\it location} parameter passed to OpenFile or CanOpen methods
29is always {\bf absolute} path. You don't need to check the FS's current path!
30\end{itemize}
31
32\wxheading{Derived from}
33
34wxObject
35
36\wxheading{See also}
37
38\helpref{wxFileSystem}{wxfilesystem},
39\helpref{wxFSFile}{wxfsfile},
40\helpref{Overview}{fs}
41
42
43\membersection{wxFileSystemHandler::wxFileSystemHandler}\label{wxfilesystemhandlerwxfilesystemhandler}
44
45\func{}{wxFileSystemHandler}{\void}
46
47Constructor.
48
49\membersection{wxFileSystemHandler::CanOpen}\label{wxfilesystemhandlercanopen}
50
51\func{virtual bool}{CanOpen}{\param{const wxString\& }{location}}
52
53Returns TRUE if the handler is able to open this file (this function doesn't
54check whether the file exists or not, it only checks if it knows the protocol).
55Example:
56
57\begin{verbatim}
58bool MyHand::CanOpen(const wxString& location)
59{
60 return (GetProtocol(location) == "http");
61}
62\end{verbatim}
63
64Must be overwriten in derived handlers.
65
66\membersection{wxFileSystemHandler::OpenFile}\label{wxfilesystemhandleropenfile}
67
68\func{virtual wxFSFile*}{OpenFile}{\param{wxFileSystem\& }{fs}, \param{const wxString\& }{location}}
69
70Opens the file and returns wxFSFile pointer or NULL if failed.
71
72Must be overwriten in derived handlers.
73
74\wxheading{Parameters}
75
76\docparam{fs}{Parent FS (the FS from that OpenFile was called). See ZIP handler
77for details how to use it.}
78
79\docparam{location}{The {\bf absolute} location of file.}
80
81
82
83\membersection{wxFileSystemHandler::GetProtocol}\label{wxfilesystemhandlergetprotocol}
84
85\constfunc{wxString}{GetProtocol}{\param{const wxString\& }{location}}
86
87Returns protocol string extracted from {\it location}.
88
89Example : GetProtocol("file:myzipfile.zip\#zip:index.htm") == "zip"
90
91\membersection{wxFileSystemHandler::GetLeftLocation}\label{wxfilesystemhandlergetleftlocation}
92
93\constfunc{wxString}{GetLeftLocation}{\param{const wxString\& }{location}}
94
95Returns left location string extracted from {\it location}.
96
97Example : GetLeftLocation("file:myzipfile.zip\#zip:index.htm") == "file:myzipfile.zip"
98
99
100\membersection{wxFileSystemHandler::GetAnchor}\label{wxfilesystemhandlergetanchor}
101
102\constfunc{wxString}{GetAnchor}{\param{const wxString\& }{location}}
103
104Returns anchor if present in the location.
105See \helpref{wxFSFile}{wxfsfilegetanchor} for details.
106
107Example : GetAnchor("index.htm\#chapter2") == "chapter2"
108
109{\bf Note:} anchor is NOT part of left location.
110
111\membersection{wxFileSystemHandler::GetRightLocation}\label{wxfilesystemhandlergetrightlocation}
112
113\constfunc{wxString}{GetRightLocation}{\param{const wxString\& }{location}}
114
115Returns right location string extracted from {\it location}.
116
117Example : GetRightLocation("file:myzipfile.zip\#zip:index.htm") == "index.htm"
118
119
120\membersection{wxFileSystemHandler::GetMimeTypeFromExt}\label{wxfilesystemhandlergetmimetypefromext}
121
122\func{wxString}{GetMimeTypeFromExt}{\param{const wxString\& }{location}}
123
124Returns MIME type based on {\bf extension} of {\it location}. (While wxFSFile::GetMimeType
125returns real MIME type - either extension-based or queried from HTTP)
126
127Example : GetMimeTypeFromExt("index.htm") == "text/html"
128