Root namespace of the StormByte suite. More...
Namespaces | |
| namespace | Detail |
| Private specialization point for non-trivial types. | |
| namespace | Error |
| Error-code domains and the StormByte::Error::Fault value type. | |
| namespace | Safe |
| Types that are safe to pass across a DLL boundary: owners and polymorphic clones on Base's heap. | |
| namespace | String |
| namespace | Test |
| namespace | Type |
| Named concepts and small type utilities used across the suite. | |
Classes | |
| class | Base64Error |
| Thrown when Base64 encode or decode fails. More... | |
| class | BinaryData |
DLL-boundary-safe owned contiguous sequence of std::byte. More... | |
| class | Bitmask |
| CRTP wrapper that stores an unsigned enum as a flag set. More... | |
| class | ByteSize |
Count of octets (uint64_t storage). More... | |
| class | Clock |
| Stopwatch for measuring execution time of operations. More... | |
| class | CString |
| Owned NUL-terminated buffer, safe to use across a DLL boundary. More... | |
| class | DeserializeError |
| Thrown when deserialization fails. More... | |
| class | Exception |
| Base exception type for the suite. More... | |
| class | Iterable |
| Wrapper that adds a uniform iteration and mutation API around a standard container. More... | |
| class | OutOfBoundsError |
| Thrown when an index or range is out of bounds. More... | |
| class | Serializable |
Encodes and decodes one value of type T. More... | |
| class | Size |
Count of abstract units (uint64_t storage). More... | |
| class | Telemetry |
| Abstract session telemetry base with a protected clock drawer. More... | |
| class | ThreadLock |
| Mutex with owner-thread reentry. More... | |
| class | WCString |
| Owned NUL-terminated wide buffer, safe to use across a DLL boundary. More... | |
Typedefs | |
| template<typename T , class E > | |
| using | Expected = std::conditional_t< Type::Reference< T >, std::expected< std::reference_wrapper< std::remove_reference_t< T > >, Safe::Shared< E > >, std::expected< T, Safe::Shared< E > > > |
std::expected alias with reference and shared-error handling. | |
Functions | |
| BinaryData | Base64Decode (std::string_view input) |
| Decodes Base64 text into bytes. | |
| CString | Base64Encode (const BinaryData &input) |
Encodes bytes as Base64 with = padding. | |
| CString | Base64Encode (std::span< const std::byte > input) |
Encodes a contiguous byte span as Base64 with = padding. | |
| void | swap (BinaryData &lhs, BinaryData &rhs) noexcept |
| Exchange two sequences. | |
| bool | operator== (std::span< const std::byte > bytes, const BinaryData &data) noexcept |
| Equality of a span against a sequence. | |
| bool | operator!= (std::span< const std::byte > bytes, const BinaryData &data) noexcept |
| Inequality of a span against a sequence. | |
| std::strong_ordering | operator<=> (std::span< const std::byte > bytes, const BinaryData &data) noexcept |
| Three-way comparison of a span against a sequence. | |
| template<Type::Integral T> | |
| constexpr bool | operator== (ByteSize lhs, T rhs) noexcept |
| Mixed equality. | |
| template<Type::Integral T> | |
| constexpr bool | operator== (T lhs, ByteSize rhs) noexcept |
| Mixed equality. | |
| template<Type::Integral T> | |
| constexpr std::strong_ordering | operator<=> (ByteSize lhs, T rhs) noexcept |
| Mixed order. | |
| template<Type::Integral T> | |
| constexpr std::strong_ordering | operator<=> (T lhs, ByteSize rhs) noexcept |
| Mixed order. | |
| template<Type::Integral T> | |
| constexpr ByteSize | operator+ (ByteSize lhs, T rhs) noexcept |
| Mixed sum. | |
| template<Type::Integral T> | |
| constexpr ByteSize | operator+ (T lhs, ByteSize rhs) noexcept |
| Mixed sum. | |
| template<Type::Integral T> | |
| constexpr ByteSize | operator- (ByteSize lhs, T rhs) noexcept |
| Mixed difference. | |
| template<Type::Integral T> | |
| constexpr ByteSize | operator- (T lhs, ByteSize rhs) noexcept |
| Mixed difference. | |
| template<Type::Integral T> | |
| constexpr ByteSize | operator* (ByteSize lhs, T rhs) noexcept |
| Mixed product. | |
| template<Type::Integral T> | |
| constexpr ByteSize | operator* (T lhs, ByteSize rhs) noexcept |
| Mixed product. | |
| template<Type::Integral T> | |
| constexpr ByteSize | operator/ (ByteSize lhs, T rhs) noexcept |
| Mixed quotient. | |
| template<Type::Integral T> | |
| constexpr ByteSize | operator% (ByteSize lhs, T rhs) noexcept |
| Mixed remainder. | |
| std::ostream & | operator<< (std::ostream &stream, ByteSize size) |
| Writes the IEC human-readable length. | |
| std::ostream & | operator<< (std::ostream &stream, const CString &text) |
Writes text to stream. | |
| bool | operator== (const char *str, const CString &text) noexcept |
| Content equality. | |
| bool | operator!= (const char *str, const CString &text) noexcept |
| Content inequality. | |
| void | swap (CString &left, CString &right) noexcept |
| Swaps two buffers. | |
| template<typename E > | |
| auto | Unexpected (Safe::Shared< E > error) |
| Forwards an error already stored by Expected. | |
| template<typename E > | |
| auto | Unexpected (std::shared_ptr< E >)=delete |
Rejects a std::shared_ptr. | |
| template<typename E > requires ( !requires { typename std::remove_cvref_t<E>::element_type; } || !Type::SameAs<std::remove_cvref_t<E>, Safe::Shared<typename std::remove_cvref_t<E>::element_type>> ) | |
| auto | Unexpected (E &&error) |
Builds std::unexpected by constructing E. | |
| template<typename Base , typename Derived > requires Type::DerivedFrom<std::decay_t<Derived>, Base> && (!Type::SameAs<Base, std::decay_t<Derived>>) | |
| auto | Unexpected (Derived &&error) -> std::unexpected< Safe::Shared< Base > > |
Builds std::unexpected<shared_ptr<Base>> from a Derived instance. | |
| template<typename E , typename... Args> | |
| auto | Unexpected (const std::string &fmt, Args &&... args) |
Builds std::unexpected from a format string and E(string). | |
| void | append_bytes (BinaryData &dest, std::span< const std::byte > src) noexcept |
| Appends a span of bytes onto a BinaryData. | |
| void | append_bytes (BinaryData &dest, const BinaryData &src) noexcept |
| Appends a BinaryData by copy. | |
| void | append_bytes (BinaryData &dest, BinaryData &&src) noexcept |
| Appends a BinaryData by move on Base's heap. | |
| template<typename T , typename U > requires Type::ConvertibleTo<T, U> | |
| void | append_vector (std::vector< T > &dest, std::span< U > src) noexcept |
| Appends a span of convertible elements onto a vector. | |
| template<typename T > | |
| void | append_vector (std::vector< T > &dest, const std::vector< T > &src) noexcept |
| Appends a vector by copy. | |
| template<typename T > | |
| void | append_vector (std::vector< T > &dest, std::vector< T > &&src) noexcept |
| Appends a vector by move. | |
| template<Type::Integral T> | |
| constexpr bool | operator== (Size lhs, T rhs) noexcept |
| Mixed equality. | |
| template<Type::Integral T> | |
| constexpr bool | operator== (T lhs, Size rhs) noexcept |
| Mixed equality. | |
| template<Type::Integral T> | |
| constexpr std::strong_ordering | operator<=> (Size lhs, T rhs) noexcept |
| Mixed order. | |
| template<Type::Integral T> | |
| constexpr std::strong_ordering | operator<=> (T lhs, Size rhs) noexcept |
| Mixed order. | |
| template<Type::Integral T> | |
| constexpr Size | operator+ (Size lhs, T rhs) noexcept |
| Mixed sum. | |
| template<Type::Integral T> | |
| constexpr Size | operator+ (T lhs, Size rhs) noexcept |
| Mixed sum. | |
| template<Type::Integral T> | |
| constexpr Size | operator- (Size lhs, T rhs) noexcept |
| Mixed difference. | |
| template<Type::Integral T> | |
| constexpr Size | operator- (T lhs, Size rhs) noexcept |
| Mixed difference. | |
| template<Type::Integral T> | |
| constexpr Size | operator* (Size lhs, T rhs) noexcept |
| Mixed product. | |
| template<Type::Integral T> | |
| constexpr Size | operator* (T lhs, Size rhs) noexcept |
| Mixed product. | |
| template<Type::Integral T> | |
| constexpr Size | operator/ (Size lhs, T rhs) noexcept |
| Mixed quotient. | |
| template<Type::Integral T> | |
| constexpr Size | operator/ (T lhs, Size rhs) noexcept |
| Mixed quotient. | |
| template<Type::Integral T> | |
| constexpr Size | operator% (Size lhs, T rhs) noexcept |
| Mixed remainder. | |
| template<Type::Integral T> | |
| constexpr Size | operator% (T lhs, Size rhs) noexcept |
| Mixed remainder. | |
| std::ostream & | operator<< (std::ostream &stream, Size size) |
| Writes the decimal count. | |
| CString | GenerateUUIDv4 () noexcept |
| RFC 4122 UUID version 4 (lowercase). | |
| std::wostream & | operator<< (std::wostream &stream, const WCString &text) |
Writes text to stream. | |
| bool | operator== (const wchar_t *str, const WCString &text) noexcept |
| Content equality. | |
| bool | operator!= (const wchar_t *str, const WCString &text) noexcept |
| Content inequality. | |
| void | swap (WCString &left, WCString &right) noexcept |
| Swaps two buffers. | |
Variables | |
| constexpr ByteSize | B {1ull} |
| One octet. | |
| constexpr ByteSize | KiB {1024ull} |
| 2^10 octets. | |
| constexpr ByteSize | MiB {1024ull * 1024} |
| 2^20 octets. | |
| constexpr ByteSize | GiB {1024ull * 1024 * 1024} |
| 2^30 octets. | |
| constexpr ByteSize | TiB {1024ull * 1024 * 1024 * 1024} |
| 2^40 octets. | |
| constexpr ByteSize | PiB {1024ull * 1024 * 1024 * 1024 * 1024} |
| 2^50 octets. | |
| constexpr ByteSize | EiB {1024ull * 1024 * 1024 * 1024 * 1024 * 1024} |
| 2^60 octets. | |
| constexpr ByteSize | KB {1000ull} |
| 10^3 octets. | |
| constexpr ByteSize | MB {1000ull * 1000} |
| 10^6 octets. | |
| constexpr ByteSize | GB {1000ull * 1000 * 1000} |
| 10^9 octets. | |
| constexpr ByteSize | TB {1000ull * 1000 * 1000 * 1000} |
| 10^12 octets. | |
| constexpr ByteSize | PB {1000ull * 1000 * 1000 * 1000 * 1000} |
| 10^15 octets. | |
| constexpr ByteSize | EB {1000ull * 1000 * 1000 * 1000 * 1000 * 1000} |
| 10^18 octets. | |
Root namespace of the StormByte suite.
| using StormByte::Expected = typedef std::conditional_t< Type::Reference<T>, std::expected<std::reference_wrapper<std::remove_reference_t<T> >, Safe::Shared<E> >, std::expected<T, Safe::Shared<E> > > |
std::expected alias with reference and shared-error handling.
| T | Value type. References are stored as std::reference_wrapper. |
| E | Error type. Always stored as Safe::Shared. Converts to std::shared_ptr<E>. |
|
inlinenoexcept |
Appends a BinaryData by move on Base's heap.
| dest | Destination owned by Base. |
| src | Source sequence; emptied after a successful append. |
|
inlinenoexcept |
Appends a BinaryData by copy.
| dest | Destination owned by Base. |
| src | Source sequence (read-only). |
|
inlinenoexcept |
Appends a span of bytes onto a BinaryData.
| dest | Destination owned by Base. |
| src | View over the bytes to copy. |
|
noexcept |
Appends a vector by copy.
| T | Element type. |
| dest | Vector that receives the elements. |
| src | Source vector (read-only). |
|
noexcept |
Appends a span of convertible elements onto a vector.
| T | Destination element type. |
| U | Source element type (Type::ConvertibleTo<T, U>). |
| dest | Vector that receives the elements. |
| src | View over the elements to copy. |
|
noexcept |
Appends a vector by move.
| T | Element type. |
| dest | Vector that receives the elements. |
| src | Source vector; elements are moved out. |
| BinaryData StormByte::Base64Decode | ( | std::string_view | input | ) |
Decodes Base64 text into bytes.
Alphabet A–Z a–z 0–9 + / and padding =. Space, tab, newline and CR are ignored. Decoding stops at the first =. Padding is accepted but not strictly checked.
| input | Base64 text (std::string_view, std::string or a string literal). |
| StormByte::Base64Error | If a character is outside the alphabet. |
| CString StormByte::Base64Encode | ( | const BinaryData & | input | ) |
Encodes bytes as Base64 with = padding.
| input | Bytes to encode. |
CString. | CString StormByte::Base64Encode | ( | std::span< const std::byte > | input | ) |
Encodes a contiguous byte span as Base64 with = padding.
| input | Bytes to encode. |
CString.
|
noexcept |
RFC 4122 UUID version 4 (lowercase).
CString xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx where y is 8, 9, a or b. uuid.cxx.
|
inlinenoexcept |
Content inequality.
| str | C string; may be null. |
| text | Buffer. |
|
inlinenoexcept |
Content inequality.
| str | C wide string; may be null. |
| text | Buffer. |
|
inlinenoexcept |
Inequality of a span against a sequence.
| bytes | Left view. |
| data | Right sequence. |
data != bytes.
|
constexprnoexcept |
Mixed remainder.
| T | Integral type. |
| lhs | Dividend. |
| rhs | Divisor. |
|
constexprnoexcept |
Mixed remainder.
| T | Integral type. |
| lhs | Dividend. |
| rhs | Divisor. |
|
constexprnoexcept |
Mixed remainder.
| T | Integral type. |
| lhs | Dividend. |
| rhs | Divisor. |
|
constexprnoexcept |
Mixed product.
| T | Integral type. |
| lhs | Left factor. |
| rhs | Right factor. |
|
constexprnoexcept |
Mixed product.
| T | Integral type. |
| lhs | Left factor. |
| rhs | Right factor. |
|
constexprnoexcept |
Mixed product.
| T | Integral type. |
| lhs | Left factor. |
| rhs | Right factor. |
|
constexprnoexcept |
Mixed product.
| T | Integral type. |
| lhs | Left factor. |
| rhs | Right factor. |
|
constexprnoexcept |
Mixed sum.
| T | Integral type. |
| lhs | Left addend. |
| rhs | Right addend. |
|
constexprnoexcept |
Mixed sum.
| T | Integral type. |
| lhs | Left addend. |
| rhs | Right addend. |
|
constexprnoexcept |
Mixed sum.
| T | Integral type. |
| lhs | Left addend. |
| rhs | Right addend. |
|
constexprnoexcept |
Mixed sum.
| T | Integral type. |
| lhs | Left addend. |
| rhs | Right addend. |
|
constexprnoexcept |
Mixed difference.
| T | Integral type. |
| lhs | Minuend. |
| rhs | Subtrahend. |
|
constexprnoexcept |
Mixed difference.
| T | Integral type. |
| lhs | Minuend. |
| rhs | Subtrahend. |
|
constexprnoexcept |
Mixed difference.
| T | Integral type. |
| lhs | Minuend. |
| rhs | Subtrahend. |
|
constexprnoexcept |
Mixed difference.
| T | Integral type. |
| lhs | Minuend. |
| rhs | Subtrahend. |
|
constexprnoexcept |
Mixed quotient.
| T | Integral type. |
| lhs | Dividend. |
| rhs | Divisor. |
|
constexprnoexcept |
Mixed quotient.
| T | Integral type. |
| lhs | Dividend. |
| rhs | Divisor. |
|
constexprnoexcept |
Mixed quotient.
| T | Integral type. |
| lhs | Dividend. |
| rhs | Divisor. |
|
inline |
Writes the IEC human-readable length.
| stream | Destination. |
| size | Length. |
stream.
|
inline |
Writes text to stream.
| stream | Destination. |
| text | Source. |
stream.
|
inline |
Writes the decimal count.
| stream | Destination. |
| size | Count. |
stream.
|
inline |
Writes text to stream.
| stream | Destination. |
| text | Source. |
stream.
|
constexprnoexcept |
Mixed order.
Mixed order with an integer.
| T | Integral type. |
| lhs | Left length. |
| rhs | Right integer. |
|
constexprnoexcept |
Mixed order.
| T | Integral type. |
| lhs | Left count. |
| rhs | Right integer. |
|
inlinenoexcept |
Three-way comparison of a span against a sequence.
| bytes | Left view. |
| data | Right sequence. |
data <=> bytes.
|
constexprnoexcept |
Mixed order.
Mixed order with an integer.
| T | Integral type. |
| lhs | Left integer. |
| rhs | Right length. |
|
constexprnoexcept |
Mixed order.
| T | Integral type. |
| lhs | Left integer. |
| rhs | Right count. |
|
constexprnoexcept |
Mixed equality.
Mixed equality with an integer.
| T | Integral type. |
| lhs | Left length. |
| rhs | Right integer. |
|
inlinenoexcept |
Content equality.
| str | C string; may be null. |
| text | Buffer. |
|
inlinenoexcept |
Content equality.
| str | C wide string; may be null. |
| text | Buffer. |
|
constexprnoexcept |
Mixed equality.
| T | Integral type. |
| lhs | Left count. |
| rhs | Right integer. |
|
inlinenoexcept |
Equality of a span against a sequence.
| bytes | Left view. |
| data | Right sequence. |
data == bytes.
|
constexprnoexcept |
Mixed equality.
Mixed equality with an integer.
| T | Integral type. |
| lhs | Left integer. |
| rhs | Right length. |
|
constexprnoexcept |
Mixed equality.
| T | Integral type. |
| lhs | Left integer. |
| rhs | Right count. |
|
noexcept |
Exchange two sequences.
| lhs | First sequence. |
| rhs | Second sequence. |
Swaps two buffers.
| left | First buffer. |
| right | Second buffer. |
Swaps two buffers.
| left | First buffer. |
| right | Second buffer. |
| auto StormByte::Unexpected | ( | const std::string & | fmt, |
| Args &&... | args | ||
| ) |
Builds std::unexpected from a format string and E(string).
| E | Error type. Constructed as E(formatted). |
| Args | Format argument types. |
| fmt | Format string. Used as-is when Args is empty. |
| args | Format arguments for std::vformat. |
std::unexpected holding the error on Base's heap.Formatting runs in the caller. E is then constructed on Base's heap, so ‘Unexpected<VaultException>("Password ’{}' not found", name)` stays valid.
| auto StormByte::Unexpected | ( | Derived && | error | ) | -> std::unexpected<Safe::Shared<Base>> |
Builds std::unexpected<shared_ptr<Base>> from a Derived instance.
| Base | Error base type stored in the pointer. |
| Derived | Concrete error type, derived from Base and not the same type. |
| error | Derived instance to own. |
std::unexpected with an upcast Safe::Shared. The deleter still destroys Derived. | auto StormByte::Unexpected | ( | E && | error | ) |
Builds std::unexpected by constructing E.
| E | Error type. |
| error | Error instance, moved or copied onto Base's heap. |
std::unexpected holding Safe::Shared of decay_t<E>. | auto StormByte::Unexpected | ( | Safe::Shared< E > | error | ) |
Forwards an error already stored by Expected.
| E | Error type. |
| error | Pointer previously built by Unexpected. Not reallocated. |
std::unexpected holding that Safe::Shared.
|
delete |
Rejects a std::shared_ptr.
It is not on Base's heap, and Safe::Shared does not adopt it.
| E | Error type. |
|
inlineconstexpr |
One octet.
|
inlineconstexpr |
10^18 octets.
|
inlineconstexpr |
2^60 octets.
|
inlineconstexpr |
10^9 octets.
|
inlineconstexpr |
2^30 octets.
|
inlineconstexpr |
10^3 octets.
|
inlineconstexpr |
2^10 octets.
1 * KiB is 1024.
|
inlineconstexpr |
10^6 octets.
|
inlineconstexpr |
2^20 octets.
|
inlineconstexpr |
10^15 octets.
|
inlineconstexpr |
2^50 octets.
|
inlineconstexpr |
10^12 octets.
|
inlineconstexpr |
2^40 octets.