Aller au contenu
Bienvenue sur la nouvelle documentation de CppUtils !

Namespace: CppUtils::FileSystem

enum class Event {
Access = 1u << 0,
Modified = 1u << 1,
Attribute = 1u << 2,
CloseWrite = 1u << 3,
CloseNoWrite = 1u << 4,
Closed = CloseWrite | CloseNoWrite,
Open = 1u << 5,
MovedFrom = 1u << 6,
MovedTo = 1u << 7,
Moved = MovedFrom | MovedTo,
Created = 1u << 8,
Deleted = 1u << 9,
DeletedSelf = 1u << 10,
MoveSelf = 1u << 11,
Unmount = 1u << 13,
QOverflow = 1u << 14,
Ignored = 1u << 15,
IsDirectory = 1u << 30,
Oneshot = 1u << 31,
All = 0x0000'0FFF
};
auto forDirectories(const std::filesystem::path& directoryPath, auto&& function, bool recursively=false) -> void;

constexpr auto operator&(Event lhs, Event rhs) -> bool;

constexpr auto operator|(Event lhs, Event rhs) -> Event;

auto forFiles(const std::filesystem::path& directoryPath, auto&& function, bool recursively=false) -> void;

auto forFilesWithExtension(const std::filesystem::path& directoryPath, std::string_view ext, auto&& function, bool recursively=false) -> void;

template <class T = std::span<const std::byte>>
auto readByBlocks(const std::filesystem::path& filePath, auto&& function, std::size_t blockSize=4 '096) -> std::expected<void, Error>;

auto readLines(std::filesystem::path path);

auto writeLines(std::filesystem::path path);