]>
Commit | Line | Data |
---|---|---|
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 | ||
8 | wxFileSystemHandler (or derived classes to be exact) is used | |
9 | to access virtual file systems. It's public interface consists | |
10 | from two methods: \helpref{CanOpen}{wxfilesystemhandlercanopen} | |
11 | and \helpref{OpenFile}{wxfilesystemhandleropenfile}. | |
12 | It provides additional protected methods to simplify process | |
13 | of opening the file : GetProtocol, GetLeftLocation, GetRightLocation, | |
14 | GetAnchor, GetMimeTypeFromExt. | |
15 | ||
16 | Please have a look at \helpref{overview}{fs} if you don't know how locations | |
17 | are 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 | |
27 | is always {\bf absolute} path. You don't need to check the FS's current path! | |
28 | \end{itemize} | |
29 | ||
30 | \wxheading{Derived from} | |
31 | ||
32 | wxObject | |
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 | ||
44 | Constructor. | |
45 | ||
46 | \membersection{wxFileSystemHandler::CanOpen}\label{wxfilesystemhandlercanopen} | |
47 | ||
48 | \func{virtual bool}{CanOpen}{\param{const wxString\& }{location}} | |
49 | ||
50 | Returns TRUE if the handler is able to open this file (this function doesn't | |
51 | check whether the file exists or not, it only checks if it knows the protocol). | |
52 | Example: | |
53 | ||
54 | \begin{verbatim} | |
55 | bool MyHand::CanOpen(const wxString& location) | |
56 | { | |
57 | return (GetProtocol(location) == "http"); | |
58 | } | |
59 | \end{verbatim} | |
60 | ||
61 | Must be overwriten in derived handlers. | |
62 | ||
559fe022 | 63 | \membersection{wxFileSystemHandler::GetAnchor}\label{wxfilesystemhandlergetanchor} |
704a4b75 | 64 | |
559fe022 | 65 | \constfunc{wxString}{GetAnchor}{\param{const wxString\& }{location}} |
704a4b75 | 66 | |
559fe022 VS |
67 | Returns anchor if present in the location. |
68 | See \helpref{wxFSFile}{wxfsfilegetanchor} for details. | |
704a4b75 | 69 | |
559fe022 | 70 | Example : GetAnchor("index.htm\#chapter2") == "chapter2" |
704a4b75 | 71 | |
559fe022 | 72 | {\bf Note:} anchor is NOT part of left location. |
704a4b75 VS |
73 | |
74 | \membersection{wxFileSystemHandler::GetLeftLocation}\label{wxfilesystemhandlergetleftlocation} | |
75 | ||
76 | \constfunc{wxString}{GetLeftLocation}{\param{const wxString\& }{location}} | |
77 | ||
78 | Returns left location string extracted from {\it location}. | |
79 | ||
22d6efa8 | 80 | Example: GetLeftLocation("file:myzipfile.zip\#zip:index.htm") == "file:myzipfile.zip" |
704a4b75 | 81 | |
559fe022 | 82 | \membersection{wxFileSystemHandler::GetMimeTypeFromExt}\label{wxfilesystemhandlergetmimetypefromext} |
704a4b75 | 83 | |
559fe022 | 84 | \func{wxString}{GetMimeTypeFromExt}{\param{const wxString\& }{location}} |
704a4b75 | 85 | |
559fe022 VS |
86 | Returns MIME type based on {\bf extension} of {\it location}. (While wxFSFile::GetMimeType |
87 | returns real MIME type - either extension-based or queried from HTTP) | |
704a4b75 | 88 | |
559fe022 | 89 | Example : GetMimeTypeFromExt("index.htm") == "text/html" |
704a4b75 | 90 | |
559fe022 VS |
91 | \membersection{wxFileSystemHandler::GetProtocol}\label{wxfilesystemhandlergetprotocol} |
92 | ||
93 | \constfunc{wxString}{GetProtocol}{\param{const wxString\& }{location}} | |
94 | ||
95 | Returns protocol string extracted from {\it location}. | |
96 | ||
97 | Example: GetProtocol("file:myzipfile.zip\#zip:index.htm") == "zip" | |
704a4b75 VS |
98 | |
99 | \membersection{wxFileSystemHandler::GetRightLocation}\label{wxfilesystemhandlergetrightlocation} | |
100 | ||
101 | \constfunc{wxString}{GetRightLocation}{\param{const wxString\& }{location}} | |
102 | ||
103 | Returns right location string extracted from {\it location}. | |
104 | ||
105 | Example : GetRightLocation("file:myzipfile.zip\#zip:index.htm") == "index.htm" | |
106 | ||
559fe022 | 107 | \membersection{wxFileSystemHandler::OpenFile}\label{wxfilesystemhandleropenfile} |
704a4b75 | 108 | |
559fe022 | 109 | \func{virtual wxFSFile*}{OpenFile}{\param{wxFileSystem\& }{fs}, \param{const wxString\& }{location}} |
704a4b75 | 110 | |
559fe022 | 111 | Opens the file and returns wxFSFile pointer or NULL if failed. |
704a4b75 | 112 | |
559fe022 VS |
113 | Must be overwriten in derived handlers. |
114 | ||
115 | \wxheading{Parameters} | |
116 | ||
117 | \docparam{fs}{Parent FS (the FS from that OpenFile was called). See ZIP handler | |
118 | for details how to use it.} | |
119 | ||
120 | \docparam{location}{The {\bf absolute} location of file.} | |
704a4b75 | 121 |