Restructure into umbrella modules (~55 -> 16 targets)

Headers move, CMake targets merge, C++ namespaces stay unchanged:
- Core: Scope, Lazy, Counted, Flags, Hash, Bits, Uuid, TypeList, TypeMap, Variant
- Functional: Pipeline, Either, Result, Retry
- Containers: Ring, Pool, PriorityQueue, LRU, Trie, Graph, DisjointSet, Bitset, Interval
- Math: +Matrix, Numeric, Random, Histogram
- Text: Str, Format, Tokenizer, Diff, Encoding, Semver
- Data: Json, Csv, Ini
- Async: Coro, Concurrency, EventBus, Observable
- Time: +Bench
- Log: Log facade + Logging framework (facade now header-only, breaking
  the Stacktrace<->Log link cycle the merge would have created)
- System: FileSystem + Process
- Configuration: +Argparse
- Unchanged: Stacktrace, Plugin, StateMachine, Testing, TestingMock, Detail

Module system fixes:
- OPTIONAL_DEPS resolution deferred to void_finalize_modules() so it no
  longer depends on the alphabetical discovery order of src/ subdirs
  (Testing -> Text would have been silently dropped).
- Every header-only module now has a tracked module.cmake; previously the
  empty src/<Name> marker dirs were untracked, so a fresh clone would have
  silently skipped those modules.
- VOID_HAS_LOGGING/CONCURRENCY/STR consumers renamed to LOG/ASYNC/TEXT.

Tests move to tests/standalone/<Umbrella>/<Feature>.cpp (Result suite files
prefixed: ResultBasic etc.). Test count verified identical (831) before and
after. README/CLAUDE.md module tables updated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Fable 5 committed 2026-06-12 18:50:02 +03:00
1 parent da2e93c405
commit 28b94883fd
156 files changed
+278 -220

No files matched your search

+137
View File
@@ -0,0 +1,137 @@
#pragma once
#include <Void/Log/Log.hpp>
#include <Void/Functional/Error.hpp>
#include <Void/Functional/Result.hpp>
#include <filesystem>
#include <format>
#include <system_error>
#include <vector>
namespace Void::FileSystem
{
/// Return true if path exists (file, directory, or symlink).
[[nodiscard]] inline bool exists(const std::filesystem::path& path) noexcept
{
std::error_code ec;
return std::filesystem::exists(path, ec);
}
/// Return the size of a regular file in bytes.
[[nodiscard]] inline Void::Result::Result<std::uintmax_t, Void::Result::Error>
file_size(const std::filesystem::path& path)
{
std::error_code ec;
auto sz = std::filesystem::file_size(path, ec);
if (ec) {
Void::Log::log(
Void::Log::Level::Warning, "FileSystem",
std::format("file_size: cannot stat '{}': {}", path.string(),
ec.message()));
return Void::Result::fail(
std::format("FileSystem::file_size: cannot stat '{}': {}",
path.string(), ec.message()));
}
return Void::Result::ok(sz);
}
/// Return the last-write time of a path.
[[nodiscard]] inline Void::Result::
Result<std::filesystem::file_time_type, Void::Result::Error>
last_modified(const std::filesystem::path& path)
{
std::error_code ec;
auto t = std::filesystem::last_write_time(path, ec);
if (ec) {
Void::Log::log(
Void::Log::Level::Warning, "FileSystem",
std::format("last_modified: cannot stat '{}': {}", path.string(),
ec.message()));
return Void::Result::fail(
std::format("FileSystem::last_modified: cannot stat '{}': {}",
path.string(), ec.message()));
}
return Void::Result::ok(t);
}
/// List all entries in a directory (non-recursive, filesystem order).
[[nodiscard]] inline Void::Result::
Result<std::vector<std::filesystem::path>, Void::Result::Error>
list_directory(const std::filesystem::path& path)
{
std::error_code ec;
std::vector<std::filesystem::path> entries;
for (const auto& entry :
std::filesystem::directory_iterator{path, ec}) {
if (ec) {
break;
}
entries.push_back(entry.path());
}
if (ec) {
Void::Log::log(
Void::Log::Level::Warning, "FileSystem",
std::format("list_directory: cannot iterate '{}': {}",
path.string(), ec.message()));
return Void::Result::fail(
std::format("FileSystem::list_directory: cannot iterate '{}': {}",
path.string(), ec.message()));
}
Void::Log::log(Void::Log::Level::Debug, "FileSystem",
std::format("list_directory: '{}' ({} entries)",
path.string(), entries.size()));
return Void::Result::ok(std::move(entries));
}
/// Copy a single file. Set overwrite=true to allow replacing an existing dst.
[[nodiscard]] inline Void::Result::Result<void, Void::Result::Error>
copy_file(const std::filesystem::path& src,
const std::filesystem::path& dst,
bool overwrite = false)
{
std::error_code ec;
auto opts = overwrite ? std::filesystem::copy_options::overwrite_existing
: std::filesystem::copy_options::none;
std::filesystem::copy_file(src, dst, opts, ec);
if (ec) {
Void::Log::log(
Void::Log::Level::Warning, "FileSystem",
std::format("copy_file: '{}' -> '{}': {}", src.string(),
dst.string(), ec.message()));
return Void::Result::fail(
std::format("FileSystem::copy_file: '{}' -> '{}': {}",
src.string(), dst.string(), ec.message()));
}
Void::Log::log(Void::Log::Level::Debug, "FileSystem",
std::format("copy_file: '{}' -> '{}'", src.string(),
dst.string()));
return {};
}
/// Recursively copy a directory tree from src to dst.
/// dst must not already exist; its parent must be accessible.
[[nodiscard]] inline Void::Result::Result<void, Void::Result::Error>
copy_dir(const std::filesystem::path& src,
const std::filesystem::path& dst)
{
std::error_code ec;
std::filesystem::copy(src, dst, std::filesystem::copy_options::recursive,
ec);
if (ec) {
Void::Log::log(
Void::Log::Level::Warning, "FileSystem",
std::format("copy_dir: '{}' -> '{}': {}", src.string(),
dst.string(), ec.message()));
return Void::Result::fail(
std::format("FileSystem::copy_dir: '{}' -> '{}': {}",
src.string(), dst.string(), ec.message()));
}
Void::Log::log(Void::Log::Level::Debug, "FileSystem",
std::format("copy_dir: '{}' -> '{}'", src.string(),
dst.string()));
return {};
}
} // namespace Void::FileSystem