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
21 \begin{itemize
}\itemsep=
0pt
22 \item The handlers are shared by all instances of wxFileSystem.
23 \item wxHTML library provides handlers for local files and HTTP or FTP protocol
24 \item The
{\it location
} parameter passed to OpenFile or CanOpen methods
25 is always an
{\bf absolute
} path. You don't need to check the FS's current path.
28 \wxheading{Derived from
}
34 \helpref{wxFileSystem
}{wxfilesystem
},
35 \helpref{wxFSFile
}{wxfsfile
},
36 \helpref{Overview
}{fs
}
38 \membersection{wxFileSystemHandler::wxFileSystemHandler
}\label{wxfilesystemhandlerwxfilesystemhandler
}
40 \func{}{wxFileSystemHandler
}{\void}
44 \membersection{wxFileSystemHandler::CanOpen
}\label{wxfilesystemhandlercanopen
}
46 \func{virtual bool
}{CanOpen
}{\param{const wxString\&
}{location
}}
48 Returns TRUE if the handler is able to open this file. This function doesn't
49 check whether the file exists or not, it only checks if it knows the protocol.
53 bool MyHand::CanOpen(const wxString& location)
55 return (GetProtocol(location) == "http");
59 Must be overridden in derived handlers.
61 \membersection{wxFileSystemHandler::GetAnchor
}\label{wxfilesystemhandlergetanchor
}
63 \constfunc{wxString
}{GetAnchor
}{\param{const wxString\&
}{location
}}
65 Returns the anchor if present in the location.
66 See
\helpref{wxFSFile
}{wxfsfilegetanchor
} for details.
68 Example: GetAnchor("index.htm\#chapter2") == "chapter2"
70 {\bf Note:
} the anchor is NOT part of the left location.
72 \membersection{wxFileSystemHandler::GetLeftLocation
}\label{wxfilesystemhandlergetleftlocation
}
74 \constfunc{wxString
}{GetLeftLocation
}{\param{const wxString\&
}{location
}}
76 Returns the left location string extracted from
{\it location
}.
78 Example: GetLeftLocation("file:myzipfile.zip\#zip:index.htm") == "file:myzipfile.zip"
80 \membersection{wxFileSystemHandler::GetMimeTypeFromExt
}\label{wxfilesystemhandlergetmimetypefromext
}
82 \func{wxString
}{GetMimeTypeFromExt
}{\param{const wxString\&
}{location
}}
84 Returns the MIME type based on
{\bf extension
} of
{\it location
}. (While wxFSFile::GetMimeType
85 returns real MIME type - either extension-based or queried from HTTP.)
87 Example : GetMimeTypeFromExt("index.htm") == "text/html"
89 \membersection{wxFileSystemHandler::GetProtocol
}\label{wxfilesystemhandlergetprotocol
}
91 \constfunc{wxString
}{GetProtocol
}{\param{const wxString\&
}{location
}}
93 Returns the protocol string extracted from
{\it location
}.
95 Example: GetProtocol("file:myzipfile.zip\#zip:index.htm") == "zip"
97 \membersection{wxFileSystemHandler::GetRightLocation
}\label{wxfilesystemhandlergetrightlocation
}
99 \constfunc{wxString
}{GetRightLocation
}{\param{const wxString\&
}{location
}}
101 Returns the right location string extracted from
{\it location
}.
103 Example : GetRightLocation("file:myzipfile.zip\#zip:index.htm") == "index.htm"
105 \membersection{wxFileSystemHandler::FindFirst
}\label{wxfilesystemhandlerfindfirst
}
107 \func{virtual wxString
}{FindFirst
}{\param{const wxString\&
}{wildcard
},
\param{int
}{flags =
0}}
109 Works like
\helpref{wxFindFirstFile
}{wxfindfirstfile
}. Returns name of the first
110 filename (withing filesystem's current path) that matches
{\it wildcard
}.
{\it flags
} may be one of
111 wxFILE (only files), wxDIR (only directories) or
0 (both).
113 This method is only called if
\helpref{CanOpen
}{wxfilesystemhandlercanopen
} returns TRUE.
115 \membersection{wxFileSystemHandler::FindNext
}\label{wxfilesystemhandlerfindnext
}
117 \func{virtual wxString
}{FindNext
}{\void}
119 Returns next filename that matches parameters passed to
\helpref{FindFirst
}{wxfilesystemfindfirst
}.
121 This method is only called if
\helpref{CanOpen
}{wxfilesystemhandlercanopen
} returns TRUE and FindFirst
122 returned a non-empty string.
124 \membersection{wxFileSystemHandler::OpenFile
}\label{wxfilesystemhandleropenfile
}
126 \func{virtual wxFSFile*
}{OpenFile
}{\param{wxFileSystem\&
}{fs
},
\param{const wxString\&
}{location
}}
128 Opens the file and returns wxFSFile pointer or NULL if failed.
130 Must be overridden in derived handlers.
132 \wxheading{Parameters
}
134 \docparam{fs
}{Parent FS (the FS from that OpenFile was called). See ZIP handler
135 for details of how to use it.
}
137 \docparam{location
}{The
{\bf absolute
} location of file.
}