1999-07-10 17:17:24 -04:00
|
|
|
%
|
|
|
|
% automatically generated by HelpGen from
|
|
|
|
% filesystemhandler.tex at 21/Mar/99 23:00:52
|
|
|
|
%
|
|
|
|
|
|
|
|
\section{\class{wxFileSystemHandler}}\label{wxfilesystemhandler}
|
|
|
|
|
1999-11-01 15:36:43 -05:00
|
|
|
Classes derived from wxFileSystemHandler are used
|
|
|
|
to access virtual file systems. Its public interface consists
|
|
|
|
of two methods: \helpref{CanOpen}{wxfilesystemhandlercanopen}
|
1999-07-10 17:17:24 -04:00
|
|
|
and \helpref{OpenFile}{wxfilesystemhandleropenfile}.
|
1999-11-01 15:36:43 -05:00
|
|
|
It provides additional protected methods to simplify the process
|
|
|
|
of opening the file: GetProtocol, GetLeftLocation, GetRightLocation,
|
1999-07-10 17:17:24 -04:00
|
|
|
GetAnchor, GetMimeTypeFromExt.
|
|
|
|
|
|
|
|
Please have a look at \helpref{overview}{fs} if you don't know how locations
|
|
|
|
are constructed.
|
|
|
|
|
2000-02-27 16:06:58 -05:00
|
|
|
Also consult \helpref{list of available handlers}{fs}.
|
|
|
|
|
2002-07-05 12:43:21 -04:00
|
|
|
\perlnote{In wxPerl, you need to derive your file system handler class
|
|
|
|
from Wx::PlFileSystemHandler.}
|
|
|
|
|
1999-07-10 17:17:24 -04:00
|
|
|
\wxheading{Notes}
|
|
|
|
|
1999-11-01 15:36:43 -05:00
|
|
|
\begin{itemize}\itemsep=0pt
|
1999-07-10 17:17:24 -04:00
|
|
|
\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
|
1999-11-01 15:36:43 -05:00
|
|
|
is always an {\bf absolute} path. You don't need to check the FS's current path.
|
1999-07-10 17:17:24 -04:00
|
|
|
\end{itemize}
|
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
2000-02-27 16:06:58 -05:00
|
|
|
\helpref{wxObject}{wxobject}
|
|
|
|
|
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/filesys.h>
|
1999-07-10 17:17:24 -04:00
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
1999-11-01 15:36:43 -05:00
|
|
|
\helpref{wxFileSystem}{wxfilesystem},
|
|
|
|
\helpref{wxFSFile}{wxfsfile},
|
1999-07-10 17:17:24 -04:00
|
|
|
\helpref{Overview}{fs}
|
|
|
|
|
2000-02-27 16:06:58 -05:00
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
|
|
|
|
1999-07-10 17:17:24 -04:00
|
|
|
\membersection{wxFileSystemHandler::wxFileSystemHandler}\label{wxfilesystemhandlerwxfilesystemhandler}
|
|
|
|
|
|
|
|
\func{}{wxFileSystemHandler}{\void}
|
|
|
|
|
|
|
|
Constructor.
|
|
|
|
|
|
|
|
\membersection{wxFileSystemHandler::CanOpen}\label{wxfilesystemhandlercanopen}
|
|
|
|
|
|
|
|
\func{virtual bool}{CanOpen}{\param{const wxString\& }{location}}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
Returns true if the handler is able to open this file. This function doesn't
|
1999-11-01 15:36:43 -05:00
|
|
|
check whether the file exists or not, it only checks if it knows the protocol.
|
1999-07-10 17:17:24 -04:00
|
|
|
Example:
|
|
|
|
|
|
|
|
\begin{verbatim}
|
|
|
|
bool MyHand::CanOpen(const wxString& location)
|
|
|
|
{
|
|
|
|
return (GetProtocol(location) == "http");
|
|
|
|
}
|
|
|
|
\end{verbatim}
|
|
|
|
|
1999-11-01 15:36:43 -05:00
|
|
|
Must be overridden in derived handlers.
|
1999-07-10 17:17:24 -04:00
|
|
|
|
1999-10-16 11:38:26 -04:00
|
|
|
\membersection{wxFileSystemHandler::GetAnchor}\label{wxfilesystemhandlergetanchor}
|
1999-07-10 17:17:24 -04:00
|
|
|
|
1999-10-16 11:38:26 -04:00
|
|
|
\constfunc{wxString}{GetAnchor}{\param{const wxString\& }{location}}
|
1999-07-10 17:17:24 -04:00
|
|
|
|
1999-11-01 15:36:43 -05:00
|
|
|
Returns the anchor if present in the location.
|
1999-10-16 11:38:26 -04:00
|
|
|
See \helpref{wxFSFile}{wxfsfilegetanchor} for details.
|
1999-07-10 17:17:24 -04:00
|
|
|
|
1999-11-01 15:36:43 -05:00
|
|
|
Example: GetAnchor("index.htm\#chapter2") == "chapter2"
|
1999-07-10 17:17:24 -04:00
|
|
|
|
1999-11-01 15:36:43 -05:00
|
|
|
{\bf Note:} the anchor is NOT part of the left location.
|
1999-07-10 17:17:24 -04:00
|
|
|
|
|
|
|
\membersection{wxFileSystemHandler::GetLeftLocation}\label{wxfilesystemhandlergetleftlocation}
|
|
|
|
|
|
|
|
\constfunc{wxString}{GetLeftLocation}{\param{const wxString\& }{location}}
|
|
|
|
|
1999-11-01 15:36:43 -05:00
|
|
|
Returns the left location string extracted from {\it location}.
|
1999-07-10 17:17:24 -04:00
|
|
|
|
1999-08-05 18:05:15 -04:00
|
|
|
Example: GetLeftLocation("file:myzipfile.zip\#zip:index.htm") == "file:myzipfile.zip"
|
1999-07-10 17:17:24 -04:00
|
|
|
|
1999-10-16 11:38:26 -04:00
|
|
|
\membersection{wxFileSystemHandler::GetMimeTypeFromExt}\label{wxfilesystemhandlergetmimetypefromext}
|
1999-07-10 17:17:24 -04:00
|
|
|
|
1999-10-16 11:38:26 -04:00
|
|
|
\func{wxString}{GetMimeTypeFromExt}{\param{const wxString\& }{location}}
|
1999-07-10 17:17:24 -04:00
|
|
|
|
1999-11-01 15:36:43 -05:00
|
|
|
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.)
|
1999-07-10 17:17:24 -04:00
|
|
|
|
1999-10-16 11:38:26 -04:00
|
|
|
Example : GetMimeTypeFromExt("index.htm") == "text/html"
|
1999-07-10 17:17:24 -04:00
|
|
|
|
1999-10-16 11:38:26 -04:00
|
|
|
\membersection{wxFileSystemHandler::GetProtocol}\label{wxfilesystemhandlergetprotocol}
|
|
|
|
|
|
|
|
\constfunc{wxString}{GetProtocol}{\param{const wxString\& }{location}}
|
|
|
|
|
1999-11-01 15:36:43 -05:00
|
|
|
Returns the protocol string extracted from {\it location}.
|
1999-10-16 11:38:26 -04:00
|
|
|
|
|
|
|
Example: GetProtocol("file:myzipfile.zip\#zip:index.htm") == "zip"
|
1999-07-10 17:17:24 -04:00
|
|
|
|
|
|
|
\membersection{wxFileSystemHandler::GetRightLocation}\label{wxfilesystemhandlergetrightlocation}
|
|
|
|
|
|
|
|
\constfunc{wxString}{GetRightLocation}{\param{const wxString\& }{location}}
|
|
|
|
|
1999-11-01 15:36:43 -05:00
|
|
|
Returns the right location string extracted from {\it location}.
|
1999-07-10 17:17:24 -04:00
|
|
|
|
|
|
|
Example : GetRightLocation("file:myzipfile.zip\#zip:index.htm") == "index.htm"
|
|
|
|
|
1999-11-02 09:04:44 -05:00
|
|
|
\membersection{wxFileSystemHandler::FindFirst}\label{wxfilesystemhandlerfindfirst}
|
1999-10-31 17:05:10 -05:00
|
|
|
|
|
|
|
\func{virtual wxString}{FindFirst}{\param{const wxString\& }{wildcard}, \param{int }{flags = 0}}
|
|
|
|
|
|
|
|
Works like \helpref{wxFindFirstFile}{wxfindfirstfile}. Returns name of the first
|
2002-06-07 16:15:28 -04:00
|
|
|
filename (within filesystem's current path) that matches {\it wildcard}. {\it flags} may be one of
|
1999-10-31 17:05:10 -05:00
|
|
|
wxFILE (only files), wxDIR (only directories) or 0 (both).
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
This method is only called if \helpref{CanOpen}{wxfilesystemhandlercanopen} returns true.
|
1999-10-31 17:05:10 -05:00
|
|
|
|
1999-11-02 09:04:44 -05:00
|
|
|
\membersection{wxFileSystemHandler::FindNext}\label{wxfilesystemhandlerfindnext}
|
1999-10-31 17:05:10 -05:00
|
|
|
|
|
|
|
\func{virtual wxString}{FindNext}{\void}
|
|
|
|
|
|
|
|
Returns next filename that matches parameters passed to \helpref{FindFirst}{wxfilesystemfindfirst}.
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
This method is only called if \helpref{CanOpen}{wxfilesystemhandlercanopen} returns true and FindFirst
|
1999-11-01 15:36:43 -05:00
|
|
|
returned a non-empty string.
|
1999-10-31 17:05:10 -05:00
|
|
|
|
1999-10-16 11:38:26 -04:00
|
|
|
\membersection{wxFileSystemHandler::OpenFile}\label{wxfilesystemhandleropenfile}
|
1999-07-10 17:17:24 -04:00
|
|
|
|
1999-10-16 11:38:26 -04:00
|
|
|
\func{virtual wxFSFile*}{OpenFile}{\param{wxFileSystem\& }{fs}, \param{const wxString\& }{location}}
|
1999-07-10 17:17:24 -04:00
|
|
|
|
1999-10-16 11:38:26 -04:00
|
|
|
Opens the file and returns wxFSFile pointer or NULL if failed.
|
1999-07-10 17:17:24 -04:00
|
|
|
|
1999-11-01 15:36:43 -05:00
|
|
|
Must be overridden in derived handlers.
|
1999-10-16 11:38:26 -04:00
|
|
|
|
|
|
|
\wxheading{Parameters}
|
|
|
|
|
|
|
|
\docparam{fs}{Parent FS (the FS from that OpenFile was called). See ZIP handler
|
1999-11-01 15:36:43 -05:00
|
|
|
for details of how to use it.}
|
1999-10-16 11:38:26 -04:00
|
|
|
|
|
|
|
\docparam{location}{The {\bf absolute} location of file.}
|
1999-07-10 17:17:24 -04:00
|
|
|
|