StormByte C++ Library 0.0.9999
StormByte is a comprehensive, cross-platform C++ library aimed at easing system programming, configuration management, logging, and database handling tasks. This library provides a unified API that abstracts away the complexities and inconsistencies of different platforms (Windows, Linux).
Loading...
Searching...
No Matches
Classes | Concepts | Typedefs | Functions
StormByte Namespace Reference

Main namespace for the StormByte library. More...

Classes

class  ArithmeticMutexed
 
class  Clonable
 A class that can be cloned. More...
 
class  Exception
 Base class for exceptions in the StormByte library. More...
 
struct  is_container
 Type trait to check if a type is a container. More...
 
struct  is_container< T, std::void_t< decltype(std::declval< T >().begin()), decltype(std::declval< T >().end()), typename T::value_type > >
 Type trait specialization for containers. More...
 
struct  is_optional
 Type trait to check if a type is an optional. More...
 
struct  is_optional< T, std::void_t< typename T::value_type > >
 Type trait specialization for std::optional. More...
 
struct  is_pair
 Type trait to check if a type is a pair. More...
 
struct  is_pair< T, std::void_t< decltype(std::declval< T >().first), decltype(std::declval< T >().second) > >
 Type trait specialization for pairs. More...
 
struct  is_reference
 Type traits for checking if a type is a reference. More...
 
class  Logger
 A flexible and extensible logging utility. More...
 
class  Mutexed
 
class  Serializable
 The class to serialize and deserialize data. More...
 
class  VariadicValue
 A class that can hold a value of any of the specified types. More...
 

Concepts

concept  ValidSmartPointer
 Concept to check if a type is a valid smart pointer.
 
concept  ValidVariadicType
 Concept to check if a type is a valid variadic type.
 

Typedefs

template<typename T , class E >
using Expected = std::conditional_t< is_reference< T >::value, std::expected< std::reference_wrapper< std::remove_reference_t< T > >, std::shared_ptr< E > >, std::expected< T, std::shared_ptr< E > > >
 Expected type with support for reference types.
 

Functions

template<typename E >
auto Unexpected (std::shared_ptr< E > error_ptr)
 Creates an std::unexpected with a shared pointer to the error.
 
template<typename E >
auto Unexpected (E &&error)
 Creates an std::unexpected with a new error instance.
 
template<typename E , typename... Args>
auto Unexpected (const std::string &fmt, Args &&... args)
 Creates an std::unexpected with a formatted error message.
 
STORMBYTE_PUBLIC Loggerhumanreadable_number (Logger &logger) noexcept
 
STORMBYTE_PUBLIC Loggerhumanreadable_bytes (Logger &logger) noexcept
 
STORMBYTE_PUBLIC Loggernohumanreadable (Logger &logger) noexcept
 
template<typename Ptr , typename T >
requires std::is_same_v<Ptr, std::shared_ptr<Logger>> || std::is_same_v<Ptr, std::unique_ptr<Logger>>
Ptroperator<< (Ptr &logger, const T &value) noexcept
 
template<typename Ptr >
requires std::is_same_v<Ptr, std::shared_ptr<Logger>> || std::is_same_v<Ptr, std::unique_ptr<Logger>>
Ptroperator<< (Ptr &logger, const Logger::Level &level) noexcept
 
template<typename Ptr >
requires std::is_same_v<Ptr, std::shared_ptr<Logger>> || std::is_same_v<Ptr, std::unique_ptr<Logger>>
Ptroperator<< (Ptr &logger, std::ostream &(*manip)(std::ostream &)) noexcept
 

Detailed Description

Main namespace for the StormByte library.

The StormByte namespace serves as the root for all components and utilities in the StormByte library. It provides foundational classes and tools for building robust, thread-safe, and efficient applications.

Typedef Documentation

◆ Expected

template<typename T , class E >
using StormByte::Expected = typedef std::conditional_t< is_reference<T>::value, std::expected<std::reference_wrapper<std::remove_reference_t<T> >, std::shared_ptr<E> >, std::expected<T, std::shared_ptr<E> > >

Expected type with support for reference types.

Template Parameters
TExpected type
EError type

Defines an alias for std::expected, with special handling for reference types. For reference types, the std::reference_wrapper ensures safe and efficient storage, while the error type is managed using std::shared_ptr to support dynamic allocation.

Function Documentation

◆ Unexpected() [1/3]

template<typename E , typename... Args>
auto StormByte::Unexpected ( const std::string &  fmt,
Args &&...  args 
)

Creates an std::unexpected with a formatted error message.

Template Parameters
EError type
ArgsTypes of arguments to format the error message
Parameters
fmtThe format string
argsArguments to format the string
Returns
An std::unexpected object containing a shared pointer to the error

Dynamically formats the error message using std::vformat and constructs the error instance with the formatted message. If no arguments are provided, it directly uses the format string as the error message.

◆ Unexpected() [2/3]

template<typename E >
auto StormByte::Unexpected ( E &&  error)

Creates an std::unexpected with a new error instance.

Template Parameters
EError type
Parameters
errorError instance to store
Returns
An std::unexpected object containing a shared pointer to the new error instance

This overload constructs a new error instance by forwarding the provided argument.

◆ Unexpected() [3/3]

template<typename E >
auto StormByte::Unexpected ( std::shared_ptr< E error_ptr)

Creates an std::unexpected with a shared pointer to the error.

Template Parameters
EError type
Parameters
error_ptrA shared pointer to the error
Returns
An std::unexpected object containing the shared pointer to the error

This overload is used when an existing std::shared_ptr to the error instance is available.