]>
Commit | Line | Data |
---|---|---|
4afd7529 VZ |
1 | % |
2 | % automatically generated by HelpGen from | |
3 | % include\wx\dir.h at 11/Dec/99 00:55:30 | |
4 | % | |
5 | ||
6 | ||
7 | \section{\class{wxDir}}\label{wxdir} | |
8 | ||
9 | wxDir is a portable equivalent of Unix {open/read/close}dir functions which | |
10 | allow enumerating of the files in a directory. wxDir allows enumerate files as | |
11 | well as directories. | |
12 | ||
13 | Example of use: | |
14 | ||
15 | \begin{verbatim} | |
16 | wxDir dir(wxGetCwd()); | |
17 | ||
18 | if ( !dir.IsOpened() ) | |
19 | { | |
20 | // deal with the error here - wxDir would already log an error message | |
21 | // explaining the exact reason of the failure | |
22 | return; | |
23 | } | |
24 | ||
25 | puts("Enumerating object files in current directory:"); | |
26 | ||
27 | wxString filename; | |
28 | ||
29 | bool cont = dir.GetFirst(&filename, filespec, flags); | |
30 | while ( cont ) | |
31 | { | |
32 | printf("%s\n", filename.c_str()); | |
33 | ||
34 | cont = dir.GetNext(&filename); | |
35 | } | |
36 | \end{verbatim} | |
37 | ||
38 | \wxheading{Derived from} | |
39 | ||
40 | No base class | |
41 | ||
42 | \wxheading{Constants} | |
43 | ||
44 | These flags define what kind of filenames is included in the list of files | |
45 | enumerated by GetFirst/GetNext | |
46 | ||
47 | {\small | |
48 | \begin{verbatim} | |
49 | enum | |
50 | { | |
51 | wxDIR_FILES = 0x0001, // include files | |
52 | wxDIR_DIRS = 0x0002, // include directories | |
53 | wxDIR_HIDDEN = 0x0004, // include hidden files | |
54 | wxDIR_DOTDOT = 0x0008, // include '.' and '..' | |
55 | ||
56 | // by default, enumerate everything except '.' and '..' | |
85ec2f26 | 57 | wxDIR_DEFAULT = wxDIR_FILES | wxDIR_DIRS | wxDIR_HIDDEN |
4afd7529 VZ |
58 | } |
59 | \end{verbatim} | |
60 | } | |
61 | ||
62 | \wxheading{Include files} | |
63 | ||
64 | <wx/dir.h> | |
65 | ||
66 | \latexignore{\rtfignore{\wxheading{Members}}} | |
67 | ||
68 | \membersection{wxDir::Exists}\label{wxdirexists} | |
69 | ||
70 | \func{static bool}{Exists}{\param{const wxString\& }{dir}} | |
71 | ||
72 | Test for existence of a directory with the given name | |
73 | ||
74 | \membersection{wxDir::wxDir}\label{wxdirwxdir} | |
75 | ||
76 | \func{}{wxDir}{\void} | |
77 | ||
78 | Default constructor, use \helpref{Open()}{wxdiropen} afterwards. | |
79 | ||
80 | \func{}{wxDir}{\param{const wxString\& }{dir}} | |
81 | ||
82 | Opens the directory for enumeration, use \helpref{IsOpened()}{wxdirisopened} | |
83 | to test for errors. | |
84 | ||
85 | \membersection{wxDir::\destruct{wxDir}}\label{wxdirdtor} | |
86 | ||
87 | \func{}{\destruct{wxDir}}{\void} | |
88 | ||
89 | Destructor cleans up the associated ressources. It is not virtual and so this | |
90 | class is not meant to be used polymorphically. | |
91 | ||
92 | \membersection{wxDir::Open}\label{wxdiropen} | |
93 | ||
94 | \func{bool}{Open}{\param{const wxString\& }{dir}} | |
95 | ||
96 | Open the directory for enumerating, returns TRUE on success or FALSE if an | |
f6bcfd97 | 97 | error occurred. |
4afd7529 VZ |
98 | |
99 | \membersection{wxDir::IsOpened}\label{wxdirisopened} | |
100 | ||
101 | \constfunc{bool}{IsOpened}{\void} | |
102 | ||
103 | Returns TRUE if the directory was successfully opened by a previous call to | |
104 | \helpref{Open}{wxdiropen}. | |
105 | ||
106 | \membersection{wxDir::GetFirst}\label{wxdirgetfirst} | |
107 | ||
108 | \constfunc{bool}{GetFirst}{\param{wxString* }{filename}, \param{const wxString\& }{filespec = wxEmptyString}, \param{int }{flags = wxDIR\_DEFAULT}} | |
109 | ||
110 | Start enumerating all files matching {\it filespec} (or all files if it is | |
111 | empty) and flags, return TRUE on success. | |
112 | ||
113 | \membersection{wxDir::GetNext}\label{wxdirgetnext} | |
114 | ||
115 | \constfunc{bool}{GetNext}{\param{wxString* }{filename}} | |
116 | ||
117 | Continue enumerating files satisfying the criteria specified by the last call | |
118 | to \helpref{GetFirst}{wxdirgetfirst}. | |
119 |