TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
fmt::internal::ArgFormatterBase< Impl, Char > Class Template Reference

#include <format.h>

Public Member Functions

 ArgFormatterBase (BasicWriter< Char > &w, FormatSpec &s)
 
template<typename T >
void visit_any_int (T value)
 
template<typename T >
void visit_any_double (T value)
 
void visit_bool (bool value)
 
void visit_char (int value)
 
void visit_cstring (const char *value)
 
void visit_string (Arg::StringValue< char > value)
 
void visit_wstring (Arg::StringValue< Char > value)
 
void visit_pointer (const void *value)
 
- Public Member Functions inherited from fmt::internal::ArgVisitor< Impl, void >
void report_unhandled_arg ()
 
void visit_unhandled_arg ()
 
void visit_int (int value)
 
void visit_long_long (LongLong value)
 
void visit_uint (unsigned value)
 
void visit_ulong_long (ULongLong value)
 
void visit_bool (bool value)
 
void visit_char (int value)
 
void visit_any_int (T)
 
void visit_double (double value)
 
void visit_long_double (long double value)
 
void visit_any_double (T)
 
void visit_cstring (const char *)
 
void visit_string (Arg::StringValue< char >)
 
void visit_wstring (Arg::StringValue< wchar_t >)
 
void visit_pointer (const void *)
 
void visit_custom (Arg::CustomValue)
 
void visit (const Arg &arg)
 

Protected Member Functions

BasicWriter< Char > & writer ()
 
FormatSpecspec ()
 
void write (bool value)
 
void write (const char *value)
 

Private Member Functions

 FMT_DISALLOW_COPY_AND_ASSIGN (ArgFormatterBase)
 
void write_pointer (const void *p)
 

Private Attributes

BasicWriter< Char > & writer_
 
FormatSpecspec_
 

Constructor & Destructor Documentation

template<typename Impl, typename Char>
fmt::internal::ArgFormatterBase< Impl, Char >::ArgFormatterBase ( BasicWriter< Char > &  w,
FormatSpec s 
)
inline
1735  : writer_(w), spec_(s) {}
BasicWriter< Char > & writer_
Definition: format.h:1707
FormatSpec & spec_
Definition: format.h:1708

Member Function Documentation

template<typename Impl, typename Char>
fmt::internal::ArgFormatterBase< Impl, Char >::FMT_DISALLOW_COPY_AND_ASSIGN ( ArgFormatterBase< Impl, Char )
private
template<typename Impl, typename Char>
FormatSpec& fmt::internal::ArgFormatterBase< Impl, Char >::spec ( )
inlineprotected
1720 { return spec_; }
FormatSpec & spec_
Definition: format.h:1708
template<typename Impl, typename Char>
template<typename T >
void fmt::internal::ArgFormatterBase< Impl, Char >::visit_any_double ( value)
inline
1741 { writer_.write_double(value, spec_); }
BasicWriter< Char > & writer_
Definition: format.h:1707
FormatSpec & spec_
Definition: format.h:1708
const FieldDescriptor value
Definition: descriptor.h:1522
template<typename Impl, typename Char>
template<typename T >
void fmt::internal::ArgFormatterBase< Impl, Char >::visit_any_int ( value)
inline
1738 { writer_.write_int(value, spec_); }
BasicWriter< Char > & writer_
Definition: format.h:1707
FormatSpec & spec_
Definition: format.h:1708
const FieldDescriptor value
Definition: descriptor.h:1522
template<typename Impl, typename Char>
void fmt::internal::ArgFormatterBase< Impl, Char >::visit_bool ( bool  value)
inline
1743  {
1744  if (spec_.type_)
1745  return visit_any_int(value);
1746  write(value);
1747  }
void write(bool value)
Definition: format.h:1722
void visit_any_int(T value)
Definition: format.h:1738
FormatSpec & spec_
Definition: format.h:1708
const FieldDescriptor value
Definition: descriptor.h:1522
char type_
Definition: format.h:1521
template<typename Impl, typename Char>
void fmt::internal::ArgFormatterBase< Impl, Char >::visit_char ( int  value)
inline
1749  {
1750  if (spec_.type_ && spec_.type_ != 'c') {
1751  spec_.flags_ |= CHAR_FLAG;
1752  writer_.write_int(value, spec_);
1753  return;
1754  }
1755  if (spec_.align_ == ALIGN_NUMERIC || spec_.flags_ != 0)
1756  FMT_THROW(FormatError("invalid format specifier for char"));
1757  typedef typename BasicWriter<Char>::CharPtr CharPtr;
1758  Char fill = internal::CharTraits<Char>::cast(spec_.fill());
1759  CharPtr out = CharPtr();
1760  const unsigned CHAR_WIDTH = 1;
1761  if (spec_.width_ > CHAR_WIDTH) {
1762  out = writer_.grow_buffer(spec_.width_);
1763  if (spec_.align_ == ALIGN_RIGHT) {
1764  std::uninitialized_fill_n(out, spec_.width_ - CHAR_WIDTH, fill);
1765  out += spec_.width_ - CHAR_WIDTH;
1766  } else if (spec_.align_ == ALIGN_CENTER) {
1767  out = writer_.fill_padding(out, spec_.width_,
1768  internal::check(CHAR_WIDTH), fill);
1769  } else {
1770  std::uninitialized_fill_n(out + CHAR_WIDTH,
1771  spec_.width_ - CHAR_WIDTH, fill);
1772  }
1773  } else {
1774  out = writer_.grow_buffer(CHAR_WIDTH);
1775  }
1776  *out = internal::CharTraits<Char>::cast(value);
1777  }
Alignment align_
Definition: format.h:1498
Definition: format.h:1460
BasicWriter< Char > & writer_
Definition: format.h:1707
unsigned width_
Definition: format.h:1485
Definition: format.h:1460
wchar_t fill() const
Definition: format.h:1493
char Char
Definition: bzlib_private.h:41
FormatSpec & spec_
Definition: format.h:1708
unsigned flags_
Definition: format.h:1519
Definition: format.h:1466
const FieldDescriptor value
Definition: descriptor.h:1522
T check(T value)
Definition: format.h:305
Definition: format.h:1460
#define FMT_THROW(x)
Definition: format.h:166
char type_
Definition: format.h:1521
template<typename Impl, typename Char>
void fmt::internal::ArgFormatterBase< Impl, Char >::visit_cstring ( const char *  value)
inline
1779  {
1780  if (spec_.type_ == 'p')
1781  return write_pointer(value);
1782  write(value);
1783  }
void write(bool value)
Definition: format.h:1722
FormatSpec & spec_
Definition: format.h:1708
const FieldDescriptor value
Definition: descriptor.h:1522
void write_pointer(const void *p)
Definition: format.h:1712
char type_
Definition: format.h:1521
template<typename Impl, typename Char>
void fmt::internal::ArgFormatterBase< Impl, Char >::visit_pointer ( const void *  value)
inline
1795  {
1796  if (spec_.type_ && spec_.type_ != 'p')
1797  report_unknown_type(spec_.type_, "pointer");
1799  }
FMT_API void report_unknown_type(char code, const char *type)
FormatSpec & spec_
Definition: format.h:1708
const FieldDescriptor value
Definition: descriptor.h:1522
void write_pointer(const void *p)
Definition: format.h:1712
char type_
Definition: format.h:1521
template<typename Impl, typename Char>
void fmt::internal::ArgFormatterBase< Impl, Char >::visit_string ( Arg::StringValue< char >  value)
inline
1785  {
1786  writer_.write_str(value, spec_);
1787  }
BasicWriter< Char > & writer_
Definition: format.h:1707
FormatSpec & spec_
Definition: format.h:1708
const FieldDescriptor value
Definition: descriptor.h:1522
template<typename Impl, typename Char>
void fmt::internal::ArgFormatterBase< Impl, Char >::visit_wstring ( Arg::StringValue< Char value)
inline
1791  {
1792  writer_.write_str(value, spec_);
1793  }
BasicWriter< Char > & writer_
Definition: format.h:1707
FormatSpec & spec_
Definition: format.h:1708
const FieldDescriptor value
Definition: descriptor.h:1522
template<typename Impl, typename Char>
void fmt::internal::ArgFormatterBase< Impl, Char >::write ( bool  value)
inlineprotected
1722  {
1723  const char *str_value = value ? "true" : "false";
1724  Arg::StringValue<char> str = { str_value, std::strlen(str_value) };
1725  writer_.write_str(str, spec_);
1726  }
BasicWriter< Char > & writer_
Definition: format.h:1707
FormatSpec & spec_
Definition: format.h:1708
const FieldDescriptor value
Definition: descriptor.h:1522
template<typename Impl, typename Char>
void fmt::internal::ArgFormatterBase< Impl, Char >::write ( const char *  value)
inlineprotected
1728  {
1729  Arg::StringValue<char> str = {value, value != 0 ? std::strlen(value) : 0};
1730  writer_.write_str(str, spec_);
1731  }
BasicWriter< Char > & writer_
Definition: format.h:1707
FormatSpec & spec_
Definition: format.h:1708
const FieldDescriptor value
Definition: descriptor.h:1522
template<typename Impl, typename Char>
void fmt::internal::ArgFormatterBase< Impl, Char >::write_pointer ( const void *  p)
inlineprivate
1712  {
1714  spec_.type_ = 'x';
1715  writer_.write_int(reinterpret_cast<uintptr_t>(p), spec_);
1716  }
BasicWriter< Char > & writer_
Definition: format.h:1707
Definition: format.h:1465
FormatSpec & spec_
Definition: format.h:1708
unsigned flags_
Definition: format.h:1519
char type_
Definition: format.h:1521
template<typename Impl, typename Char>
BasicWriter<Char>& fmt::internal::ArgFormatterBase< Impl, Char >::writer ( )
inlineprotected
1719 { return writer_; }
BasicWriter< Char > & writer_
Definition: format.h:1707

Member Data Documentation

template<typename Impl, typename Char>
FormatSpec& fmt::internal::ArgFormatterBase< Impl, Char >::spec_
private
template<typename Impl, typename Char>
BasicWriter<Char>& fmt::internal::ArgFormatterBase< Impl, Char >::writer_
private

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