microfmt
Zero-allocation C++ formatting for constrained environments
Loading...
Searching...
No Matches
Classes | Enumerations | Functions | Variables
microfmt::ansi Namespace Reference

Classes

struct  style
 
struct  styled_view
 

Enumerations

enum class  color : uint8_t {
  none = 0 , black = 30 , red = 31 , green = 32 ,
  yellow = 33 , blue = 34 , magenta = 35 , cyan = 36 ,
  white = 37 , bright_black = 90 , bright_red = 91 , bright_green = 92 ,
  bright_yellow = 93 , bright_blue = 94 , bright_magenta = 95 , bright_cyan = 96 ,
  bright_white = 97
}
 
enum class  attribute : uint8_t {
  none = 0 , bold = 1 << 0 , dim = 1 << 1 , italic = 1 << 2 ,
  underline = 1 << 3 , blink = 1 << 4 , reverse = 1 << 5
}
 

Functions

RELOCO_BEGIN_UNSAFE_CODE constexpr attribute operator| (attribute a, attribute b) noexcept
 
RELOCO_END_UNSAFE_CODE constexpr bool operator& (attribute a, attribute b) noexcept
 
MICROFMT_API void emit_style (const style &s, const sink &out) noexcept
 
MICROFMT_API void emit_reset (const sink &out) noexcept
 
template<typename T >
constexpr styled_view< T > styled (const T &val, style st) noexcept
 
template<typename T >
constexpr styled_view< T > red (const T &val) noexcept
 
template<typename T >
constexpr styled_view< T > green (const T &val) noexcept
 
template<typename T >
constexpr styled_view< T > yellow (const T &val) noexcept
 
template<typename T >
constexpr styled_view< T > blue (const T &val) noexcept
 
template<typename T >
constexpr styled_view< T > magenta (const T &val) noexcept
 
template<typename T >
constexpr styled_view< T > cyan (const T &val) noexcept
 
template<typename T >
constexpr styled_view< T > white (const T &val) noexcept
 
template<typename T >
constexpr styled_view< T > gray (const T &val) noexcept
 

Variables

constexpr style reset {}
 
constexpr style fg_black {color::black}
 
constexpr style fg_red {color::red}
 
constexpr style fg_green {color::green}
 
constexpr style fg_yellow {color::yellow}
 
constexpr style fg_blue {color::blue}
 
constexpr style fg_magenta {color::magenta}
 
constexpr style fg_cyan {color::cyan}
 
constexpr style fg_white {color::white}
 
constexpr style fg_gray {color::bright_black}
 
constexpr style fg_bright_black {color::bright_black}
 
constexpr style fg_bright_red {color::bright_red}
 
constexpr style fg_bright_green {color::bright_green}
 
constexpr style fg_bright_yellow {color::bright_yellow}
 
constexpr style fg_bright_blue {color::bright_blue}
 
constexpr style fg_bright_magenta {color::bright_magenta}
 
constexpr style fg_bright_cyan {color::bright_cyan}
 
constexpr style fg_bright_white {color::bright_white}
 
constexpr style bg_black {color::none, color::black}
 
constexpr style bg_red {color::none, color::red}
 
constexpr style bg_green {color::none, color::green}
 
constexpr style bg_yellow {color::none, color::yellow}
 
constexpr style bg_blue {color::none, color::blue}
 
constexpr style bg_magenta {color::none, color::magenta}
 
constexpr style bg_cyan {color::none, color::cyan}
 
constexpr style bg_white {color::none, color::white}
 
constexpr style bg_gray {color::none, color::bright_black}
 
constexpr style bg_bright_black {color::none, color::bright_black}
 
constexpr style bg_bright_red {color::none, color::bright_red}
 
constexpr style bg_bright_green {color::none, color::bright_green}
 
constexpr style bg_bright_yellow {color::none, color::bright_yellow}
 
constexpr style bg_bright_blue {color::none, color::bright_blue}
 
constexpr style bg_bright_magenta {color::none, color::bright_magenta}
 
constexpr style bg_bright_cyan {color::none, color::bright_cyan}
 
constexpr style bg_bright_white {color::none, color::bright_white}
 
constexpr style bold {color::none, color::none, attribute::bold}
 
constexpr style dim {color::none, color::none, attribute::dim}
 
constexpr style italic {color::none, color::none, attribute::italic}
 
constexpr style underline {color::none, color::none, attribute::underline}
 
constexpr style blink {color::none, color::none, attribute::blink}
 
constexpr style reverse {color::none, color::none, attribute::reverse}
 
constexpr style error_style {color::bright_red, color::none, attribute::bold}
 
constexpr style warn_style {color::bright_yellow, color::none, attribute::bold}
 
constexpr style ok_style {color::bright_green, color::none, attribute::bold}
 
constexpr style info_style {color::bright_cyan, color::none, attribute::none}
 

Enumeration Type Documentation

◆ attribute

enum class microfmt::ansi::attribute : uint8_t
strong
Enumerator
none 
bold 
dim 
italic 
underline 
blink 
reverse 

◆ color

enum class microfmt::ansi::color : uint8_t
strong
Enumerator
none 
black 
red 
green 
yellow 
blue 
magenta 
cyan 
white 
bright_black 
bright_red 
bright_green 
bright_yellow 
bright_blue 
bright_magenta 
bright_cyan 
bright_white 

Function Documentation

◆ blue()

template<typename T >
constexpr styled_view< T > microfmt::ansi::blue ( const T &  val)
constexprnoexcept

◆ cyan()

template<typename T >
constexpr styled_view< T > microfmt::ansi::cyan ( const T &  val)
constexprnoexcept

◆ emit_reset()

MICROFMT_API void microfmt::ansi::emit_reset ( const sink &  out)
noexcept

◆ emit_style()

MICROFMT_API void microfmt::ansi::emit_style ( const style &  s,
const sink &  out 
)
noexcept

◆ gray()

template<typename T >
constexpr styled_view< T > microfmt::ansi::gray ( const T &  val)
constexprnoexcept

◆ green()

template<typename T >
constexpr styled_view< T > microfmt::ansi::green ( const T &  val)
constexprnoexcept

◆ magenta()

template<typename T >
constexpr styled_view< T > microfmt::ansi::magenta ( const T &  val)
constexprnoexcept

◆ operator&()

RELOCO_END_UNSAFE_CODE constexpr bool microfmt::ansi::operator& ( attribute  a,
attribute  b 
)
constexprnoexcept

◆ operator|()

RELOCO_BEGIN_UNSAFE_CODE constexpr attribute microfmt::ansi::operator| ( attribute  a,
attribute  b 
)
constexprnoexcept

◆ red()

template<typename T >
constexpr styled_view< T > microfmt::ansi::red ( const T &  val)
constexprnoexcept

◆ styled()

template<typename T >
constexpr styled_view< T > microfmt::ansi::styled ( const T &  val,
style  st 
)
constexprnoexcept

◆ white()

template<typename T >
constexpr styled_view< T > microfmt::ansi::white ( const T &  val)
constexprnoexcept

◆ yellow()

template<typename T >
constexpr styled_view< T > microfmt::ansi::yellow ( const T &  val)
constexprnoexcept

Variable Documentation

◆ bg_black

constexpr style microfmt::ansi::bg_black {color::none, color::black}
inlineconstexpr

◆ bg_blue

constexpr style microfmt::ansi::bg_blue {color::none, color::blue}
inlineconstexpr

◆ bg_bright_black

constexpr style microfmt::ansi::bg_bright_black {color::none, color::bright_black}
inlineconstexpr

◆ bg_bright_blue

constexpr style microfmt::ansi::bg_bright_blue {color::none, color::bright_blue}
inlineconstexpr

◆ bg_bright_cyan

constexpr style microfmt::ansi::bg_bright_cyan {color::none, color::bright_cyan}
inlineconstexpr

◆ bg_bright_green

constexpr style microfmt::ansi::bg_bright_green {color::none, color::bright_green}
inlineconstexpr

◆ bg_bright_magenta

constexpr style microfmt::ansi::bg_bright_magenta {color::none, color::bright_magenta}
inlineconstexpr

◆ bg_bright_red

constexpr style microfmt::ansi::bg_bright_red {color::none, color::bright_red}
inlineconstexpr

◆ bg_bright_white

constexpr style microfmt::ansi::bg_bright_white {color::none, color::bright_white}
inlineconstexpr

◆ bg_bright_yellow

constexpr style microfmt::ansi::bg_bright_yellow {color::none, color::bright_yellow}
inlineconstexpr

◆ bg_cyan

constexpr style microfmt::ansi::bg_cyan {color::none, color::cyan}
inlineconstexpr

◆ bg_gray

constexpr style microfmt::ansi::bg_gray {color::none, color::bright_black}
inlineconstexpr

◆ bg_green

constexpr style microfmt::ansi::bg_green {color::none, color::green}
inlineconstexpr

◆ bg_magenta

constexpr style microfmt::ansi::bg_magenta {color::none, color::magenta}
inlineconstexpr

◆ bg_red

constexpr style microfmt::ansi::bg_red {color::none, color::red}
inlineconstexpr

◆ bg_white

constexpr style microfmt::ansi::bg_white {color::none, color::white}
inlineconstexpr

◆ bg_yellow

constexpr style microfmt::ansi::bg_yellow {color::none, color::yellow}
inlineconstexpr

◆ blink

constexpr style microfmt::ansi::blink {color::none, color::none, attribute::blink}
inlineconstexpr

◆ bold

constexpr style microfmt::ansi::bold {color::none, color::none, attribute::bold}
inlineconstexpr

◆ dim

constexpr style microfmt::ansi::dim {color::none, color::none, attribute::dim}
inlineconstexpr

◆ error_style

constexpr style microfmt::ansi::error_style {color::bright_red, color::none, attribute::bold}
inlineconstexpr

◆ fg_black

constexpr style microfmt::ansi::fg_black {color::black}
inlineconstexpr

◆ fg_blue

constexpr style microfmt::ansi::fg_blue {color::blue}
inlineconstexpr

◆ fg_bright_black

constexpr style microfmt::ansi::fg_bright_black {color::bright_black}
inlineconstexpr

◆ fg_bright_blue

constexpr style microfmt::ansi::fg_bright_blue {color::bright_blue}
inlineconstexpr

◆ fg_bright_cyan

constexpr style microfmt::ansi::fg_bright_cyan {color::bright_cyan}
inlineconstexpr

◆ fg_bright_green

constexpr style microfmt::ansi::fg_bright_green {color::bright_green}
inlineconstexpr

◆ fg_bright_magenta

constexpr style microfmt::ansi::fg_bright_magenta {color::bright_magenta}
inlineconstexpr

◆ fg_bright_red

constexpr style microfmt::ansi::fg_bright_red {color::bright_red}
inlineconstexpr

◆ fg_bright_white

constexpr style microfmt::ansi::fg_bright_white {color::bright_white}
inlineconstexpr

◆ fg_bright_yellow

constexpr style microfmt::ansi::fg_bright_yellow {color::bright_yellow}
inlineconstexpr

◆ fg_cyan

constexpr style microfmt::ansi::fg_cyan {color::cyan}
inlineconstexpr

◆ fg_gray

constexpr style microfmt::ansi::fg_gray {color::bright_black}
inlineconstexpr

◆ fg_green

constexpr style microfmt::ansi::fg_green {color::green}
inlineconstexpr

◆ fg_magenta

constexpr style microfmt::ansi::fg_magenta {color::magenta}
inlineconstexpr

◆ fg_red

constexpr style microfmt::ansi::fg_red {color::red}
inlineconstexpr

◆ fg_white

constexpr style microfmt::ansi::fg_white {color::white}
inlineconstexpr

◆ fg_yellow

constexpr style microfmt::ansi::fg_yellow {color::yellow}
inlineconstexpr

◆ info_style

constexpr style microfmt::ansi::info_style {color::bright_cyan, color::none, attribute::none}
inlineconstexpr

◆ italic

constexpr style microfmt::ansi::italic {color::none, color::none, attribute::italic}
inlineconstexpr

◆ ok_style

constexpr style microfmt::ansi::ok_style {color::bright_green, color::none, attribute::bold}
inlineconstexpr

◆ reset

constexpr style microfmt::ansi::reset {}
inlineconstexpr

◆ reverse

constexpr style microfmt::ansi::reverse {color::none, color::none, attribute::reverse}
inlineconstexpr

◆ underline

constexpr style microfmt::ansi::underline {color::none, color::none, attribute::underline}
inlineconstexpr

◆ warn_style

constexpr style microfmt::ansi::warn_style {color::bright_yellow, color::none, attribute::bold}
inlineconstexpr