X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/353327844e319db755c2e7a07a4cf5b53cef35c4..27bb2b7cea271d91e272452ff361f948e38dc539:/docs/latex/wx/dir.tex diff --git a/docs/latex/wx/dir.tex b/docs/latex/wx/dir.tex index 4c06f3bce3..48c550fccf 100644 --- a/docs/latex/wx/dir.tex +++ b/docs/latex/wx/dir.tex @@ -95,21 +95,21 @@ to test for errors. \func{}{\destruct{wxDir}}{\void} -Destructor cleans up the associated ressources. It is not virtual and so this +Destructor cleans up the associated resources. It is not virtual and so this class is not meant to be used polymorphically. \membersection{wxDir::Open}\label{wxdiropen} \func{bool}{Open}{\param{const wxString\& }{dir}} -Open the directory for enumerating, returns TRUE on success or FALSE if an +Open the directory for enumerating, returns true on success or false if an error occurred. \membersection{wxDir::IsOpened}\label{wxdirisopened} \constfunc{bool}{IsOpened}{\void} -Returns TRUE if the directory was successfully opened by a previous call to +Returns true if the directory was successfully opened by a previous call to \helpref{Open}{wxdiropen}. \membersection{wxDir::GetFirst}\label{wxdirgetfirst} @@ -117,7 +117,7 @@ Returns TRUE if the directory was successfully opened by a previous call to \constfunc{bool}{GetFirst}{\param{wxString* }{filename}, \param{const wxString\& }{filespec = wxEmptyString}, \param{int }{flags = wxDIR\_DEFAULT}} Start enumerating all files matching {\it filespec} (or all files if it is -empty) and flags, return TRUE on success. +empty) and flags, return true on success. \membersection{wxDir::GetNext}\label{wxdirgetnext} @@ -126,9 +126,25 @@ empty) and flags, return TRUE on success. Continue enumerating files satisfying the criteria specified by the last call to \helpref{GetFirst}{wxdirgetfirst}. -\membersection{wxDir::Traverse}{wxdirtraverse} +\membersection{wxDir::HasFiles}\label{wxdirhasfiles} -\func{size\_t}{Traverse}{\param{wxDirTraverser& }{sink}, \param{const wxString& }{filespec = wxEmptyString}, \param{int }{flags = wxDIR\_DEFAULT}} +\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} @@ -148,9 +164,9 @@ error. See also: \helpref{GetAllFiles}{wxdirgetallfiles} -\membersection{wxDirTraverser::GetAllFiles}{wxdirtraversergetallfiles} +\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}} +\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 @@ -162,81 +178,3 @@ subdirectories (both flags are included in the value by default). See also: \helpref{Traverse}{wxdirtraverse} -\section{\class{wxDirTraverser}}\label{wxdirtraverser} - -wxDirTraverser is an abstract interface which must be implemented by objects -passed to \helpref{Traverse}{wxdirtraverse} function. - -Example of use (this works almost like \helpref{GetAllFiles}{wxdirgetallfiles}): - -\begin{verbatim} - class wxDirTraverserSimple : public wxDirTraverser - { - public: - wxDirTraverserSimple(wxArrayString& files) : m_files(files) { } - - virtual wxDirTraverseResult OnFile(const wxString& filename) - { - m_files.Add(filename); - return wxDIR_CONTINUE; - } - - virtual wxDirTraverseResult OnDir(const wxString& WXUNUSED(dirname)) - { - return wxDIR_CONTINUE; - } - - private: - wxArrayString& m_files; - }; - - // get the names of all files in the array - wxArrayString files; - wxDirTraverserSimple traverser(files); - - wxDir dir(dirname); - dir.Traverse(traverser); -\end{verbatim} - -\wxheading{Derived from} - -No base class - -\wxheading{Constants} - -The elements of {\tt wxDirTraverseResult} are the possible return values of the -callback functions: - -{\small -\begin{verbatim} -enum wxDirTraverseResult -{ - wxDIR_IGNORE = -1, // ignore this directory but continue with others - wxDIR_STOP, // stop traversing - wxDIR_CONTINUE // continue into this directory -}; -\end{verbatim} - -\wxheading{Include files} - - - -\latexignore{\rtfignore{\wxheading{Members}}} - -\membersection{wxDirTraverser::OnFile}{wxdirtraverseronfile} - -\func{virtual wxDirTraverseResult}{OnFile}{\param{const wxString& }{filename}} - -This function is called for each file. It may return {\tt wxDIR\_STOP} to abort -traversing (for example, if the file being searched is found) or -{\tt wxDIR\_CONTINUE} to proceed. - -\membersection{wxDirTraverser::OnDir}{wxdirtraverserondir} - -\func{virtual wxDirTraverseResult}{OnDir}{\param{const wxString& }{dirname}} - -This function is called for each directory. It may return {\tt wxSIR\_STOP} -to abort traversing completely, {\tt wxDIR\_IGNORE} to skip this directory but -continue with others or {\tt wxDIR\_CONTINUE} to enumerate all files and -subdirectories in this directory. -