Add Hash, Random, Uuid, Encoding, Bits, Math modules + make Testing deps optional
New header-only modules: - Void::Hash — FNV-1a 32/64, CRC-32, DJB2, MurmurHash3-32, UDL literals - Void::Random — Xoshiro256** PRNG, uniform_int/real, coin_flip, shuffle, random_string - Void::Uuid — v4 (random), v5_lite (name-based), parse, RFC 4122 namespaces - Void::Encoding — Base64 (standard + URL-safe), Hex encode/decode - Void::Bits — popcount, bit extract/deposit, rotation, align, byteswap, masks - Void::Math — Vec2/Vec3/Vec4, Mat4 (identity, translation, scale, rotation) Testing module: move Stacktrace from INTERNAL_DEPS to OPTIONAL_DEPS. Added Detail/Color.hpp shim that delegates to Stacktrace::Color when present or provides inline ANSI fallback otherwise. All Stacktrace calls in SignalHandler, ConsoleReporter, and Runner are gated on VOID_HAS_STACKTRACE. Fix Repr.hpp reflect_struct to handle template specializations that lack std::meta::identifier_of (now guarded by has_identifier check). 33/33 tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
42268c6c35
commit
a09e000f0f
65 files changed
+4959
-138
No files matched your search
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include <Void/Result/Error.hpp>
|
||||
#include <Void/Result/Result.hpp>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <format>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
namespace Void::Configuration
|
||||
{
|
||||
|
||||
/// Look up a single environment variable by name.
|
||||
/// Returns an error if the variable is not set.
|
||||
[[nodiscard]] inline Void::Result::Result<std::string, Void::Result::Error>
|
||||
get_env(std::string_view name)
|
||||
{
|
||||
std::string name_str{name};
|
||||
const char* val = std::getenv(name_str.c_str()); // NOLINT(concurrency-mt-unsafe)
|
||||
if (!val) {
|
||||
return Void::Result::fail(
|
||||
std::format("Configuration::get_env: '{}' is not set", name));
|
||||
}
|
||||
return Void::Result::ok(std::string{val});
|
||||
}
|
||||
|
||||
/// Look up a single environment variable, returning `fallback` if not set.
|
||||
[[nodiscard]] inline std::string
|
||||
get_env_or(std::string_view name, std::string_view fallback = {})
|
||||
{
|
||||
std::string name_str{name};
|
||||
const char* val = std::getenv(name_str.c_str()); // NOLINT(concurrency-mt-unsafe)
|
||||
return val ? std::string{val} : std::string{fallback};
|
||||
}
|
||||
|
||||
} // namespace Void::Configuration
|
||||
Reference in new issue
Block a user