diff options
author | Jean-Francois Mauguit <jfmauguit@mac.com> | 2024-09-24 09:03:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 09:03:25 -0400 |
commit | bab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Wasabi/bfc/file/recursedir.h | |
parent | 4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff) | |
parent | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff) | |
download | winamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz |
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/Wasabi/bfc/file/recursedir.h')
-rw-r--r-- | Src/Wasabi/bfc/file/recursedir.h | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/Src/Wasabi/bfc/file/recursedir.h b/Src/Wasabi/bfc/file/recursedir.h new file mode 100644 index 00000000..2c40c7ac --- /dev/null +++ b/Src/Wasabi/bfc/file/recursedir.h @@ -0,0 +1,73 @@ +#ifndef _RECURSEDIR_H +#define _RECURSEDIR_H + +#include <bfc/wasabi_std.h> +#include <bfc/ptrlist.h> +#include <bfc/common.h> +#include <bfc/file/readdir.h> + +class ReadDir; + +/** + Read the contents of a directory, recursively. + Also possible to use search match patterns. + + @short Recursive directory reading. + @author Nullsoft + @ver 1.0 + @see ReadDir +*/ +class RecurseDir { +public: + /** + Sets the directory to read and the match pattern. + If no match pattern is set, it will match against + all files. + + @param path The path of the directory to read. + @param match The match pattern to use. + */ + RecurseDir(const wchar_t *path, const wchar_t *match=NULL); + + /** + Deletes the directory stack. + */ + ~RecurseDir(); + + /** + Advance to the next file. + + @ret 0, No more files to read; > 0, Files left to read. + */ + int next(); + + /** + Restart from the top of the directory tree. + + @ret 0 + */ + int restart(); + + /** + Get the current directory path. + + @ret The path. + */ + const wchar_t *getPath(); + + /** + Get the filename for the current file. + + @ret The filename. + */ + const wchar_t *getFilename(); + + const wchar_t *getOriginalPath(); + +private: + StringW path, match; + ReadDir *curdir; + PtrList<ReadDir> dirstack; +}; + +#endif |