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