X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ae3c17b4013e80b99976c750c19fca47729517f6..0c46625036e3dfb9613aae310f72a00590530689:/interface/wx/dir.h diff --git a/interface/wx/dir.h b/interface/wx/dir.h index 82b40531ca..d1fb1d47a1 100644 --- a/interface/wx/dir.h +++ b/interface/wx/dir.h @@ -3,7 +3,7 @@ // Purpose: interface of wxDir and wxDirTraverser // Author: wxWidgets team // RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// /** @@ -18,7 +18,6 @@ enum wxDirTraverseResult /** @class wxDirTraverser - @wxheader{dir.h} wxDirTraverser is an abstract interface which must be implemented by objects passed to wxDir::Traverse() function. @@ -69,7 +68,7 @@ public: This is a pure virtual function and must be implemented in the derived class. */ - virtual wxDirTraverseResult OnDir(const wxString& dirname); + virtual wxDirTraverseResult OnDir(const wxString& dirname) = 0; /** This function is called for each file. It may return ::wxDIR_STOP to @@ -79,7 +78,7 @@ public: This is a pure virtual function and must be implemented in the derived class. */ - virtual wxDirTraverseResult OnFile(const wxString& filename); + virtual wxDirTraverseResult OnFile(const wxString& filename) = 0; /** This function is called for each directory which we failed to open for @@ -98,19 +97,20 @@ public: These flags define what kind of filenames are included in the list of files enumerated by wxDir::GetFirst() and wxDir::GetNext(). */ -enum +enum wxDirFlags { wxDIR_FILES = 0x0001, ///< Includes files. wxDIR_DIRS = 0x0002, ///< Includes directories. wxDIR_HIDDEN = 0x0004, ///< Includes hidden files. wxDIR_DOTDOT = 0x0008, ///< Includes "." and "..". + //! Combination of the @c wxDIR_FILES, @c wxDIR_DIRS, @c wxDIR_HIDDEN flags + //! defined above. wxDIR_DEFAULT = wxDIR_FILES | wxDIR_DIRS | wxDIR_HIDDEN }; /** @class wxDir - @wxheader{dir.h} wxDir is a portable equivalent of Unix open/read/closedir functions which allow enumerating of the files in a directory. wxDir allows to enumerate @@ -179,6 +179,7 @@ public: includes ::wxDIR_DIRS and so the function recurses into the subdirectories but if this flag is not specified, the function restricts the search only to the directory @a dirname itself. + See ::wxDirFlags for the list of the possible flags. @see Traverse() */ @@ -195,6 +196,11 @@ public: The @a flags parameter should always include ::wxDIR_FILES or the array would be unchanged and should include ::wxDIR_DIRS flag to recurse into subdirectories (both flags are included in the value by default). + See ::wxDirFlags for the list of the possible flags. + + @return Returns the total number of files found while traversing + the directory @a dirname (i.e. the number of entries appended + to the @a files array). @see Traverse() */ @@ -205,6 +211,7 @@ public: /** Start enumerating all files matching @a filespec (or all files if it is empty) and @e flags, return @true on success. + See ::wxDirFlags for the list of the possible flags. */ bool GetFirst(wxString* filename, const wxString& filespec = wxEmptyString, @@ -259,12 +266,29 @@ public: */ bool IsOpened() const; + /** + Creates a directory. + + This is just an alias for wxFileName::Mkdir(); refer to that function + for more info. + */ + static bool Make(const wxString &dir, int perm = wxS_DIR_DEFAULT, + int flags = 0); + /** Open the directory for enumerating, returns @true on success or @false if an error occurred. */ bool Open(const wxString& dir); + /** + Removes a directory. + + This is just an alias for wxFileName::Rmdir(); refer to that function + for more info. + */ + static bool Remove(const wxString &dir, int flags = 0); + /** Enumerate all files and directories under the given directory recursively calling the element of the provided wxDirTraverser object @@ -274,8 +298,9 @@ public: @a flags contains ::wxDIR_DIRS flag. It will ignore the files (but still possibly recurse into subdirectories) if ::wxDIR_FILES flag is given. + See ::wxDirFlags for the list of the possible flags. - For each found directory, @ref wxDirTraverser::OnDir() "sink.OnDir()" + For each directory found, @ref wxDirTraverser::OnDir() "sink.OnDir()" is called and @ref wxDirTraverser::OnFile() "sink.OnFile()" is called for every file. Depending on the return value, the enumeration may continue or stop. @@ -287,6 +312,6 @@ public: */ size_t Traverse(wxDirTraverser& sink, const wxString& filespec = wxEmptyString, - int flags = wxDIR_DEFAULT); + int flags = wxDIR_DEFAULT) const; };