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

Streaming view of a foreign or non-contiguous string. More...

#include <foreign_string_view.hpp>

Public Member Functions

constexpr foreign_string_view () noexcept=default
 Constructs an empty (null) foreign string view.
 
constexpr foreign_string_view (uintptr_t addr, address_space_ref space, span< char > scratch RELOCO_LIFETIMEBOUND RELOCO_LIFETIME_CAPTURE_BY_THIS, size_t max_limit=4096) noexcept
 Constructs a view over a foreign string using an address space and address.
 
template<size_t N>
constexpr foreign_string_view (uintptr_t addr, address_space_ref space, char(&scratch RELOCO_LIFETIMEBOUND RELOCO_LIFETIME_CAPTURE_BY_THIS)[N], size_t max_limit=4096) noexcept
 Constructs a view over a foreign string using a fixed C array as scratch.
 
constexpr uintptr_t address () const noexcept
 Returns the foreign string address.
 
constexpr address_space_ref space () const noexcept
 Returns the address space handle.
 
constexpr span< char > scratch () const noexcept RELOCO_LIFETIMEBOUND
 Returns the scratch chunk buffer.
 
constexpr size_t max_limit () const noexcept
 Returns the maximum render length.
 

Detailed Description

Streaming view of a foreign or non-contiguous string.

Pulls a string from a custom source or foreign address space through a reusable scratch buffer in bounded chunks.

Constructor & Destructor Documentation

◆ foreign_string_view() [1/3]

constexpr microfmt::foreign_string_view::foreign_string_view ( )
constexprdefaultnoexcept

Constructs an empty (null) foreign string view.

◆ foreign_string_view() [2/3]

constexpr microfmt::foreign_string_view::foreign_string_view ( uintptr_t  addr,
address_space_ref  space,
span< char > scratch RELOCO_LIFETIMEBOUND  RELOCO_LIFETIME_CAPTURE_BY_THIS,
size_t  max_limit = 4096 
)
inlineconstexprnoexcept

Constructs a view over a foreign string using an address space and address.

Parameters
addrAbsolute address or identifier of the foreign string.
spaceAddress space handle used to read the string chunks.
scratchReusable chunk-read buffer.
max_limitMaximum characters to render.

◆ foreign_string_view() [3/3]

template<size_t N>
constexpr microfmt::foreign_string_view::foreign_string_view ( uintptr_t  addr,
address_space_ref  space,
char(&)  RELOCO_LIFETIME_CAPTURE_BY_THIS[N],
size_t  max_limit = 4096 
)
inlineconstexprnoexcept

Constructs a view over a foreign string using a fixed C array as scratch.

Template Parameters
NSize of the scratch array.
Parameters
addrAbsolute address or identifier of the foreign string.
spaceAddress space handle used to read the string chunks.
scratchReusable chunk-read buffer.
max_limitMaximum characters to render.

Member Function Documentation

◆ address()

constexpr uintptr_t microfmt::foreign_string_view::address ( ) const
inlineconstexprnoexcept

Returns the foreign string address.

Returns
Absolute address, or 0 when null.

◆ max_limit()

constexpr size_t microfmt::foreign_string_view::max_limit ( ) const
inlineconstexprnoexcept

Returns the maximum render length.

Returns
Character limit.

◆ scratch()

constexpr span< char > microfmt::foreign_string_view::scratch ( ) const
inlineconstexprnoexcept

Returns the scratch chunk buffer.

Returns
Scratch span used for chunked reads.

◆ space()

constexpr address_space_ref microfmt::foreign_string_view::space ( ) const
inlineconstexprnoexcept

Returns the address space handle.

Returns
Bound address_space_ref.

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