From 369528c1701670bab575fe817abe0a18e8f304bb Mon Sep 17 00:00:00 2001 From: Georg Hagen Date: Thu, 15 May 2025 20:35:11 +0200 Subject: [PATCH] Expand FsUtils --- openVulkanoCpp/IO/FsUtils.hpp | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/openVulkanoCpp/IO/FsUtils.hpp b/openVulkanoCpp/IO/FsUtils.hpp index 74952ce..e30756c 100644 --- a/openVulkanoCpp/IO/FsUtils.hpp +++ b/openVulkanoCpp/IO/FsUtils.hpp @@ -15,7 +15,7 @@ namespace OpenVulkano { size_t fileCount = 0, dirCount = 0; - size_t GetTotalEntryCount() const { return fileCount + dirCount; } + [[maybe_unused]] [[nodiscard]] size_t GetTotalEntryCount() const { return fileCount + dirCount; } FsCount& operator +=(const FsCount& other) { @@ -23,6 +23,23 @@ namespace OpenVulkano dirCount += other.dirCount; return *this; } + + FsCount operator +(FsCount other) + { + return other += *this; + } + + FsCount& operator -=(const FsCount& other) + { + fileCount -= other.fileCount; + dirCount -= other.dirCount; + return *this; + } + + FsCount operator -(FsCount other) + { + return other -= *this; + } }; struct FsUtils @@ -35,12 +52,12 @@ namespace OpenVulkano static bool IsTreeEmpty(const std::filesystem::path& dir); - static ByteSize GetDirSize(const std::filesystem::path& dir); + [[nodiscard]] static ByteSize GetDirSize(const std::filesystem::path& dir); - static FsCount GetDirFileAndDirCount(const std::filesystem::path& dir); + [[nodiscard]] static FsCount GetDirFileAndDirCount(const std::filesystem::path& dir); - static std::string ToValidFileName(std::string filename); + [[nodiscard]] static std::string ToValidFileName(std::string filename); - static std::vector FilesWithExtension(const std::filesystem::path& dir, std::string ext); + [[maybe_unused]] [[nodiscard]] static std::vector FilesWithExtension(const std::filesystem::path& dir, std::string ext); }; }