microfmt
Zero-allocation C++ formatting for constrained environments
Loading...
Searching...
No Matches
Public Member Functions | List of all members
microfmt::exception_frame_iterator Class Reference

Forward-only cursor iterating over a chain of trap frames. More...

#include <exception_frame.hpp>

Public Member Functions

constexpr exception_frame_iterator () noexcept=default
 Constructs an empty (invalid) iterator.
 
constexpr exception_frame_iterator (exception_frame_ref decoder, uintptr_t initial_trap_frame_addr) noexcept
 Constructs an iterator rooted at the given trap frame.
 
constexpr const trap_context & operator* () const noexcept
 Returns the current decoded trap context.
 
constexpr const trap_context * operator-> () const noexcept
 Returns the current decoded trap context.
 
constexpr bool has_value () const noexcept
 Reports whether the iterator is positioned on a trap frame.
 
constexpr operator bool () const noexcept
 Reports whether the iterator is positioned on a trap frame.
 
bool next () noexcept
 Advances to the next (outer/nested) trap frame.
 
exception_frame_iterator & operator++ () noexcept
 Pre-increment advancing to the next trap frame.
 
template<typename Visitor >
void for_each_trap (Visitor &&visitor, uint32_t max_traps=8) noexcept
 Visitor-style traversal over the trap chain.
 

Detailed Description

Forward-only cursor iterating over a chain of trap frames.

Constructor & Destructor Documentation

◆ exception_frame_iterator() [1/2]

constexpr microfmt::exception_frame_iterator::exception_frame_iterator ( )
constexprdefaultnoexcept

Constructs an empty (invalid) iterator.

◆ exception_frame_iterator() [2/2]

constexpr microfmt::exception_frame_iterator::exception_frame_iterator ( exception_frame_ref  decoder,
uintptr_t  initial_trap_frame_addr 
)
inlineconstexprnoexcept

Constructs an iterator rooted at the given trap frame.

Parameters
decoderTrap-frame decoder driving the iteration.
initial_trap_frame_addrAddress of the first trap frame.

Member Function Documentation

◆ for_each_trap()

template<typename Visitor >
void microfmt::exception_frame_iterator::for_each_trap ( Visitor &&  visitor,
uint32_t  max_traps = 8 
)
inlinenoexcept

Visitor-style traversal over the trap chain.

Template Parameters
VisitorCallable accepting const trap_context & and returning bool (true = continue).
Parameters
visitorVisitor invoked per trap frame.
max_trapsMaximum trap level to visit.

◆ has_value()

constexpr bool microfmt::exception_frame_iterator::has_value ( ) const
inlineconstexprnoexcept

Reports whether the iterator is positioned on a trap frame.

Returns
true while the current frame is valid.

◆ next()

bool microfmt::exception_frame_iterator::next ( )
inlinenoexcept

Advances to the next (outer/nested) trap frame.

Returns
false when the chain ends.

◆ operator bool()

constexpr microfmt::exception_frame_iterator::operator bool ( ) const
inlineexplicitconstexprnoexcept

Reports whether the iterator is positioned on a trap frame.

Returns
true while the current frame is valid.

◆ operator*()

constexpr const trap_context & microfmt::exception_frame_iterator::operator* ( ) const
inlineconstexprnoexcept

Returns the current decoded trap context.

Returns
Reference to the current trap_context.

◆ operator++()

exception_frame_iterator & microfmt::exception_frame_iterator::operator++ ( )
inlinenoexcept

Pre-increment advancing to the next trap frame.

Returns
This iterator.

◆ operator->()

constexpr const trap_context * microfmt::exception_frame_iterator::operator-> ( ) const
inlineconstexprnoexcept

Returns the current decoded trap context.

Returns
Pointer to the current trap_context.

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