1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxDirTraverser documentation
4 %% Author: Vadim Zeitlin
6 %% Created: 14.01.02 (extracted from dir.tex)
8 %% Copyright: (c) Vadim Zeitlin
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxDirTraverser
}}\label{wxdirtraverser
}
14 wxDirTraverser is an abstract interface which must be implemented by objects
15 passed to
\helpref{Traverse
}{wxdirtraverse
} function.
17 Example of use (this works almost like
\helpref{GetAllFiles
}{wxdirgetallfiles
}):
20 class wxDirTraverserSimple : public wxDirTraverser
23 wxDirTraverserSimple(wxArrayString& files) : m_files(files)
{ }
25 virtual wxDirTraverseResult OnFile(const wxString& filename)
27 m_files.Add(filename);
28 return wxDIR_CONTINUE;
31 virtual wxDirTraverseResult OnDir(const wxString& WXUNUSED(dirname))
33 return wxDIR_CONTINUE;
37 wxArrayString& m_files;
40 // get the names of all files in the array
42 wxDirTraverserSimple traverser(files);
45 dir.Traverse(traverser);
48 \wxheading{Derived from
}
54 The elements of
{\tt wxDirTraverseResult
} are the possible return values of the
59 enum wxDirTraverseResult
61 wxDIR_IGNORE = -
1, // ignore this directory but continue with others
62 wxDIR_STOP, // stop traversing
63 wxDIR_CONTINUE // continue into this directory
68 \wxheading{Include files
}
72 \latexignore{\rtfignore{\wxheading{Members
}}}
74 \membersection{wxDirTraverser::OnFile
}\label{wxdirtraverseronfile
}
76 \func{virtual wxDirTraverseResult
}{OnFile
}{\param{const wxString\&
}{filename
}}
78 This function is called for each file. It may return
{\tt wxDIR
\_STOP} to abort
79 traversing (for example, if the file being searched is found) or
80 {\tt wxDIR
\_CONTINUE} to proceed.
82 \membersection{wxDirTraverser::OnDir
}\label{wxdirtraverserondir
}
84 \func{virtual wxDirTraverseResult
}{OnDir
}{\param{const wxString\&
}{dirname
}}
86 This function is called for each directory. It may return
{\tt wxSIR
\_STOP}
87 to abort traversing completely,
{\tt wxDIR
\_IGNORE} to skip this directory but
88 continue with others or
{\tt wxDIR
\_CONTINUE} to enumerate all files and
89 subdirectories in this directory.