2 % automatically generated by HelpGen from
3 % filesystemhandler.tex at 21/Mar/99 23:00:52
7 \section{\class{wxFileSystemHandler
}}\label{wxfilesystemhandler
}
9 wxFileSystemHandler (or derived classes to be exact) is used
10 to access virtual file systems. It's public interface consists
11 from two methods:
\helpref{CanOpen
}{wxfilesystemhandlercanopen
}
12 and
\helpref{OpenFile
}{wxfilesystemhandleropenfile
}.
13 It provides additional protected methods to simplify process
14 of opening the file : GetProtocol, GetLeftLocation, GetRightLocation,
15 GetAnchor, GetMimeTypeFromExt.
17 Please have a look at
\helpref{overview
}{fs
} if you don't know how locations
24 \item The handlers are shared by all instances of wxFileSystem.
26 \item wxHTML library provides handlers for local files and HTTP or FTP protocol
28 \item The
{\it location
} parameter passed to OpenFile or CanOpen methods
29 is always
{\bf absolute
} path. You don't need to check the FS's current path!
32 \wxheading{Derived from
}
38 \helpref{wxFileSystem
}{wxfilesystem
},
39 \helpref{wxFSFile
}{wxfsfile
},
40 \helpref{Overview
}{fs
}
43 \membersection{wxFileSystemHandler::wxFileSystemHandler
}\label{wxfilesystemhandlerwxfilesystemhandler
}
45 \func{}{wxFileSystemHandler
}{\void}
49 \membersection{wxFileSystemHandler::CanOpen
}\label{wxfilesystemhandlercanopen
}
51 \func{virtual bool
}{CanOpen
}{\param{const wxString\&
}{location
}}
53 Returns TRUE if the handler is able to open this file (this function doesn't
54 check whether the file exists or not, it only checks if it knows the protocol).
58 bool MyHand::CanOpen(const wxString& location)
60 return (GetProtocol(location) == "http");
64 Must be overwriten in derived handlers.
66 \membersection{wxFileSystemHandler::OpenFile
}\label{wxfilesystemhandleropenfile
}
68 \func{virtual wxFSFile*
}{OpenFile
}{\param{wxFileSystem\&
}{fs
},
\param{const wxString\&
}{location
}}
70 Opens the file and returns wxFSFile pointer or NULL if failed.
72 Must be overwriten in derived handlers.
74 \wxheading{Parameters
}
76 \docparam{fs
}{Parent FS (the FS from that OpenFile was called). See ZIP handler
77 for details how to use it.
}
79 \docparam{location
}{The
{\bf absolute
} location of file.
}
83 \membersection{wxFileSystemHandler::GetProtocol
}\label{wxfilesystemhandlergetprotocol
}
85 \constfunc{wxString
}{GetProtocol
}{\param{const wxString\&
}{location
}}
87 Returns protocol string extracted from
{\it location
}.
89 Example : GetProtocol("file:myzipfile.zip\#zip:index.htm") == "zip"
91 \membersection{wxFileSystemHandler::GetLeftLocation
}\label{wxfilesystemhandlergetleftlocation
}
93 \constfunc{wxString
}{GetLeftLocation
}{\param{const wxString\&
}{location
}}
95 Returns left location string extracted from
{\it location
}.
97 Example : GetLeftLocation("file:myzipfile.zip\#zip:index.htm") == "file:myzipfile.zip"
100 \membersection{wxFileSystemHandler::GetAnchor
}\label{wxfilesystemhandlergetanchor
}
102 \constfunc{wxString
}{GetAnchor
}{\param{const wxString\&
}{location
}}
104 Returns anchor if present in the location.
105 See
\helpref{wxFSFile
}{wxfsfilegetanchor
} for details.
107 Example : GetAnchor("index.htm\#chapter2") == "chapter2"
109 {\bf Note:
} anchor is NOT part of left location.
111 \membersection{wxFileSystemHandler::GetRightLocation
}\label{wxfilesystemhandlergetrightlocation
}
113 \constfunc{wxString
}{GetRightLocation
}{\param{const wxString\&
}{location
}}
115 Returns right location string extracted from
{\it location
}.
117 Example : GetRightLocation("file:myzipfile.zip\#zip:index.htm") == "index.htm"
120 \membersection{wxFileSystemHandler::GetMimeTypeFromExt
}\label{wxfilesystemhandlergetmimetypefromext
}
122 \func{wxString
}{GetMimeTypeFromExt
}{\param{const wxString\&
}{location
}}
124 Returns MIME type based on
{\bf extension
} of
{\it location
}. (While wxFSFile::GetMimeType
125 returns real MIME type - either extension-based or queried from HTTP)
127 Example : GetMimeTypeFromExt("index.htm") == "text/html"