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
|