1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
|
%
% automatically generated by HelpGen from
% filesystem.tex at 21/Mar/99 23:00:52
%
\section{\class{wxFileSystem}}\label{wxfilesystem}
This class provides an interface for opening files on different
file systems. It can handle absolute and/or local filenames.
It uses a system of \helpref{handlers}{wxfilesystemhandler} to
provide access to user-defined virtual file systems.
\wxheading{Derived from}
\helpref{wxObject}{wxobject}
\wxheading{Include files}
<wx/filesys.h>
\wxheading{See Also}
\helpref{wxFileSystemHandler}{wxfilesystemhandler},
\helpref{wxFSFile}{wxfsfile},
\helpref{Overview}{fs}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxFileSystem::wxFileSystem}\label{wxfilesystemwxfilesystem}
\func{}{wxFileSystem}{\void}
Constructor.
\membersection{wxFileSystem::AddHandler}\label{wxfilesystemaddhandler}
\func{static void}{AddHandler}{\param{wxFileSystemHandler }{*handler}}
This static function adds new handler into the list of
\helpref{handlers}{wxfilesystemhandler} which provide access to virtual FS.
Note that if two handlers for the same protocol are added, the last one added
takes precedence.
\wxheading{Note}
You can call:
\begin{verbatim}
wxFileSystem::AddHandler(new My_FS_Handler);
\end{verbatim}
This is because (a) AddHandler is a static method, and (b) the handlers
are deleted in wxFileSystem's destructor so that you don't have to
care about it.
\membersection{wxFileSystem::HasHandlerForPath}\label{wxfilesystemhashandlerforpath}
\func{static bool}{HasHandlerForPath}{\param{const wxString \&}{ location}}
This static function returns \true if there is a registered handler which can open the given
location.
\membersection{wxFileSystem::ChangePathTo}\label{wxfilesystemchangepathto}
\func{void}{ChangePathTo}{\param{const wxString\& }{location}, \param{bool }{is\_dir = false}}
Sets the current location. {\it location} parameter passed to
\helpref{OpenFile}{wxfilesystemopenfile} is relative to this path.
{\bf Caution! } Unless {\it is\_dir} is true the {\it location} parameter
is not the directory name but the name of the file in this directory. All these
commands change the path to "dir/subdir/":
\begin{verbatim}
ChangePathTo("dir/subdir/xh.htm");
ChangePathTo("dir/subdir", true);
ChangePathTo("dir/subdir/", true);
\end{verbatim}
\wxheading{Parameters}
\docparam{location}{the new location. Its meaning depends on the value of {\it is\_dir}}
\docparam{is\_dir}{if true {\it location} is new directory. If false (default)
{\it location} is {\bf file in} the new directory.}
\wxheading{Example}
\begin{verbatim}
f = fs -> OpenFile("hello.htm"); // opens file 'hello.htm'
fs -> ChangePathTo("subdir/folder", true);
f = fs -> OpenFile("hello.htm"); // opens file 'subdir/folder/hello.htm' !!
\end{verbatim}
\membersection{wxFileSystem::GetPath}\label{wxfilesystemgetpath}
\func{wxString}{GetPath}{\void}
Returns actual path (set by \helpref{ChangePathTo}{wxfilesystemchangepathto}).
\membersection{wxFileSystem::FileNameToURL}\label{wxfilesystemfilenametourl}
\func{static wxString}{FileNameToURL}{\param{wxFileName }{filename}}
Converts filename into URL.
\wxheading{See also}
\helpref{wxFileSystem::URLToFileName}{wxfilesystemurltofilename},
\helpref{wxFileName}{wxfilename}
\membersection{wxFileSystem::FindFileInPath}\label{wxfilesystemfindfileinpath}
\func{bool}{FindFileInPath}{\param{wxString }{*str}, \param{const wxChar }{*path}, \param{const wxChar }{*file}}
Looks for the file with the given name \arg{file} in a colon or semi-colon
(depending on the current platform) separated list of directories in
\arg{path}. If the file is found in any directory, returns \true and the full
path of the file in \arg{str}, otherwise returns \false and doesn't modify
\arg{str}.
\wxheading{Parameters}
\docparam{str}{Receives the full path of the file, must not be \NULL}
\docparam{path}{\texttt{wxPATH\_SEP}-separated list of directories}
\docparam{file}{the name of the file to look for}
\membersection{wxFileSystem::FindFirst}\label{wxfilesystemfindfirst}
\func{wxString}{FindFirst}{\param{const wxString\& }{wildcard}, \param{int }{flags = 0}}
Works like \helpref{wxFindFirstFile}{wxfindfirstfile}. Returns name of the first
filename (within filesystem's current path) that matches {\it wildcard}. {\it flags} may be one of
wxFILE (only files), wxDIR (only directories) or 0 (both).
\membersection{wxFileSystem::FindNext}\label{wxfilesystemfindnext}
\func{wxString}{FindNext}{\void}
Returns the next filename that matches parameters passed to \helpref{FindFirst}{wxfilesystemfindfirst}.
\membersection{wxFileSystem::OpenFile}\label{wxfilesystemopenfile}
\func{wxFSFile*}{OpenFile}{\param{const wxString\& }{location}, \param{int }{flags = wxFS\_READ}}
Opens the file and returns a pointer to a \helpref{wxFSFile}{wxfsfile} object
or NULL if failed. It first tries to open the file in relative scope
(based on value passed to ChangePathTo() method) and then as an
absolute path. Note that the user is responsible for deleting the returned
wxFSFile.
{\it flags} can be one or more of the following bit values ored together:
\begin{verbatim}
// Open Bit Flags
enum {
wxFS_READ = 1, // Open for reading
wxFS_SEEKABLE = 4 // Returned stream will be seekable
};
\end{verbatim}
A stream opened with just the default {\it wxFS\_READ} flag may
or may not be seekable depending on the underlying source.
Passing {\it wxFS\_READ | wxFS\_SEEKABLE} for {\it flags} will
back a stream that is not natively seekable with memory or a file
and return a stream that is always seekable.
\membersection{wxFileSystem::URLToFileName}\label{wxfilesystemurltofilename}
\func{static wxFileName}{URLToFileName}{\param{const wxString\& }{url}}
Converts URL into a well-formed filename. The URL must use the {\tt file}
protocol.
\wxheading{See also}
\helpref{wxFileSystem::FileNameToURL}{wxfilesystemfilenametourl},
\helpref{wxFileName}{wxfilename}
|