X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4afd752902ae7c44f4b3dc2edb11d7c24f95ed54..d43d449bdd10d1feb1c906daf8a661f2d340f2f8:/docs/latex/wx/dir.tex?ds=sidebyside diff --git a/docs/latex/wx/dir.tex b/docs/latex/wx/dir.tex index 676d62c3b2..bc33378d33 100644 --- a/docs/latex/wx/dir.tex +++ b/docs/latex/wx/dir.tex @@ -1,8 +1,13 @@ -% -% automatically generated by HelpGen from -% include\wx\dir.h at 11/Dec/99 00:55:30 -% - +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Name: dir.tex +%% Purpose: wxDir documentation +%% Author: Vadim Zeitlin +%% Modified by: +%% Created: 04.04.00 +%% RCS-ID: $Id$ +%% Copyright: (c) Vadim Zeitlin +%% License: wxWindows license +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{\class{wxDir}}\label{wxdir} @@ -10,6 +15,10 @@ wxDir is a portable equivalent of Unix {open/read/close}dir functions which allow enumerating of the files in a directory. wxDir allows enumerate files as well as directories. +wxDir also provides a flexible way to enumerate files recursively using +\helpref{Traverse}{wxdirtraverse} or a simpler +\helpref{GetAllFiles}{wxdirgetallfiles} function. + Example of use: \begin{verbatim} @@ -54,7 +63,7 @@ enum wxDIR_DOTDOT = 0x0008, // include '.' and '..' // by default, enumerate everything except '.' and '..' - wxDIR_DEFAULT = wxDIR\_FILES | wxDIR\_DIRS | wxDIR\_HIDDEN + wxDIR_DEFAULT = wxDIR_FILES | wxDIR_DIRS | wxDIR_HIDDEN } \end{verbatim} } @@ -94,7 +103,7 @@ class is not meant to be used polymorphically. \func{bool}{Open}{\param{const wxString\& }{dir}} Open the directory for enumerating, returns TRUE on success or FALSE if an -error occured. +error occurred. \membersection{wxDir::IsOpened}\label{wxdirisopened} @@ -117,3 +126,55 @@ empty) and flags, return TRUE on success. Continue enumerating files satisfying the criteria specified by the last call to \helpref{GetFirst}{wxdirgetfirst}. +\membersection{wxDir::HasFiles}\label{wxdirhasfiles} + +\func{bool}{HasFiles}{\param{const wxString& }{filespec = wxEmptyString}} + +Returns {\tt TRUE} if the directory contains any files matching the given +{\it filespec}. If {\it filespec} is empty, look for any files at all. In any +case, even hidden files are taken into account. + +\membersection{wxDir::HasSubDirs}\label{wxdirhassubdirs} + +\func{bool}{HasSubDirs}{\param{const wxString& }{dirspec = wxEmptyString}} + +Returns {\tt TRUE} if the directory contains any subdirectories (if a non +empty {\it filespec} is given, only check for directories matching it). +The hidden subdirectories are taken into account as well. + +\membersection{wxDir::Traverse}\label{wxdirtraverse} + +\func{size\_t}{Traverse}{\param{wxDirTraverser& }{sink}, \param{const wxString& }{filespec = wxEmptyString}, \param{int }{flags = wxDIR\_DEFAULT}} + +Enumerate all files and directories under the given directory recursively +calling the element of the provided \helpref{wxDirTraverser}{wxdirtraverser} +object for each of them. + +More precisely, the function will really recurse into subdirectories if +{\it flags} contains {\tt wxDIR\_DIRS} flag. It will ignore the files (but +still possibly recurse into subdirectories) if {\tt wxDIR\_FILES} flag is +given. + +For each found directory, \helpref{sink.OnDir()}{wxdirtraverserondir} is called +and \helpref{sink.OnFile()}{wxdirtraverseronfile} is called for every file. +Depending on the return value, the enumeration may continue or stop. + +The function returns the total number of files found or {\tt (size\_t)-1} on +error. + +See also: \helpref{GetAllFiles}{wxdirgetallfiles} + +\membersection{wxDir::GetAllFiles}\label{wxdirgetallfiles} + +\func{static size\_t}{GetAllFiles}{\param{const wxString& }{dirname}, \param{wxArrayString *}{files}, \param{const wxString& }{filespec = wxEmptyString}, \param{int }{flags = wxDIR\_DEFAULT}} + +The function appends the names of all the files under directory {\it dirname} +to the array {\it files} (note that its old contents is preserved). Only files +matching the {\it filespec} are taken, with empty spec matching all the files. + +The {\it flags} parameter should always include {\tt wxDIR\_FILES} or the array +would be unchanged and should include {\tt wxDIR\_DIRS} flag to recurse into +subdirectories (both flags are included in the value by default). + +See also: \helpref{Traverse}{wxdirtraverse} +