diff options
| author | Dan Engelbrecht <[email protected]> | 2026-01-13 15:00:28 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-01-13 15:00:28 +0100 |
| commit | 0e20ec796d79650e9e9ebf5c2561b1633b4b2020 (patch) | |
| tree | 89d1f9d7fd95dca63fd15cae26a0b12d45c10944 /src/zencore/include | |
| parent | fixed block generation after bug introduced in PR #704 (#707) (diff) | |
| download | zen-0e20ec796d79650e9e9ebf5c2561b1633b4b2020.tar.xz zen-0e20ec796d79650e9e9ebf5c2561b1633b4b2020.zip | |
added options to configure exclude folders and extensions to zen build commands (#706)
* added `--exclude-folders` to `zen upload`, `zen download` and `zen diff`
added `--exclude-extensions` to `zen upload` and `zen diff`
excluded folder names are now matched by folder name in subfolders in addition to root level folders
* allow multiple token separators
Diffstat (limited to 'src/zencore/include')
| -rw-r--r-- | src/zencore/include/zencore/filesystem.h | 5 | ||||
| -rw-r--r-- | src/zencore/include/zencore/string.h | 53 |
2 files changed, 55 insertions, 3 deletions
diff --git a/src/zencore/include/zencore/filesystem.h b/src/zencore/include/zencore/filesystem.h index b4906aebf..938a05b59 100644 --- a/src/zencore/include/zencore/filesystem.h +++ b/src/zencore/include/zencore/filesystem.h @@ -368,6 +368,11 @@ public: std::vector<std::filesystem::path> DirectoryNames; std::vector<uint32_t> DirectoryAttributes; }; + virtual bool AsyncAllowDirectory(const std::filesystem::path& Parent, const std::filesystem::path& DirectoryName) const + { + ZEN_UNUSED(Parent, DirectoryName); + return true; + } virtual void AsyncVisitDirectory(const std::filesystem::path& RelativeRoot, DirectoryContent&& Content) = 0; }; diff --git a/src/zencore/include/zencore/string.h b/src/zencore/include/zencore/string.h index 93f8add0a..4379f2f80 100644 --- a/src/zencore/include/zencore/string.h +++ b/src/zencore/include/zencore/string.h @@ -821,19 +821,66 @@ ForEachStrTok(const std::string_view& Str, char Delim, Fn&& Func) while (It != End) { - if (*It == Delim) + std::string_view Remaining{It, size_t(ptrdiff_t(End - It))}; + size_t Idx = Remaining.find(Delim, 0); + if (Idx == 0) { It++; continue; } + size_t DelimSize = 0; + + if (Idx == std::string_view::npos) + { + Idx = Remaining.size(); + } + else + { + DelimSize = 1; + } + + Count++; + std::string_view Token{It, Idx}; + if (!Func(Token)) + { + break; + } + + It = It + (Idx + DelimSize); + } + + return Count; +} + +template<typename Fn> +uint32_t +ForEachStrTok(const std::string_view& Str, const char* Delims, Fn&& Func) +{ + const char* It = Str.data(); + const char* End = It + Str.length(); + uint32_t Count = 0; + + while (It != End) + { std::string_view Remaining{It, size_t(ptrdiff_t(End - It))}; - size_t Idx = Remaining.find(Delim, 0); + size_t Idx = Remaining.find_first_of(Delims, 0); + if (Idx == 0) + { + It++; + continue; + } + + size_t DelimSize = 0; if (Idx == std::string_view::npos) { Idx = Remaining.size(); } + else + { + DelimSize = 1; + } Count++; std::string_view Token{It, Idx}; @@ -842,7 +889,7 @@ ForEachStrTok(const std::string_view& Str, char Delim, Fn&& Func) break; } - It = It + Idx; + It = It + (Idx + DelimSize); } return Count; |