]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/filename.tex
wxTipWindow is now a wxPopupTransientWindow instead of a wxFrame.
[wxWidgets.git] / docs / latex / wx / filename.tex
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %% Name: filename.tex
3 %% Purpose: wxFileName documentation
4 %% Author: Vadim Zeitlin
5 %% Modified by:
6 %% Created: 30.11.01
7 %% RCS-ID: $Id$
8 %% Copyright: (c) 2001 Vadim Zeitlin
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12 \section{\class{wxFileName}}\label{wxfilename}
13
14 wxFileName encapsulates a file name. This class serves two purposes: first, it
15 provides the functions to split the file names into components and to recombine
16 these components in the full file name which can then be passed to the OS file
17 functions (and \helpref{wxWindows functions}{filefunctions} wrapping them).
18 Second, it includes the functions for working with the files itself. Note that
19 to change the file data you should use \helpref{wxFile}{wxfile} class instead,
20 wxFileName provides functions for working with the file attributes.
21
22 \wxheading{Derived from}
23
24 No base class
25
26 \wxheading{Data structures}
27
28 Many wxFileName methods accept the path format argument which is by\rtfsp
29 {\tt wxPATH\_NATIVE} by default meaning to use the path format native for the
30 current platform.
31
32 The path format affects the operation of wxFileName functions in several ways:
33 first and foremost, it defines the path separator character to use, but it also
34 affects other things such as whether the path has the drive part or not.
35
36 \begin{verbatim}
37 enum wxPathFormat
38 {
39 wxPATH_NATIVE = 0, // the path format for the current platform
40 wxPATH_UNIX,
41 wxPATH_MAC,
42 wxPATH_DOS,
43 wxPATH_VMS,
44
45 wxPATH_BEOS = wxPATH_UNIX,
46 wxPATH_WIN = wxPATH_DOS,
47 wxPATH_OS2 = wxPATH_DOS
48 }
49 \end{verbatim}
50
51 The kind of normalization to do with the file name: these values can be
52 or'd together to perform several operations at once in\rtfsp
53 \helpref{Normalize}{wxfilenamenormalize}.
54
55 \begin{verbatim}
56 enum wxPathNormalize
57 {
58 wxPATH_NORM_ENV_VARS = 0x0001, // replace env vars with their values
59 wxPATH_NORM_DOTS = 0x0002, // squeeze all .. and . and prepend cwd
60 wxPATH_NORM_TILDE = 0x0004, // Unix only: replace ~ and ~user
61 wxPATH_NORM_CASE = 0x0008, // if case insensitive => tolower
62 wxPATH_NORM_ABSOLUTE = 0x0010, // make the path absolute
63 wxPATH_NORM_LONG = 0x0020, // make the path the long form
64 wxPATH_NORM_ALL = 0x003f
65 }
66 \end{verbatim}
67
68 \latexignore{\rtfignore{\wxheading{Members}}}
69
70 \membersection{wxFileName::wxFileName}\label{wxfilenamewxfilenamedef}
71
72 \func{}{wxFileName}{\void}
73
74 Default constructor.
75
76 \membersection{wxFileName::wxFileName}\label{wxfilenamewxfilenamecopy}
77
78 \func{}{wxFileName}{\param{const wxFileName\& }{filename}}
79
80 Copy constructor.
81
82 \membersection{wxFileName::wxFileName}\label{wxfilenamewxfilename1}
83
84 \func{}{wxFileName}{\param{const wxString\& }{fullpath}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
85
86 from a full filename: if it terminates with a '/', a directory path
87 is contructed (the name will be empty), otherwise a file name and
88 extension are extracted from it
89
90
91 \membersection{wxFileName::wxFileName}\label{wxfilenamewxfilename2}
92
93 \func{}{wxFileName}{\param{const wxString\& }{path}, \param{const wxString\& }{name}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
94
95 from a directory name and a file name
96
97
98 \membersection{wxFileName::wxFileName}\label{wxfilenamewxfilename3}
99
100 \func{}{wxFileName}{\param{const wxString\& }{path}, \param{const wxString\& }{name}, \param{const wxString\& }{ext}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
101
102 from a directory name, file base name and extension
103
104
105 \membersection{wxFileName::AppendDir}\label{wxfilenameappenddir}
106
107 \func{void}{AppendDir}{\param{const wxString\& }{dir}}
108
109
110 \membersection{wxFileName::Assign}\label{wxfilenameassign}
111
112 \func{void}{Assign}{\param{const wxFileName\& }{filepath}}
113
114
115 \membersection{wxFileName::Assign}\label{wxfilenameassign}
116
117 \func{void}{Assign}{\param{const wxString\& }{fullpath}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
118
119
120 \membersection{wxFileName::Assign}\label{wxfilenameassign}
121
122 \func{void}{Assign}{\param{const wxString\& }{volume}, \param{const wxString\& }{path}, \param{const wxString\& }{name}, \param{const wxString\& }{ext}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
123
124
125 \membersection{wxFileName::Assign}\label{wxfilenameassign}
126
127 \func{void}{Assign}{\param{const wxString\& }{path}, \param{const wxString\& }{name}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
128
129
130 \membersection{wxFileName::Assign}\label{wxfilenameassign}
131
132 \func{void}{Assign}{\param{const wxString\& }{path}, \param{const wxString\& }{name}, \param{const wxString\& }{ext}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
133
134
135 \membersection{wxFileName::AssignCwd}\label{wxfilenameassigncwd}
136
137 \func{void}{AssignCwd}{\void}
138
139 various file/dir operations
140 retrieve the value of the current working directory
141
142
143 \membersection{wxFileName::AssignDir}\label{wxfilenameassigndir}
144
145 \func{void}{AssignDir}{\param{const wxString\& }{dir}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
146
147 empty volume
148
149
150 \membersection{wxFileName::AssignHomeDir}\label{wxfilenameassignhomedir}
151
152 \func{void}{AssignHomeDir}{\void}
153
154 get the value of user home (Unix only mainly)
155
156
157 \membersection{wxFileName::AssignTempFileName}\label{wxfilenameassigntempfilename}
158
159 \func{void}{AssignTempFileName}{\param{const wxString\& }{prefix}}
160
161 get a temp file name starting with thespecified prefix
162
163
164 \membersection{wxFileName::Clear}\label{wxfilenameclear}
165
166 \func{void}{Clear}{\void}
167
168 reset all components to default, uninitialized state
169
170
171 \membersection{wxFileName::DirExists}\label{wxfilenamedirexists}
172
173 \func{bool}{DirExists}{\void}
174
175 does the directory with this name exists?
176
177
178 \membersection{wxFileName::DirExists}\label{wxfilenamedirexists}
179
180 \func{bool}{DirExists}{\param{const wxString\& }{dir}}
181
182
183 \membersection{wxFileName::DirName}\label{wxfilenamedirname}
184
185 \func{wxFileName}{DirName}{\param{const wxString\& }{dir}}
186
187
188 \membersection{wxFileName::FileExists}\label{wxfilenamefileexists}
189
190 \func{bool}{FileExists}{\void}
191
192 does the file with this name exists?
193
194
195 \membersection{wxFileName::FileExists}\label{wxfilenamefileexists}
196
197 \func{bool}{FileExists}{\param{const wxString\& }{file}}
198
199
200 \membersection{wxFileName::FileName}\label{wxfilenamefilename}
201
202 \func{wxFileName}{FileName}{\param{const wxString\& }{file}}
203
204 static pseudo constructors
205
206
207 \membersection{wxFileName::GetCwd}\label{wxfilenamegetcwd}
208
209 \func{wxString}{GetCwd}{\void}
210
211
212 \membersection{wxFileName::GetDirCount}\label{wxfilenamegetdircount}
213
214 \constfunc{size\_t}{GetDirCount}{\void}
215
216
217 \membersection{wxFileName::GetDirs}\label{wxfilenamegetdirs}
218
219 \constfunc{const wxArrayString\&}{GetDirs}{\void}
220
221
222 \membersection{wxFileName::GetExt}\label{wxfilenamegetext}
223
224 \constfunc{wxString}{GetExt}{\void}
225
226
227 \membersection{wxFileName::GetFormat}\label{wxfilenamegetformat}
228
229 \func{wxPathFormat}{GetFormat}{\param{wxPathFormat }{format = wxPATH\_NATIVE}}
230
231 various helpers
232 get the canonical path format for this platform
233
234
235 \membersection{wxFileName::GetFullName}\label{wxfilenamegetfullname}
236
237 \constfunc{wxString}{GetFullName}{\void}
238
239
240 \membersection{wxFileName::GetFullPath}\label{wxfilenamegetfullpath}
241
242 \constfunc{wxString}{GetFullPath}{\param{wxPathFormat }{format = wxPATH\_NATIVE}}
243
244 add separator Construct full path with name and ext
245
246
247 \membersection{wxFileName::GetHomeDir}\label{wxfilenamegethomedir}
248
249 \func{wxString}{GetHomeDir}{\void}
250
251
252 \membersection{wxFileName::GetLongPath}\label{wxfilenamegetlongpath}
253
254 \constfunc{wxString}{GetLongPath}{\void}
255
256 Return the long form of the path (returns identity on non-Windows platforms)
257
258
259 \membersection{wxFileName::GetModificationTime}\label{wxfilenamegetmodificationtime}
260
261 \constfunc{wxDateTime}{GetModificationTime}{\void}
262
263 convenience wrapper: get just the last mod time of the file
264
265
266 \membersection{wxFileName::GetName}\label{wxfilenamegetname}
267
268 \constfunc{wxString}{GetName}{\void}
269
270
271 \membersection{wxFileName::GetPath}\label{wxfilenamegetpath}
272
273 \constfunc{wxString}{GetPath}{\param{bool }{add\_separator = FALSE}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
274
275 Construct path only - possibly with the trailing separator
276
277
278 \membersection{wxFileName::GetPathSeparators}\label{wxfilenamegetpathseparators}
279
280 \func{wxString}{GetPathSeparators}{\param{wxPathFormat }{format = wxPATH\_NATIVE}}
281
282 get the string of path separators for this format
283
284
285 \membersection{wxFileName::GetPathWithSep}\label{wxfilenamegetpathwithsep}
286
287 \constfunc{wxString}{GetPathWithSep}{\param{wxPathFormat }{format = wxPATH\_NATIVE}}
288
289 more readable synonym
290
291
292 \membersection{wxFileName::GetShortPath}\label{wxfilenamegetshortpath}
293
294 \constfunc{wxString}{GetShortPath}{\void}
295
296 Return the short form of the path (returns identity on non-Windows platforms)
297
298
299 \membersection{wxFileName::GetTimes}\label{wxfilenamegettimes}
300
301 \constfunc{bool}{GetTimes}{\param{wxDateTime* }{dtAccess}, \param{wxDateTime* }{dtMod}, \param{wxDateTime* }{dtChange}}
302
303 return the last access, last modification and last change times
304 (any of the pointers may be NULL)
305
306
307 \membersection{wxFileName::GetVolume}\label{wxfilenamegetvolume}
308
309 \constfunc{wxString}{GetVolume}{\void}
310
311
312 \membersection{wxFileName::GetVolumeSeparator}\label{wxfilenamegetvolumeseparator}
313
314 \func{wxString}{GetVolumeSeparator}{\param{wxPathFormat }{format = wxPATH\_NATIVE}}
315
316 get the string separating the volume from the path for this format
317
318
319 \membersection{wxFileName::HasExt}\label{wxfilenamehasext}
320
321 \constfunc{bool}{HasExt}{\void}
322
323
324 \membersection{wxFileName::HasName}\label{wxfilenamehasname}
325
326 \constfunc{bool}{HasName}{\void}
327
328
329 \membersection{wxFileName::HasVolume}\label{wxfilenamehasvolume}
330
331 \constfunc{bool}{HasVolume}{\void}
332
333
334 \membersection{wxFileName::InsertDir}\label{wxfilenameinsertdir}
335
336 \func{void}{InsertDir}{\param{int }{before}, \param{const wxString\& }{dir}}
337
338
339 \membersection{wxFileName::IsAbsolute}\label{wxfilenameisabsolute}
340
341 \func{bool}{IsAbsolute}{\param{wxPathFormat }{format = wxPATH\_NATIVE}}
342
343 is this filename absolute?
344
345
346 \membersection{wxFileName::IsCaseSensitive}\label{wxfilenameiscasesensitive}
347
348 \func{bool}{IsCaseSensitive}{\param{wxPathFormat }{format = wxPATH\_NATIVE}}
349
350 Tests
351 are the file names of this type cases sensitive?
352
353
354 \membersection{wxFileName::IsOk}\label{wxfilenameisok}
355
356 \constfunc{bool}{IsOk}{\void}
357
358 file tests
359 is the filename valid at all?
360
361
362 \membersection{wxFileName::IsPathSeparator}\label{wxfilenameispathseparator}
363
364 \func{bool}{IsPathSeparator}{\param{wxChar }{ch}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
365
366 is the char a path separator for this format?
367
368
369 \membersection{wxFileName::IsRelative}\label{wxfilenameisrelative}
370
371 \func{bool}{IsRelative}{\param{wxPathFormat }{format = wxPATH\_NATIVE}}
372
373 is this filename relative?
374
375
376 \membersection{wxFileName::IsWild}\label{wxfilenameiswild}
377
378 \func{bool}{IsWild}{\param{wxPathFormat }{format = wxPATH\_NATIVE}}
379
380 FIXME: what exactly does this do?
381
382
383 \membersection{wxFileName::Mkdir}\label{wxfilenamemkdir}
384
385 \func{bool}{Mkdir}{\param{int }{perm = 0777}, \param{bool }{full = FALSE}}
386
387 directory creation and removal.
388 if full is TRUE, will try to make each directory in the path.
389
390
391 \membersection{wxFileName::Mkdir}\label{wxfilenamemkdir}
392
393 \func{bool}{Mkdir}{\param{const wxString\& }{dir}, \param{int }{perm = 0777}, \param{bool }{full = FALSE}}
394
395
396 \membersection{wxFileName::Normalize}\label{wxfilenamenormalize}
397
398 \func{bool}{Normalize}{\param{wxPathNormalize }{flags = wxPATH\_NORM\_ALL}, \param{const wxString\& }{cwd = wxEmptyString}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
399
400 operations on the path
401 normalize the path: with the default flags value, the path will be
402 made absolute, without any ".." and "." and all environment
403 variables will be expanded in it
404 this may be done using another (than current) value of cwd
405
406
407 \membersection{wxFileName::PrependDir}\label{wxfilenameprependdir}
408
409 \func{void}{PrependDir}{\param{const wxString\& }{dir}}
410
411
412 \membersection{wxFileName::RemoveDir}\label{wxfilenameremovedir}
413
414 \func{void}{RemoveDir}{\param{int }{pos}}
415
416
417 \membersection{wxFileName::Rmdir}\label{wxfilenamermdir}
418
419 \func{bool}{Rmdir}{\void}
420
421
422 \membersection{wxFileName::Rmdir}\label{wxfilenamermdir}
423
424 \func{bool}{Rmdir}{\param{const wxString\& }{dir}}
425
426
427 \membersection{wxFileName::SameAs}\label{wxfilenamesameas}
428
429 \func{bool}{SameAs}{\param{const wxFileName\& }{filepath}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
430
431 compares with the rules of this platform
432
433
434 \membersection{wxFileName::SetCwd}\label{wxfilenamesetcwd}
435
436 \func{bool}{SetCwd}{\void}
437
438 change the current working directory
439
440
441 \membersection{wxFileName::SetCwd}\label{wxfilenamesetcwd}
442
443 \func{bool}{SetCwd}{\param{const wxString\& }{cwd}}
444
445
446 \membersection{wxFileName::SetExt}\label{wxfilenamesetext}
447
448 \func{void}{SetExt}{\param{const wxString\& }{ext}}
449
450
451 \membersection{wxFileName::SetFullName}\label{wxfilenamesetfullname}
452
453 \func{void}{SetFullName}{\param{const wxString\& }{fullname}}
454
455 full name is the file name + extension (but without the path)
456
457
458 \membersection{wxFileName::SetName}\label{wxfilenamesetname}
459
460 \func{void}{SetName}{\param{const wxString\& }{name}}
461
462
463 \membersection{wxFileName::SetTimes}\label{wxfilenamesettimes}
464
465 \func{bool}{SetTimes}{\param{const wxDateTime* }{dtCreate}, \param{const wxDateTime* }{dtAccess}, \param{const wxDateTime* }{dtMod}}
466
467 set the file creation and last access/mod times
468 (any of the pointers may be NULL)
469
470
471 \membersection{wxFileName::SetVolume}\label{wxfilenamesetvolume}
472
473 \func{void}{SetVolume}{\param{const wxString\& }{volume}}
474
475
476 \membersection{wxFileName::SplitPath}\label{wxfilenamesplitpath}
477
478 \func{void}{SplitPath}{\param{const wxString\& }{fullpath}, \param{wxString* }{volume}, \param{wxString* }{path}, \param{wxString* }{name}, \param{wxString* }{ext}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
479
480 \func{void}{SplitPath}{\param{const wxString\& }{fullpath}, \param{wxString* }{path}, \param{wxString* }{name}, \param{wxString* }{ext}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
481
482 split a fullpath into the volume, path, (base) name and extension
483 (all of the pointers can be NULL)
484
485 \membersection{wxFileName::Touch}\label{wxfilenametouch}
486
487 \func{bool}{Touch}{\void}
488
489 set the access and modification times to the current moment
490
491
492 \membersection{wxFileName::operator=}\label{wxfilenameoperatorassign}
493
494 \func{wxFileName\& operator}{operator=}{\param{const wxFileName\& }{filename}}
495
496
497 \membersection{wxFileName::operator=}\label{wxfilenameoperatorassign}
498
499 \func{wxFileName\& operator}{operator=}{\param{const wxString\& }{filename}}
500
501
502 \membersection{wxFileName::operator==}\label{wxfilenameoperatorequal}
503
504 \func{bool operator}{operator==}{\param{const wxFileName\& }{filename}}
505
506 uses the current platform settings
507
508
509 \membersection{wxFileName::operator==}\label{wxfilenameoperatorequal}
510
511 \func{bool operator}{operator==}{\param{const wxString\& }{filename}}
512