]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/dirtrav.tex
compilation fix for wxUSE_STL==1 in DoGetSibling()
[wxWidgets.git] / docs / latex / wx / dirtrav.tex
CommitLineData
f3845e88
VZ
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: dirtrav.tex
3%% Purpose: wxDirTraverser documentation
4%% Author: Vadim Zeitlin
5%% Modified by:
6%% Created: 14.01.02 (extracted from dir.tex)
7%% RCS-ID: $Id$
8%% Copyright: (c) Vadim Zeitlin
8795498c 9%% License: wxWindows license
f3845e88
VZ
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12\section{\class{wxDirTraverser}}\label{wxdirtraverser}
13
14wxDirTraverser is an abstract interface which must be implemented by objects
15passed to \helpref{Traverse}{wxdirtraverse} function.
16
17Example of use (this works almost like \helpref{GetAllFiles}{wxdirgetallfiles}):
18
19\begin{verbatim}
20 class wxDirTraverserSimple : public wxDirTraverser
21 {
22 public:
23 wxDirTraverserSimple(wxArrayString& files) : m_files(files) { }
24
25 virtual wxDirTraverseResult OnFile(const wxString& filename)
26 {
27 m_files.Add(filename);
28 return wxDIR_CONTINUE;
29 }
30
31 virtual wxDirTraverseResult OnDir(const wxString& WXUNUSED(dirname))
32 {
33 return wxDIR_CONTINUE;
34 }
35
36 private:
37 wxArrayString& m_files;
38 };
39
40 // get the names of all files in the array
41 wxArrayString files;
42 wxDirTraverserSimple traverser(files);
43
44 wxDir dir(dirname);
45 dir.Traverse(traverser);
46\end{verbatim}
47
48\wxheading{Derived from}
49
50No base class
51
52\wxheading{Constants}
53
54The elements of {\tt wxDirTraverseResult} are the possible return values of the
55callback functions:
56
57{\small
58\begin{verbatim}
59enum wxDirTraverseResult
60{
61 wxDIR_IGNORE = -1, // ignore this directory but continue with others
62 wxDIR_STOP, // stop traversing
63 wxDIR_CONTINUE // continue into this directory
64};
65\end{verbatim}
66}
67
68\wxheading{Include files}
69
70<wx/dir.h>
71
a7af285d
VZ
72\wxheading{Library}
73
74\helpref{wxBase}{librarieslist}
75
f3845e88
VZ
76\latexignore{\rtfignore{\wxheading{Members}}}
77
9f5e5c31 78
350777b6
VZ
79\membersection{wxDirTraverser::OnDir}\label{wxdirtraverserondir}
80
81\func{virtual wxDirTraverseResult}{OnDir}{\param{const wxString\& }{dirname}}
82
83This function is called for each directory. It may return {\tt wxSIR\_STOP}
84to abort traversing completely, {\tt wxDIR\_IGNORE} to skip this directory but
85continue with others or {\tt wxDIR\_CONTINUE} to enumerate all files and
86subdirectories in this directory.
87
88This is a pure virtual function and must be implemented in the derived class.
89
9f5e5c31 90
f3845e88
VZ
91\membersection{wxDirTraverser::OnFile}\label{wxdirtraverseronfile}
92
7af3ca16 93\func{virtual wxDirTraverseResult}{OnFile}{\param{const wxString\& }{filename}}
f3845e88
VZ
94
95This function is called for each file. It may return {\tt wxDIR\_STOP} to abort
96traversing (for example, if the file being searched is found) or
97{\tt wxDIR\_CONTINUE} to proceed.
98
350777b6 99This is a pure virtual function and must be implemented in the derived class.
f3845e88 100
f3845e88 101
9f5e5c31
VZ
102\membersection{wxDirTraverser::OnOpenError}\label{wxopenerrortraverseronopenerror}
103
104\func{virtual wxDirTraverseResult}{OnOpenError}{\param{const wxString\& }{openerrorname}}
350777b6
VZ
105
106This function is called for each directory which we failed to open for
107enumerating. It may return {\tt wxSIR\_STOP} to abort traversing completely,
108{\tt wxDIR\_IGNORE} to skip this directory but continue with others or
109{\tt wxDIR\_CONTINUE} to retry opening this directory once again.
110
111The base class version always returns {\tt wxDIR\_IGNORE}.
f3845e88
VZ
112
113