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
}.
21 \perlnote{In wxPerl, you need to derive your file system handler class
22 from Wx::PlFileSystemHandler.
}
26 \begin{itemize
}\itemsep=
0pt
27 \item The handlers are shared by all instances of wxFileSystem.
28 \item wxHTML library provides handlers for local files and HTTP or FTP protocol
29 \item The
{\it location
} parameter passed to OpenFile or CanOpen methods
30 is always an
{\bf absolute
} path. You don't need to check the FS's current path.
33 \wxheading{Derived from
}
35 \helpref{wxObject
}{wxobject
}
37 \wxheading{Include files
}
43 \helpref{wxBase
}{librarieslist
}
47 \helpref{wxFileSystem
}{wxfilesystem
},
48 \helpref{wxFSFile
}{wxfsfile
},
49 \helpref{Overview
}{fs
}
51 \latexignore{\rtfignore{\wxheading{Members
}}}
54 \membersection{wxFileSystemHandler::wxFileSystemHandler
}\label{wxfilesystemhandlerwxfilesystemhandler
}
56 \func{}{wxFileSystemHandler
}{\void}
60 \membersection{wxFileSystemHandler::CanOpen
}\label{wxfilesystemhandlercanopen
}
62 \func{virtual bool
}{CanOpen
}{\param{const wxString\&
}{location
}}
64 Returns true if the handler is able to open this file. This function doesn't
65 check whether the file exists or not, it only checks if it knows the protocol.
69 bool MyHand::CanOpen(const wxString& location)
71 return (GetProtocol(location) == "http");
75 Must be overridden in derived handlers.
77 \membersection{wxFileSystemHandler::GetAnchor
}\label{wxfilesystemhandlergetanchor
}
79 \constfunc{wxString
}{GetAnchor
}{\param{const wxString\&
}{location
}}
81 Returns the anchor if present in the location.
82 See
\helpref{wxFSFile
}{wxfsfilegetanchor
} for details.
84 Example: GetAnchor("index.htm\#chapter2") == "chapter2"
86 {\bf Note:
} the anchor is NOT part of the left location.
88 \membersection{wxFileSystemHandler::GetLeftLocation
}\label{wxfilesystemhandlergetleftlocation
}
90 \constfunc{wxString
}{GetLeftLocation
}{\param{const wxString\&
}{location
}}
92 Returns the left location string extracted from
{\it location
}.
94 Example: GetLeftLocation("file:myzipfile.zip\#zip:index.htm") == "file:myzipfile.zip"
96 \membersection{wxFileSystemHandler::GetMimeTypeFromExt
}\label{wxfilesystemhandlergetmimetypefromext
}
98 \func{wxString
}{GetMimeTypeFromExt
}{\param{const wxString\&
}{location
}}
100 Returns the MIME type based on
{\bf extension
} of
{\it location
}. (While wxFSFile::GetMimeType
101 returns real MIME type - either extension-based or queried from HTTP.)
103 Example : GetMimeTypeFromExt("index.htm") == "text/html"
105 \membersection{wxFileSystemHandler::GetProtocol
}\label{wxfilesystemhandlergetprotocol
}
107 \constfunc{wxString
}{GetProtocol
}{\param{const wxString\&
}{location
}}
109 Returns the protocol string extracted from
{\it location
}.
111 Example: GetProtocol("file:myzipfile.zip\#zip:index.htm") == "zip"
113 \membersection{wxFileSystemHandler::GetRightLocation
}\label{wxfilesystemhandlergetrightlocation
}
115 \constfunc{wxString
}{GetRightLocation
}{\param{const wxString\&
}{location
}}
117 Returns the right location string extracted from
{\it location
}.
119 Example : GetRightLocation("file:myzipfile.zip\#zip:index.htm") == "index.htm"
121 \membersection{wxFileSystemHandler::FindFirst
}\label{wxfilesystemhandlerfindfirst
}
123 \func{virtual wxString
}{FindFirst
}{\param{const wxString\&
}{wildcard
},
\param{int
}{flags =
0}}
125 Works like
\helpref{wxFindFirstFile
}{wxfindfirstfile
}. Returns name of the first
126 filename (within filesystem's current path) that matches
{\it wildcard
}.
{\it flags
} may be one of
127 wxFILE (only files), wxDIR (only directories) or
0 (both).
129 This method is only called if
\helpref{CanOpen
}{wxfilesystemhandlercanopen
} returns true.
131 \membersection{wxFileSystemHandler::FindNext
}\label{wxfilesystemhandlerfindnext
}
133 \func{virtual wxString
}{FindNext
}{\void}
135 Returns next filename that matches parameters passed to
\helpref{FindFirst
}{wxfilesystemfindfirst
}.
137 This method is only called if
\helpref{CanOpen
}{wxfilesystemhandlercanopen
} returns true and FindFirst
138 returned a non-empty string.
140 \membersection{wxFileSystemHandler::OpenFile
}\label{wxfilesystemhandleropenfile
}
142 \func{virtual wxFSFile*
}{OpenFile
}{\param{wxFileSystem\&
}{fs
},
\param{const wxString\&
}{location
}}
144 Opens the file and returns wxFSFile pointer or NULL if failed.
146 Must be overridden in derived handlers.
148 \wxheading{Parameters
}
150 \docparam{fs
}{Parent FS (the FS from that OpenFile was called). See ZIP handler
151 for details of how to use it.
}
153 \docparam{location
}{The
{\bf absolute
} location of file.
}