Guitar
Classes | Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
strformat_ns::string_formatter Class Reference

#include <strformat.h>

Collaboration diagram for strformat_ns::string_formatter:
Collaboration graph
[legend]

Classes

struct  Part
 
struct  PartList
 
struct  Private
 

Public Types

enum  Flags { Locale = 0x0001 }
 

Public Member Functions

 string_formatter (string_formatter const &)=delete
 
void operator= (string_formatter const &)=delete
 
 string_formatter (string_formatter &&r)
 
void operator= (string_formatter &&r)
 
 string_formatter (int flags=0, std::string const &text={})
 
 string_formatter (std::string const &text)
 
 ~string_formatter ()
 
char decimal_point () const
 
string_formatterreset (int flags, std::string const &text)
 
string_formatterappend (std::string const &s)
 
string_formatterappend (char const *s)
 
template<typename T >
string_formatterarg (T const &value, int width=-1, int precision=-1)
 
string_formatterf (double value, int width=-1, int precision=-1)
 
string_formatterc (char value, int width=-1, int precision=-1)
 
string_formatterd (int32_t value, int width=-1, int precision=-1)
 
string_formatterld (int64_t value, int width=-1, int precision=-1)
 
string_formatteru (uint32_t value, int width=-1, int precision=-1)
 
string_formatterlu (uint64_t value, int width=-1, int precision=-1)
 
string_formattero (int32_t value, int width=-1, int precision=-1)
 
string_formatterlo (int64_t value, int width=-1, int precision=-1)
 
string_formatterx (int32_t value, int width=-1, int precision=-1)
 
string_formatterlx (int64_t value, int width=-1, int precision=-1)
 
string_formatters (char const *value, int width=-1, int precision=-1)
 
string_formatters (std::string_view const &value, int width=-1, int precision=-1)
 
string_formatterp (void *value, int width=-1, int precision=-1)
 
template<typename T >
string_formatteroperator() (T const &value, int width=-1, int precision=-1)
 
void render (std::function< void(char const *ptr, int len)> const &to)
 
void vec (std::vector< char > *vec)
 
void write_to (FILE *fp)
 
void write_to (int fd)
 
void put ()
 
void err ()
 
std::string str ()
 
 operator std::string ()
 

Private Member Functions

Partformat_double (double val, int precision, bool trim_zeros, bool plus)
 
void _init ()
 
void clear ()
 
bool advance (bool complete)
 
Partformat_f (double value, bool trim_zeros)
 
Partformat_c (char c)
 
Partformat_o32 (uint32_t value, int hint)
 
Partformat_o64 (uint64_t value, int hint)
 
Partformat_x32 (uint32_t value, int hint)
 
Partformat_x64 (uint64_t value, int hint)
 
Partformat (char c, int hint)
 
Partformat (double value, int hint)
 
Partformat (int32_t value, int hint)
 
Partformat (uint32_t value, int hint)
 
Partformat (int64_t value, int hint)
 
Partformat (uint64_t value, int hint)
 
Partformat (char const *value, int hint)
 
Partformat (std::string_view const &value, int hint)
 
Partformat (std::vector< char > const &value, int hint)
 
Partformat_p (void *val)
 
void reset_format_params ()
 
void format (std::function< Part *(int)> const &callback, int width, int precision)
 
int length ()
 
void use_locale (bool use)
 
void set_flags (int flags)
 

Static Private Member Functions

static Partalloc_part (const char *data, int size)
 
static Partalloc_part (const char *begin, const char *end)
 
static Partalloc_part (const char *str)
 
static Partalloc_part (const std::string_view &str)
 
static void free_part (Part **p)
 
static void add_part (PartList *list, Part *part)
 
static void free_list (PartList *list)
 
static void add_chars (PartList *list, char c, int n)
 
static char const * digits_lower ()
 
static char const * digits_upper ()
 
static Partformat_int32 (int32_t val, bool force_sign)
 
static Partformat_uint32 (uint32_t val)
 
static Partformat_int64 (int64_t val, bool force_sign)
 
static Partformat_uint64 (uint64_t val)
 
static Partformat_oct32 (uint32_t val)
 
static Partformat_oct64 (uint64_t val)
 
static Partformat_hex32 (uint32_t val, bool upper)
 
static Partformat_hex64 (uint64_t val, bool upper)
 
static Partformat_pointer (void *val)
 

Private Attributes

struct strformat_ns::string_formatter::Private q
 

Member Enumeration Documentation

◆ Flags

Enumerator
Locale 

Constructor & Destructor Documentation

◆ string_formatter() [1/4]

strformat_ns::string_formatter::string_formatter ( string_formatter const &  )
delete

◆ string_formatter() [2/4]

strformat_ns::string_formatter::string_formatter ( string_formatter &&  r)
inline

◆ string_formatter() [3/4]

strformat_ns::string_formatter::string_formatter ( int  flags = 0,
std::string const &  text = {} 
)
inline

◆ string_formatter() [4/4]

strformat_ns::string_formatter::string_formatter ( std::string const &  text)
inline
Here is the call graph for this function:

◆ ~string_formatter()

strformat_ns::string_formatter::~string_formatter ( )
inline
Here is the call graph for this function:

Member Function Documentation

◆ _init()

void strformat_ns::string_formatter::_init ( )
inlineprivate

◆ add_chars()

static void strformat_ns::string_formatter::add_chars ( PartList list,
char  c,
int  n 
)
inlinestaticprivate
Here is the call graph for this function:

◆ add_part()

static void strformat_ns::string_formatter::add_part ( PartList list,
Part part 
)
inlinestaticprivate

◆ advance()

bool strformat_ns::string_formatter::advance ( bool  complete)
inlineprivate
Here is the call graph for this function:

◆ alloc_part() [1/4]

static Part* strformat_ns::string_formatter::alloc_part ( const char *  begin,
const char *  end 
)
inlinestaticprivate
Here is the call graph for this function:

◆ alloc_part() [2/4]

static Part* strformat_ns::string_formatter::alloc_part ( const char *  data,
int  size 
)
inlinestaticprivate
Here is the call graph for this function:

◆ alloc_part() [3/4]

static Part* strformat_ns::string_formatter::alloc_part ( const char *  str)
inlinestaticprivate
Here is the call graph for this function:

◆ alloc_part() [4/4]

static Part* strformat_ns::string_formatter::alloc_part ( const std::string_view &  str)
inlinestaticprivate
Here is the call graph for this function:

◆ append() [1/2]

string_formatter& strformat_ns::string_formatter::append ( char const *  s)
inline
Here is the call graph for this function:

◆ append() [2/2]

string_formatter& strformat_ns::string_formatter::append ( std::string const &  s)
inline
Here is the call graph for this function:

◆ arg()

template<typename T >
string_formatter& strformat_ns::string_formatter::arg ( T const &  value,
int  width = -1,
int  precision = -1 
)
inline
Here is the call graph for this function:

◆ c()

string_formatter& strformat_ns::string_formatter::c ( char  value,
int  width = -1,
int  precision = -1 
)
inline
Here is the call graph for this function:

◆ clear()

void strformat_ns::string_formatter::clear ( )
inlineprivate
Here is the call graph for this function:

◆ d()

string_formatter& strformat_ns::string_formatter::d ( int32_t  value,
int  width = -1,
int  precision = -1 
)
inline
Here is the call graph for this function:

◆ decimal_point()

char strformat_ns::string_formatter::decimal_point ( ) const
inline

◆ digits_lower()

static char const* strformat_ns::string_formatter::digits_lower ( )
inlinestaticprivate

◆ digits_upper()

static char const* strformat_ns::string_formatter::digits_upper ( )
inlinestaticprivate

◆ err()

void strformat_ns::string_formatter::err ( )
inline
Here is the call graph for this function:

◆ f()

string_formatter& strformat_ns::string_formatter::f ( double  value,
int  width = -1,
int  precision = -1 
)
inline
Here is the call graph for this function:

◆ format() [1/10]

Part* strformat_ns::string_formatter::format ( char  c,
int  hint 
)
inlineprivate
Here is the call graph for this function:

◆ format() [2/10]

Part* strformat_ns::string_formatter::format ( char const *  value,
int  hint 
)
inlineprivate
Here is the call graph for this function:

◆ format() [3/10]

Part* strformat_ns::string_formatter::format ( double  value,
int  hint 
)
inlineprivate
Here is the call graph for this function:

◆ format() [4/10]

Part* strformat_ns::string_formatter::format ( int32_t  value,
int  hint 
)
inlineprivate
Here is the call graph for this function:

◆ format() [5/10]

Part* strformat_ns::string_formatter::format ( int64_t  value,
int  hint 
)
inlineprivate
Here is the call graph for this function:

◆ format() [6/10]

void strformat_ns::string_formatter::format ( std::function< Part *(int)> const &  callback,
int  width,
int  precision 
)
inlineprivate
Here is the call graph for this function:

◆ format() [7/10]

Part* strformat_ns::string_formatter::format ( std::string_view const &  value,
int  hint 
)
inlineprivate
Here is the call graph for this function:

◆ format() [8/10]

Part* strformat_ns::string_formatter::format ( std::vector< char > const &  value,
int  hint 
)
inlineprivate
Here is the call graph for this function:

◆ format() [9/10]

Part* strformat_ns::string_formatter::format ( uint32_t  value,
int  hint 
)
inlineprivate
Here is the call graph for this function:

◆ format() [10/10]

Part* strformat_ns::string_formatter::format ( uint64_t  value,
int  hint 
)
inlineprivate
Here is the call graph for this function:

◆ format_c()

Part* strformat_ns::string_formatter::format_c ( char  c)
inlineprivate
Here is the call graph for this function:

◆ format_double()

Part* strformat_ns::string_formatter::format_double ( double  val,
int  precision,
bool  trim_zeros,
bool  plus 
)
inlineprivate
Here is the call graph for this function:

◆ format_f()

Part* strformat_ns::string_formatter::format_f ( double  value,
bool  trim_zeros 
)
inlineprivate
Here is the call graph for this function:

◆ format_hex32()

static Part* strformat_ns::string_formatter::format_hex32 ( uint32_t  val,
bool  upper 
)
inlinestaticprivate
Here is the call graph for this function:

◆ format_hex64()

static Part* strformat_ns::string_formatter::format_hex64 ( uint64_t  val,
bool  upper 
)
inlinestaticprivate
Here is the call graph for this function:

◆ format_int32()

static Part* strformat_ns::string_formatter::format_int32 ( int32_t  val,
bool  force_sign 
)
inlinestaticprivate
Here is the call graph for this function:

◆ format_int64()

static Part* strformat_ns::string_formatter::format_int64 ( int64_t  val,
bool  force_sign 
)
inlinestaticprivate
Here is the call graph for this function:

◆ format_o32()

Part* strformat_ns::string_formatter::format_o32 ( uint32_t  value,
int  hint 
)
inlineprivate
Here is the call graph for this function:

◆ format_o64()

Part* strformat_ns::string_formatter::format_o64 ( uint64_t  value,
int  hint 
)
inlineprivate
Here is the call graph for this function:

◆ format_oct32()

static Part* strformat_ns::string_formatter::format_oct32 ( uint32_t  val)
inlinestaticprivate
Here is the call graph for this function:

◆ format_oct64()

static Part* strformat_ns::string_formatter::format_oct64 ( uint64_t  val)
inlinestaticprivate
Here is the call graph for this function:

◆ format_p()

Part* strformat_ns::string_formatter::format_p ( void *  val)
inlineprivate
Here is the call graph for this function:

◆ format_pointer()

static Part* strformat_ns::string_formatter::format_pointer ( void *  val)
inlinestaticprivate
Here is the call graph for this function:

◆ format_uint32()

static Part* strformat_ns::string_formatter::format_uint32 ( uint32_t  val)
inlinestaticprivate
Here is the call graph for this function:

◆ format_uint64()

static Part* strformat_ns::string_formatter::format_uint64 ( uint64_t  val)
inlinestaticprivate
Here is the call graph for this function:

◆ format_x32()

Part* strformat_ns::string_formatter::format_x32 ( uint32_t  value,
int  hint 
)
inlineprivate
Here is the call graph for this function:

◆ format_x64()

Part* strformat_ns::string_formatter::format_x64 ( uint64_t  value,
int  hint 
)
inlineprivate
Here is the call graph for this function:

◆ free_list()

static void strformat_ns::string_formatter::free_list ( PartList list)
inlinestaticprivate
Here is the call graph for this function:

◆ free_part()

static void strformat_ns::string_formatter::free_part ( Part **  p)
inlinestaticprivate
Here is the call graph for this function:

◆ ld()

string_formatter& strformat_ns::string_formatter::ld ( int64_t  value,
int  width = -1,
int  precision = -1 
)
inline
Here is the call graph for this function:

◆ length()

int strformat_ns::string_formatter::length ( )
inlineprivate
Here is the call graph for this function:

◆ lo()

string_formatter& strformat_ns::string_formatter::lo ( int64_t  value,
int  width = -1,
int  precision = -1 
)
inline
Here is the call graph for this function:

◆ lu()

string_formatter& strformat_ns::string_formatter::lu ( uint64_t  value,
int  width = -1,
int  precision = -1 
)
inline
Here is the call graph for this function:

◆ lx()

string_formatter& strformat_ns::string_formatter::lx ( int64_t  value,
int  width = -1,
int  precision = -1 
)
inline
Here is the call graph for this function:

◆ o()

string_formatter& strformat_ns::string_formatter::o ( int32_t  value,
int  width = -1,
int  precision = -1 
)
inline
Here is the call graph for this function:

◆ operator std::string()

strformat_ns::string_formatter::operator std::string ( )
inline
Here is the call graph for this function:

◆ operator()()

template<typename T >
string_formatter& strformat_ns::string_formatter::operator() ( T const &  value,
int  width = -1,
int  precision = -1 
)
inline
Here is the call graph for this function:

◆ operator=() [1/2]

void strformat_ns::string_formatter::operator= ( string_formatter &&  r)
inline
Here is the call graph for this function:

◆ operator=() [2/2]

void strformat_ns::string_formatter::operator= ( string_formatter const &  )
delete

◆ p()

string_formatter& strformat_ns::string_formatter::p ( void *  value,
int  width = -1,
int  precision = -1 
)
inline
Here is the call graph for this function:

◆ put()

void strformat_ns::string_formatter::put ( )
inline
Here is the call graph for this function:

◆ render()

void strformat_ns::string_formatter::render ( std::function< void(char const *ptr, int len)> const &  to)
inline
Here is the call graph for this function:

◆ reset()

string_formatter& strformat_ns::string_formatter::reset ( int  flags,
std::string const &  text 
)
inline
Here is the call graph for this function:

◆ reset_format_params()

void strformat_ns::string_formatter::reset_format_params ( )
inlineprivate

◆ s() [1/2]

string_formatter& strformat_ns::string_formatter::s ( char const *  value,
int  width = -1,
int  precision = -1 
)
inline
Here is the call graph for this function:

◆ s() [2/2]

string_formatter& strformat_ns::string_formatter::s ( std::string_view const &  value,
int  width = -1,
int  precision = -1 
)
inline
Here is the call graph for this function:

◆ set_flags()

void strformat_ns::string_formatter::set_flags ( int  flags)
inlineprivate
Here is the call graph for this function:

◆ str()

std::string strformat_ns::string_formatter::str ( )
inline
Here is the call graph for this function:

◆ u()

string_formatter& strformat_ns::string_formatter::u ( uint32_t  value,
int  width = -1,
int  precision = -1 
)
inline
Here is the call graph for this function:

◆ use_locale()

void strformat_ns::string_formatter::use_locale ( bool  use)
inlineprivate

◆ vec()

void strformat_ns::string_formatter::vec ( std::vector< char > *  vec)
inline
Here is the call graph for this function:

◆ write_to() [1/2]

void strformat_ns::string_formatter::write_to ( FILE *  fp)
inline
Here is the call graph for this function:

◆ write_to() [2/2]

void strformat_ns::string_formatter::write_to ( int  fd)
inline
Here is the call graph for this function:

◆ x()

string_formatter& strformat_ns::string_formatter::x ( int32_t  value,
int  width = -1,
int  precision = -1 
)
inline
Here is the call graph for this function:

Member Data Documentation

◆ q

struct strformat_ns::string_formatter::Private strformat_ns::string_formatter::q
private

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