% % automatically generated by HelpGen from % filesystemhandler.tex at 21/Mar/99 23:00:52 % \section{\class{wxFileSystemHandler}}\label{wxfilesystemhandler} wxFileSystemHandler (or derived classes to be exact) is used to access virtual file systems. It's public interface consists from two methods: \helpref{CanOpen}{wxfilesystemhandlercanopen} and \helpref{OpenFile}{wxfilesystemhandleropenfile}. It provides additional protected methods to simplify process of opening the file : GetProtocol, GetLeftLocation, GetRightLocation, GetAnchor, GetMimeTypeFromExt. Please have a look at \helpref{overview}{fs} if you don't know how locations are constructed. \wxheading{Notes} \begin{itemize} \item The handlers are shared by all instances of wxFileSystem. \item wxHTML library provides handlers for local files and HTTP or FTP protocol \item The {\it location} parameter passed to OpenFile or CanOpen methods is always {\bf absolute} path. You don't need to check the FS's current path! \end{itemize} \wxheading{Derived from} wxObject \wxheading{See also} \helpref{wxFileSystem}{wxfilesystem}, \helpref{wxFSFile}{wxfsfile}, \helpref{Overview}{fs} \membersection{wxFileSystemHandler::wxFileSystemHandler}\label{wxfilesystemhandlerwxfilesystemhandler} \func{}{wxFileSystemHandler}{\void} Constructor. \membersection{wxFileSystemHandler::CanOpen}\label{wxfilesystemhandlercanopen} \func{virtual bool}{CanOpen}{\param{const wxString\& }{location}} Returns TRUE if the handler is able to open this file (this function doesn't check whether the file exists or not, it only checks if it knows the protocol). Example: \begin{verbatim} bool MyHand::CanOpen(const wxString& location) { return (GetProtocol(location) == "http"); } \end{verbatim} Must be overwriten in derived handlers. \membersection{wxFileSystemHandler::OpenFile}\label{wxfilesystemhandleropenfile} \func{virtual wxFSFile*}{OpenFile}{\param{wxFileSystem\& }{fs}, \param{const wxString\& }{location}} Opens the file and returns wxFSFile pointer or NULL if failed. Must be overwriten in derived handlers. \wxheading{Parameters} \docparam{fs}{Parent FS (the FS from that OpenFile was called). See ZIP handler for details how to use it.} \docparam{location}{The {\bf absolute} location of file.} \membersection{wxFileSystemHandler::GetProtocol}\label{wxfilesystemhandlergetprotocol} \constfunc{wxString}{GetProtocol}{\param{const wxString\& }{location}} Returns protocol string extracted from {\it location}. Example : GetProtocol("file:myzipfile.zip\#zip:index.htm") == "zip" \membersection{wxFileSystemHandler::GetLeftLocation}\label{wxfilesystemhandlergetleftlocation} \constfunc{wxString}{GetLeftLocation}{\param{const wxString\& }{location}} Returns left location string extracted from {\it location}. Example : GetLeftLocation("file:myzipfile.zip\#zip:index.htm") == "file:myzipfile.zip" \membersection{wxFileSystemHandler::GetAnchor}\label{wxfilesystemhandlergetanchor} \constfunc{wxString}{GetAnchor}{\param{const wxString\& }{location}} Returns anchor if present in the location. See \helpref{wxFSFile}{wxfsfilegetanchor} for details. Example : GetAnchor("index.htm\#chapter2") == "chapter2" {\bf Note:} anchor is NOT part of left location. \membersection{wxFileSystemHandler::GetRightLocation}\label{wxfilesystemhandlergetrightlocation} \constfunc{wxString}{GetRightLocation}{\param{const wxString\& }{location}} Returns right location string extracted from {\it location}. Example : GetRightLocation("file:myzipfile.zip\#zip:index.htm") == "index.htm" \membersection{wxFileSystemHandler::GetMimeTypeFromExt}\label{wxfilesystemhandlergetmimetypefromext} \func{wxString}{GetMimeTypeFromExt}{\param{const wxString\& }{location}} Returns MIME type based on {\bf extension} of {\it location}. (While wxFSFile::GetMimeType returns real MIME type - either extension-based or queried from HTTP) Example : GetMimeTypeFromExt("index.htm") == "text/html"