ZeroErr
Loading...
Searching...
No Matches
zeroerr::Printer Struct Reference

A functor class Printer for printing a value of any type. More...

#include <print.h>

Collaboration diagram for zeroerr::Printer:

Public Member Functions

template<typename... Args>
Printer & operator() (Args &&... args)
template<typename T>
Printer & operator() (std::initializer_list< T > &&value)
void check_stream ()
template<typename T, typename... V>
void call (T &&value, V &&... others)
template<typename T>
void call (T &&value)
 Printer ()
template<class Stream>
 Printer (Stream &stream)
 Printer (const Printer &other)
 print (const T &value, unsigned level, const char *lb, rank< 0 >)
 print (const T &value, unsigned level, const char *lb, rank< 0 >)
 print (const T &value, unsigned level, const char *lb, rank< 0 >)
 ZEROERR_ENABLE_IF (ZEROERR_IS_POINTER &&!std::is_function< typename std::remove_pointer< T >::type >::value) print(const T &value

Static Public Member Functions

template<class T>
static zeroerr::String type (const T &t)

Public Attributes

bool isColorful = true
bool isCompact = false
bool isQuoted = true
int indent = 2
const char * line_break = "\n"
StringBuffer & os
bool use_stringstream = false
bool clear_stream_before_printing = true
unsigned level
unsigned const char * lb
unsigned const char rank< 0 >

Detailed Description

A functor class Printer for printing a value of any type.

This class can print values with all basic types, pointers, STL containers, tuple, optional, and variant values. Any class that is streamable can be printed. POD structs can be supported using third-party library Boost.PFR and enum can be supported using magic_enum.

Constructor & Destructor Documentation

◆ Printer() [1/3]

zeroerr::Printer::Printer ( )
inline

◆ Printer() [2/3]

template<class Stream>
zeroerr::Printer::Printer ( Stream & stream)
inlineexplicit

◆ Printer() [3/3]

zeroerr::Printer::Printer ( const Printer & other)
inline

Member Function Documentation

◆ call() [1/2]

template<typename T>
void zeroerr::Printer::call ( T && value)
inline

◆ call() [2/2]

template<typename T, typename... V>
void zeroerr::Printer::call ( T && value,
V &&... others )
inline

◆ check_stream()

void zeroerr::Printer::check_stream ( )
inline

◆ operator()() [1/2]

template<typename... Args>
Printer & zeroerr::Printer::operator() ( Args &&... args)
inline

◆ operator()() [2/2]

template<typename T>
Printer & zeroerr::Printer::operator() ( std::initializer_list< T > && value)
inline

◆ print() [1/3]

zeroerr::Printer::print ( const T & value,
unsigned level,
const char * lb,
rank< 0 >  )
inline

◆ print() [2/3]

zeroerr::Printer::print ( const T & value,
unsigned level,
const char * lb,
rank< 0 >  )
inline

◆ print() [3/3]

zeroerr::Printer::print ( const T & value,
unsigned level,
const char * lb,
rank< 0 >  )
inline

◆ type()

template<class T>
zeroerr::String zeroerr::Printer::type ( const T & t)
inlinestatic

◆ ZEROERR_ENABLE_IF()

zeroerr::Printer::ZEROERR_ENABLE_IF ( ZEROERR_IS_POINTER &&!std::is_function< typename std::remove_pointer< T >::type >::value ) const &

Member Data Documentation

◆ clear_stream_before_printing

bool zeroerr::Printer::clear_stream_before_printing = true

◆ indent

int zeroerr::Printer::indent = 2

◆ isColorful

bool zeroerr::Printer::isColorful = true

◆ isCompact

bool zeroerr::Printer::isCompact = false

◆ isQuoted

bool zeroerr::Printer::isQuoted = true

◆ lb

unsigned const char* zeroerr::Printer::lb

◆ level

unsigned zeroerr::Printer::level

◆ line_break

const char* zeroerr::Printer::line_break = "\n"

◆ os

StringBuffer& zeroerr::Printer::os

◆ rank< 0 >

unsigned const char zeroerr::Printer::rank< 0 >
Initial value:
{
if (value == nullptr)
os << tab(level) << "nullptr" << lb
unsigned const char * lb
Definition print.h:163
StringBuffer & os
Definition print.h:134
unsigned level
Definition print.h:163

◆ use_stringstream

bool zeroerr::Printer::use_stringstream = false

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