libsir 2.2.5
Standard Incident Reporter
Loading...
Searching...
No Matches
sir Namespace Reference

libsir C++ wrapper implementation. More...

Namespaces

namespace  tests
 libsir C++ wrapper tests.
 

Data Structures

class  adapter
 Defines the abstract interface for an adapter, which ultimately becomes a public base class of logger (there can be more than one). More...
 
class  boost_format_adapter
 Adapter for boost::format (when available). More...
 
class  default_adapter
 The default adapter implementation. More...
 
class  default_policy
 In the event that no custom configuration or behavior is desired, provides defaults for everything. More...
 
struct  error
 Contains basic information about an error. More...
 
struct  error_info
 Contains all available information about an error. More...
 
class  exception
 The exception type thrown by libsir. More...
 
class  fmt_format_adapter
 Adapter for {fmt} (when available). More...
 
class  logger
 The primary C++ interface to libsir. More...
 
class  policy
 Defines the partially abstract interface for a policy which controls the behavior of logger at runtime. More...
 
class  std_format_adapter
 Adapter for std::format (when available). More...
 
class  std_iostream_adapter
 Provides a std::iostream interface to libsir's logging functions. More...
 

Concepts

concept  DerivedFromPolicy
 Ensures that T derives from policy.
 
concept  DerivedFromStreamBuf
 Ensures that T derives from std::streambuf.
 
concept  DerivedFromT
 True if all Ts are derived classes of TBase, otherwise false.
 

Typedefs

template<size_t N, typename ... Ts>
using NthTypeOf = typename std::tuple_element<N, std::tuple<Ts...>>::type
 Utility template for obtaining the type of Nth item in a parameter pack.
 
using default_logger = logger<true, default_policy, default_adapter>
 A logger that implements the default adapter.
 
using std_format_logger
 A logger that implements the default adapter and the std::format adapter.
 
using boost_logger
 A logger that implements the default adapter and the boost::format adapter.
 
using fmt_logger
 A logger that implements the default adapter and the fmt::format adapter.
 
using iostream_logger
 A logger that implements the default adapter and the std::iostream adapter.
 

Functions

template<DerivedFromPolicy TPolicy>
static bool throw_on_policy (bool expr) noexcept(false)
 Handles a potential error; if an error is present and the policy in place requires throwing an exception, retrieves the associated error code and message from libsir, then throws.
 
template<size_t N, typename TBase , typename ... Ts>
consteval auto all_derived_from_t ()
 Ensures (at compile time) that all Ts are derived classes of TBase.
 

Detailed Description

libsir C++ wrapper implementation.

Function Documentation

◆ throw_on_policy()

template<DerivedFromPolicy TPolicy>
static bool sir::throw_on_policy ( bool expr)
inlinestatic

Handles a potential error; if an error is present and the policy in place requires throwing an exception, retrieves the associated error code and message from libsir, then throws.

Template Parameters
TPolicyA derived class of policy which determines whether or not to throw exceptions upon encountering an error.
Parameters
exprAn expression that is evaluated against false. If false, an error is determined to have occurred and an exception will be thrown if the policy requires it.
Returns
bool If no exception was thrown, the return value is expr (true if no error occurred, false otherwise).