X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/704a4b7524e05d7bf4d208eb1b30be9989abef4c..4116fac052b9b6f7963b4acf2721a24075692454:/docs/latex/wx/filesysh.tex?ds=sidebyside diff --git a/docs/latex/wx/filesysh.tex b/docs/latex/wx/filesysh.tex index 04159d5e94..34ca77ed22 100644 --- a/docs/latex/wx/filesysh.tex +++ b/docs/latex/wx/filesysh.tex @@ -3,42 +3,49 @@ % 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} +Classes derived from wxFileSystemHandler are used +to access virtual file systems. Its public interface consists +of two methods: \helpref{CanOpen}{wxfilesystemhandlercanopen} and \helpref{OpenFile}{wxfilesystemhandleropenfile}. -It provides additional protected methods to simplify process -of opening the file : GetProtocol, GetLeftLocation, GetRightLocation, +It provides additional protected methods to simplify the 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. +Also consult \helpref{list of available handlers}{fs}. + +\perlnote{In wxPerl, you need to derive your file system handler class +from Wx::PlFileSystemHandler.} \wxheading{Notes} -\begin{itemize} +\begin{itemize}\itemsep=0pt \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! +is always an {\bf absolute} path. You don't need to check the FS's current path. \end{itemize} \wxheading{Derived from} -wxObject +\helpref{wxObject}{wxobject} + +\wxheading{Include files} + + \wxheading{See also} -\helpref{wxFileSystem}{wxfilesystem}, -\helpref{wxFSFile}{wxfsfile}, +\helpref{wxFileSystem}{wxfilesystem}, +\helpref{wxFSFile}{wxfsfile}, \helpref{Overview}{fs} +\latexignore{\rtfignore{\wxheading{Members}}} + \membersection{wxFileSystemHandler::wxFileSystemHandler}\label{wxfilesystemhandlerwxfilesystemhandler} @@ -50,8 +57,8 @@ Constructor. \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). +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} @@ -61,68 +68,83 @@ bool MyHand::CanOpen(const wxString& location) } \end{verbatim} -Must be overwriten in derived handlers. +Must be overridden in derived handlers. -\membersection{wxFileSystemHandler::OpenFile}\label{wxfilesystemhandleropenfile} +\membersection{wxFileSystemHandler::GetAnchor}\label{wxfilesystemhandlergetanchor} -\func{virtual wxFSFile*}{OpenFile}{\param{wxFileSystem\& }{fs}, \param{const wxString\& }{location}} +\constfunc{wxString}{GetAnchor}{\param{const wxString\& }{location}} -Opens the file and returns wxFSFile pointer or NULL if failed. +Returns the anchor if present in the location. +See \helpref{wxFSFile}{wxfsfilegetanchor} for details. -Must be overwriten in derived handlers. +Example: GetAnchor("index.htm\#chapter2") == "chapter2" -\wxheading{Parameters} +{\bf Note:} the anchor is NOT part of the left location. -\docparam{fs}{Parent FS (the FS from that OpenFile was called). See ZIP handler -for details how to use it.} +\membersection{wxFileSystemHandler::GetLeftLocation}\label{wxfilesystemhandlergetleftlocation} -\docparam{location}{The {\bf absolute} location of file.} +\constfunc{wxString}{GetLeftLocation}{\param{const wxString\& }{location}} +Returns the left location string extracted from {\it location}. + +Example: GetLeftLocation("file:myzipfile.zip\#zip:index.htm") == "file:myzipfile.zip" + +\membersection{wxFileSystemHandler::GetMimeTypeFromExt}\label{wxfilesystemhandlergetmimetypefromext} + +\func{wxString}{GetMimeTypeFromExt}{\param{const wxString\& }{location}} +Returns the 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" \membersection{wxFileSystemHandler::GetProtocol}\label{wxfilesystemhandlergetprotocol} \constfunc{wxString}{GetProtocol}{\param{const wxString\& }{location}} -Returns protocol string extracted from {\it location}. +Returns the protocol string extracted from {\it location}. -Example : GetProtocol("file:myzipfile.zip\#zip:index.htm") == "zip" +Example: GetProtocol("file:myzipfile.zip\#zip:index.htm") == "zip" -\membersection{wxFileSystemHandler::GetLeftLocation}\label{wxfilesystemhandlergetleftlocation} +\membersection{wxFileSystemHandler::GetRightLocation}\label{wxfilesystemhandlergetrightlocation} -\constfunc{wxString}{GetLeftLocation}{\param{const wxString\& }{location}} +\constfunc{wxString}{GetRightLocation}{\param{const wxString\& }{location}} -Returns left location string extracted from {\it location}. +Returns the right location string extracted from {\it location}. -Example : GetLeftLocation("file:myzipfile.zip\#zip:index.htm") == "file:myzipfile.zip" +Example : GetRightLocation("file:myzipfile.zip\#zip:index.htm") == "index.htm" +\membersection{wxFileSystemHandler::FindFirst}\label{wxfilesystemhandlerfindfirst} -\membersection{wxFileSystemHandler::GetAnchor}\label{wxfilesystemhandlergetanchor} +\func{virtual wxString}{FindFirst}{\param{const wxString\& }{wildcard}, \param{int }{flags = 0}} -\constfunc{wxString}{GetAnchor}{\param{const wxString\& }{location}} +Works like \helpref{wxFindFirstFile}{wxfindfirstfile}. Returns name of the first +filename (within filesystem's current path) that matches {\it wildcard}. {\it flags} may be one of +wxFILE (only files), wxDIR (only directories) or 0 (both). -Returns anchor if present in the location. -See \helpref{wxFSFile}{wxfsfilegetanchor} for details. +This method is only called if \helpref{CanOpen}{wxfilesystemhandlercanopen} returns true. -Example : GetAnchor("index.htm\#chapter2") == "chapter2" +\membersection{wxFileSystemHandler::FindNext}\label{wxfilesystemhandlerfindnext} -{\bf Note:} anchor is NOT part of left location. +\func{virtual wxString}{FindNext}{\void} -\membersection{wxFileSystemHandler::GetRightLocation}\label{wxfilesystemhandlergetrightlocation} +Returns next filename that matches parameters passed to \helpref{FindFirst}{wxfilesystemfindfirst}. -\constfunc{wxString}{GetRightLocation}{\param{const wxString\& }{location}} +This method is only called if \helpref{CanOpen}{wxfilesystemhandlercanopen} returns true and FindFirst +returned a non-empty string. -Returns right location string extracted from {\it location}. +\membersection{wxFileSystemHandler::OpenFile}\label{wxfilesystemhandleropenfile} -Example : GetRightLocation("file:myzipfile.zip\#zip:index.htm") == "index.htm" +\func{virtual wxFSFile*}{OpenFile}{\param{wxFileSystem\& }{fs}, \param{const wxString\& }{location}} +Opens the file and returns wxFSFile pointer or NULL if failed. -\membersection{wxFileSystemHandler::GetMimeTypeFromExt}\label{wxfilesystemhandlergetmimetypefromext} +Must be overridden in derived handlers. -\func{wxString}{GetMimeTypeFromExt}{\param{const wxString\& }{location}} +\wxheading{Parameters} -Returns MIME type based on {\bf extension} of {\it location}. (While wxFSFile::GetMimeType -returns real MIME type - either extension-based or queried from HTTP) +\docparam{fs}{Parent FS (the FS from that OpenFile was called). See ZIP handler +for details of how to use it.} -Example : GetMimeTypeFromExt("index.htm") == "text/html" +\docparam{location}{The {\bf absolute} location of file.}