wxFileSystemHandlerClasses derived from wxFileSystemHandler are used to access virtual file systems. Its public interface consists of two methods: CanOpen and OpenFile. It provides additional protected methods to simplify the process of opening the file: GetProtocol, GetLeftLocation, GetRightLocation, GetAnchor, GetMimeTypeFromExt. Please have a look at overview if you don't know how locations are constructed. Also consult list of available handlers. wxPerl note: In wxPerl, you need to derive your file system handler class from Wx::PlFileSystemHandler. Notes
Derived from Include files <wx/filesys.h> See also wxFileSystem, wxFSFile, Overview Members
wxFileSystemHandler::wxFileSystemHandler
wxFileSystemHandler::wxFileSystemHandlerwxFileSystemHandler() Constructor.
wxFileSystemHandler::CanOpenvirtual bool CanOpen(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:
bool MyHand::CanOpen(const wxString& location) { return (GetProtocol(location) == "http"); }Must be overridden in derived handlers.
wxFileSystemHandler::GetAnchorwxString GetAnchor(const wxString& location) const Returns the anchor if present in the location. See wxFSFile for details. Example: GetAnchor("index.htm#chapter2") == "chapter2" Note: the anchor is NOT part of the left location.
wxFileSystemHandler::GetLeftLocationwxString GetLeftLocation(const wxString& location) const Returns the left location string extracted from location. Example: GetLeftLocation("file:myzipfile.zip#zip:index.htm") == "file:myzipfile.zip"
wxFileSystemHandler::GetMimeTypeFromExtwxString GetMimeTypeFromExt(const wxString& location) Returns the MIME type based on extension of location. (While wxFSFile::GetMimeType returns real MIME type - either extension-based or queried from HTTP.) Example : GetMimeTypeFromExt("index.htm") == "text/html"
wxFileSystemHandler::GetProtocolwxString GetProtocol(const wxString& location) const Returns the protocol string extracted from location. Example: GetProtocol("file:myzipfile.zip#zip:index.htm") == "zip"
wxFileSystemHandler::GetRightLocationwxString GetRightLocation(const wxString& location) const Returns the right location string extracted from location. Example : GetRightLocation("file:myzipfile.zip#zip:index.htm") == "index.htm"
wxFileSystemHandler::FindFirstvirtual wxString FindFirst(const wxString& wildcard, int flags = 0) Works like wxFindFirstFile. Returns name of the first filename (within filesystem's current path) that matches wildcard. flags may be one of wxFILE (only files), wxDIR (only directories) or 0 (both). This method is only called if CanOpen returns true.
wxFileSystemHandler::FindNextvirtual wxString FindNext() Returns next filename that matches parameters passed to FindFirst. This method is only called if CanOpen returns true and FindFirst returned a non-empty string.
wxFileSystemHandler::OpenFilevirtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) Opens the file and returns wxFSFile pointer or NULL if failed. Must be overridden in derived handlers. Parameters fs
location
|