]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/dir.tex
Set/GetWindowMenu added to MDI parent frame under MSW
[wxWidgets.git] / docs / latex / wx / dir.tex
CommitLineData
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
9wxDir is a portable equivalent of Unix {open/read/close}dir functions which
10allow enumerating of the files in a directory. wxDir allows enumerate files as
11well as directories.
12
13Example 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
40No base class
41
42\wxheading{Constants}
43
44These flags define what kind of filenames is included in the list of files
45enumerated by GetFirst/GetNext
46
47{\small
48\begin{verbatim}
49enum
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
72Test for existence of a directory with the given name
73
74\membersection{wxDir::wxDir}\label{wxdirwxdir}
75
76\func{}{wxDir}{\void}
77
78Default constructor, use \helpref{Open()}{wxdiropen} afterwards.
79
80\func{}{wxDir}{\param{const wxString\& }{dir}}
81
82Opens the directory for enumeration, use \helpref{IsOpened()}{wxdirisopened}
83to test for errors.
84
85\membersection{wxDir::\destruct{wxDir}}\label{wxdirdtor}
86
87\func{}{\destruct{wxDir}}{\void}
88
89Destructor cleans up the associated ressources. It is not virtual and so this
90class is not meant to be used polymorphically.
91
92\membersection{wxDir::Open}\label{wxdiropen}
93
94\func{bool}{Open}{\param{const wxString\& }{dir}}
95
96Open the directory for enumerating, returns TRUE on success or FALSE if an
97error occured.
98
99\membersection{wxDir::IsOpened}\label{wxdirisopened}
100
101\constfunc{bool}{IsOpened}{\void}
102
103Returns 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
110Start enumerating all files matching {\it filespec} (or all files if it is
111empty) and flags, return TRUE on success.
112
113\membersection{wxDir::GetNext}\label{wxdirgetnext}
114
115\constfunc{bool}{GetNext}{\param{wxString* }{filename}}
116
117Continue enumerating files satisfying the criteria specified by the last call
118to \helpref{GetFirst}{wxdirgetfirst}.
119