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