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