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