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