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