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