2 % automatically generated by HelpGen from
3 % filesystemhandler.tex at 21/Mar/99 23:00:52
6 \section{\class{wxFileSystemHandler
}}\label{wxfilesystemhandler
}
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.
16 Please have a look at
\helpref{overview
}{fs
} if you don't know how locations
19 Also consult
\helpref{list of available handlers
}{fs
}.
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.
30 \wxheading{Derived from
}
32 \helpref{wxObject
}{wxobject
}
34 \wxheading{Include files
}
40 \helpref{wxFileSystem
}{wxfilesystem
},
41 \helpref{wxFSFile
}{wxfsfile
},
42 \helpref{Overview
}{fs
}
44 \latexignore{\rtfignore{\wxheading{Members
}}}
47 \membersection{wxFileSystemHandler::wxFileSystemHandler
}\label{wxfilesystemhandlerwxfilesystemhandler
}
49 \func{}{wxFileSystemHandler
}{\void}
53 \membersection{wxFileSystemHandler::CanOpen
}\label{wxfilesystemhandlercanopen
}
55 \func{virtual bool
}{CanOpen
}{\param{const wxString\&
}{location
}}
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.
62 bool MyHand::CanOpen(const wxString& location)
64 return (GetProtocol(location) == "http");
68 Must be overridden in derived handlers.
70 \membersection{wxFileSystemHandler::GetAnchor
}\label{wxfilesystemhandlergetanchor
}
72 \constfunc{wxString
}{GetAnchor
}{\param{const wxString\&
}{location
}}
74 Returns the anchor if present in the location.
75 See
\helpref{wxFSFile
}{wxfsfilegetanchor
} for details.
77 Example: GetAnchor("index.htm\#chapter2") == "chapter2"
79 {\bf Note:
} the anchor is NOT part of the left location.
81 \membersection{wxFileSystemHandler::GetLeftLocation
}\label{wxfilesystemhandlergetleftlocation
}
83 \constfunc{wxString
}{GetLeftLocation
}{\param{const wxString\&
}{location
}}
85 Returns the left location string extracted from
{\it location
}.
87 Example: GetLeftLocation("file:myzipfile.zip\#zip:index.htm") == "file:myzipfile.zip"
89 \membersection{wxFileSystemHandler::GetMimeTypeFromExt
}\label{wxfilesystemhandlergetmimetypefromext
}
91 \func{wxString
}{GetMimeTypeFromExt
}{\param{const wxString\&
}{location
}}
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.)
96 Example : GetMimeTypeFromExt("index.htm") == "text/html"
98 \membersection{wxFileSystemHandler::GetProtocol
}\label{wxfilesystemhandlergetprotocol
}
100 \constfunc{wxString
}{GetProtocol
}{\param{const wxString\&
}{location
}}
102 Returns the protocol string extracted from
{\it location
}.
104 Example: GetProtocol("file:myzipfile.zip\#zip:index.htm") == "zip"
106 \membersection{wxFileSystemHandler::GetRightLocation
}\label{wxfilesystemhandlergetrightlocation
}
108 \constfunc{wxString
}{GetRightLocation
}{\param{const wxString\&
}{location
}}
110 Returns the right location string extracted from
{\it location
}.
112 Example : GetRightLocation("file:myzipfile.zip\#zip:index.htm") == "index.htm"
114 \membersection{wxFileSystemHandler::FindFirst
}\label{wxfilesystemhandlerfindfirst
}
116 \func{virtual wxString
}{FindFirst
}{\param{const wxString\&
}{wildcard
},
\param{int
}{flags =
0}}
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).
122 This method is only called if
\helpref{CanOpen
}{wxfilesystemhandlercanopen
} returns TRUE.
124 \membersection{wxFileSystemHandler::FindNext
}\label{wxfilesystemhandlerfindnext
}
126 \func{virtual wxString
}{FindNext
}{\void}
128 Returns next filename that matches parameters passed to
\helpref{FindFirst
}{wxfilesystemfindfirst
}.
130 This method is only called if
\helpref{CanOpen
}{wxfilesystemhandlercanopen
} returns TRUE and FindFirst
131 returned a non-empty string.
133 \membersection{wxFileSystemHandler::OpenFile
}\label{wxfilesystemhandleropenfile
}
135 \func{virtual wxFSFile*
}{OpenFile
}{\param{wxFileSystem\&
}{fs
},
\param{const wxString\&
}{location
}}
137 Opens the file and returns wxFSFile pointer or NULL if failed.
139 Must be overridden in derived handlers.
141 \wxheading{Parameters
}
143 \docparam{fs
}{Parent FS (the FS from that OpenFile was called). See ZIP handler
144 for details of how to use it.
}
146 \docparam{location
}{The
{\bf absolute
} location of file.
}