mimic++ v6
Loading...
Searching...
No Matches
mimicpp::Stacktrace Class Reference

A simple type-erase stacktrace abstraction. More...

#include <Stacktrace.hpp>

Public Types

using size_fn = std::size_t (*)(const std::any&)
 
using empty_fn = bool (*)(const std::any&)
 
using description_fn = std::string (*)(const std::any&, std::size_t)
 
using source_file_fn = std::string (*)(const std::any&, std::size_t)
 
using source_line_fn = std::size_t (*)(const std::any&, std::size_t)
 

Public Member Functions

 ~Stacktrace ()=default
 Defaulted destructor.
 
template<typename Inner>
requires (!std::same_as<Stacktrace, std::remove_cvref_t<Inner>>) && stacktrace::backend<Inner>
constexpr Stacktrace (Inner &&inner)
 Constructor storing the given stacktrace-backend type-erased.
 
 Stacktrace (const Stacktrace &)=default
 Defaulted move-constructor.
 
Stacktraceoperator= (const Stacktrace &)=default
 Defaulted move-assignment-operator.
 
 Stacktrace (Stacktrace &&)=default
 Defaulted copy-constructor.
 
Stacktraceoperator= (Stacktrace &&)=default
 Defaulted copy-assignment-operator.
 
constexpr std::size_t size () const
 Queries the underlying stacktrace-backend for its size.
 
constexpr bool empty () const
 Queries the underlying stacktrace-backend whether its empty.
 
constexpr std::string description (const std::size_t at) const
 Queries the underlying stacktrace-backend for the description of the selected stacktrace-entry.
 
constexpr std::string source_file (const std::size_t at) const
 Queries the underlying stacktrace-backend for the source-file of the selected stacktrace-entry.
 
constexpr std::size_t source_line (const std::size_t at) const
 Queries the underlying stacktrace-backend for the source-line of the selected stacktrace-entry.
 

Friends

bool operator== (const Stacktrace &lhs, const Stacktrace &rhs)
 

Detailed Description

A simple type-erase stacktrace abstraction.

Member Typedef Documentation

◆ description_fn

using mimicpp::Stacktrace::description_fn = std::string (*)(const std::any&, std::size_t)

◆ empty_fn

using mimicpp::Stacktrace::empty_fn = bool (*)(const std::any&)

◆ size_fn

using mimicpp::Stacktrace::size_fn = std::size_t (*)(const std::any&)

◆ source_file_fn

using mimicpp::Stacktrace::source_file_fn = std::string (*)(const std::any&, std::size_t)

◆ source_line_fn

using mimicpp::Stacktrace::source_line_fn = std::size_t (*)(const std::any&, std::size_t)

Constructor & Destructor Documentation

◆ ~Stacktrace()

mimicpp::Stacktrace::~Stacktrace ( )
default

Defaulted destructor.

◆ Stacktrace() [1/3]

template<typename Inner>
requires (!std::same_as<Stacktrace, std::remove_cvref_t<Inner>>) && stacktrace::backend<Inner>
mimicpp::Stacktrace::Stacktrace ( Inner && inner)
inlineexplicitnodiscardconstexpr

Constructor storing the given stacktrace-backend type-erased.

Template Parameters
InnerThe actual stacktrace-backend type.
TraitsThe auto-detected trait type.
Parameters
innerThe actual stacktrace-backend object.
Here is the caller graph for this function:

◆ Stacktrace() [2/3]

mimicpp::Stacktrace::Stacktrace ( const Stacktrace & )
nodiscarddefault

Defaulted move-constructor.

Here is the call graph for this function:

◆ Stacktrace() [3/3]

mimicpp::Stacktrace::Stacktrace ( Stacktrace && )
nodiscarddefault

Defaulted copy-constructor.

Here is the call graph for this function:

Member Function Documentation

◆ description()

std::string mimicpp::Stacktrace::description ( const std::size_t at) const
inlinenodiscardconstexpr

Queries the underlying stacktrace-backend for the description of the selected stacktrace-entry.

Parameters
atThe stacktrace-entry index.
Returns
The description of the selected stacktrace-entry.

◆ empty()

bool mimicpp::Stacktrace::empty ( ) const
inlinenodiscardconstexpr

Queries the underlying stacktrace-backend whether its empty.

Returns
True if no stacktrace-entries exist.

◆ operator=() [1/2]

Stacktrace & mimicpp::Stacktrace::operator= ( const Stacktrace & )
default

Defaulted move-assignment-operator.

Here is the call graph for this function:

◆ operator=() [2/2]

Stacktrace & mimicpp::Stacktrace::operator= ( Stacktrace && )
default

Defaulted copy-assignment-operator.

Here is the call graph for this function:

◆ size()

std::size_t mimicpp::Stacktrace::size ( ) const
inlinenodiscardconstexpr

Queries the underlying stacktrace-backend for its size.

Returns
The stacktrace-entry size.
Here is the caller graph for this function:

◆ source_file()

std::string mimicpp::Stacktrace::source_file ( const std::size_t at) const
inlinenodiscardconstexpr

Queries the underlying stacktrace-backend for the source-file of the selected stacktrace-entry.

Parameters
atThe stacktrace-entry index.
Returns
The source-file of the selected stacktrace-entry.

◆ source_line()

std::size_t mimicpp::Stacktrace::source_line ( const std::size_t at) const
inlinenodiscardconstexpr

Queries the underlying stacktrace-backend for the source-line of the selected stacktrace-entry.

Parameters
atThe stacktrace-entry index.
Returns
The source-line of the selected stacktrace-entry.

Friends And Related Symbol Documentation

◆ operator==

bool operator== ( const Stacktrace & lhs,
const Stacktrace & rhs )
friend

The documentation for this class was generated from the following file: