TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
fmt Namespace Reference

Namespaces

 internal
 

Classes

struct  AlignSpec
 
struct  AlignTypeSpec
 
class  ArgList
 
class  BasicArrayWriter
 
class  BasicCStringRef
 
class  BasicFormatter
 
class  BasicMemoryWriter
 
class  BasicStringRef
 
class  BasicWriter
 
class  Buffer
 
class  BufferedFile
 
struct  EmptySpec
 
class  ErrorCode
 
class  File
 
class  FormatError
 
class  FormatInt
 
struct  FormatSpec
 
class  IntFormatSpec
 
class  StrFormatSpec
 
class  SystemError
 
struct  TypeSpec
 
struct  WidthSpec
 

Typedefs

typedef BasicWriter< char > Writer
 
typedef BasicWriter< wchar_t > WWriter
 
typedef BasicStringRef< char > StringRef
 
typedef BasicStringRef< wchar_t > WStringRef
 
typedef BasicCStringRef< char > CStringRef
 
typedef BasicCStringRef< wchar_t > WCStringRef
 
typedef BasicMemoryWriter< char > MemoryWriter
 
typedef BasicMemoryWriter
< wchar_t > 
WMemoryWriter
 
typedef BasicArrayWriter< char > ArrayWriter
 
typedef BasicArrayWriter< wchar_t > WArrayWriter
 

Enumerations

enum  Alignment {
  ALIGN_DEFAULT, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER,
  ALIGN_NUMERIC
}
 
enum  {
  SIGN_FLAG = 1, PLUS_FLAG = 2, MINUS_FLAG = 4, HASH_FLAG = 8,
  CHAR_FLAG = 0x10
}
 
enum  Color {
  BLACK, RED, GREEN, YELLOW,
  BLUE, MAGENTA, CYAN, WHITE
}
 

Functions

template<typename Char , typename T >
void format (BasicFormatter< Char > &f, const Char *&format_str, const T &value)
 
IntFormatSpec< int, TypeSpec<'b'> > bin (int value)
 
IntFormatSpec< int, TypeSpec<'o'> > oct (int value)
 
IntFormatSpec< int, TypeSpec<'x'> > hex (int value)
 
IntFormatSpec< int, TypeSpec<'X'> > hexu (int value)
 
template<char TYPE_CODE, typename Char >
IntFormatSpec< int,
AlignTypeSpec< TYPE_CODE >
, Char
pad (int value, unsigned width, Char fill= ' ')
 
template<typename Char >
StrFormatSpec< Charpad (const Char *str, unsigned width, Char fill= ' ')
 
StrFormatSpec< wchar_t > pad (const wchar_t *str, unsigned width, char fill= ' ')
 
FMT_API void report_system_error (int error_code, StringRef message) FMT_NOEXCEPT
 
FMT_API void print_colored (Color c, CStringRef format, ArgList args)
 
std::string format (CStringRef format_str, ArgList args)
 
std::wstring format (WCStringRef format_str, ArgList args)
 
FMT_API void print (std::FILE *f, CStringRef format_str, ArgList args)
 
FMT_API void print (CStringRef format_str, ArgList args)
 
template<typename Char >
void printf (BasicWriter< Char > &w, BasicCStringRef< Char > format, ArgList args)
 
std::string sprintf (CStringRef format, ArgList args)
 
std::wstring sprintf (WCStringRef format, ArgList args)
 
FMT_API int fprintf (std::FILE *f, CStringRef format, ArgList args)
 
int printf (CStringRef format, ArgList args)
 
template<typename T >
void format_decimal (char *&buffer, T value)
 
template<typename T >
internal::NamedArg< char > arg (StringRef name, const T &arg)
 
template<typename T >
internal::NamedArg< wchar_t > arg (WStringRef name, const T &arg)
 
template<typename Char >
void arg (StringRef, const internal::NamedArg< Char > &) FMT_DELETED_OR_UNDEFINED
 
template<typename Char >
void arg (WStringRef, const internal::NamedArg< Char > &) FMT_DELETED_OR_UNDEFINED
 
FMT_API void print (std::ostream &os, CStringRef format_str, ArgList args)
 
FMT_API int fprintf (std::ostream &os, CStringRef format_str, ArgList args)
 
long getpagesize ()
 

Variables

FMT_GCC_EXTENSION typedef long long LongLong
 
FMT_GCC_EXTENSION typedef
unsigned long long 
ULongLong
 

Typedef Documentation

typedef BasicWriter<char> fmt::Writer
typedef BasicStringRef<wchar_t> fmt::WStringRef
typedef BasicWriter<wchar_t> fmt::WWriter

Enumeration Type Documentation

anonymous enum
Enumerator
SIGN_FLAG 
PLUS_FLAG 
MINUS_FLAG 
HASH_FLAG 
CHAR_FLAG 
1464  {
1465  SIGN_FLAG = 1, PLUS_FLAG = 2, MINUS_FLAG = 4, HASH_FLAG = 8,
1466  CHAR_FLAG = 0x10 // Argument has char type - used in error reporting.
1467 };
Definition: format.h:1465
Definition: format.h:1465
Definition: format.h:1465
Definition: format.h:1466
Definition: format.h:1465
Enumerator
ALIGN_DEFAULT 
ALIGN_LEFT 
ALIGN_RIGHT 
ALIGN_CENTER 
ALIGN_NUMERIC 
1459  {
1461 };
Definition: format.h:1460
Definition: format.h:1460
Definition: format.h:1460
Definition: format.h:1460
Definition: format.h:1460
enum fmt::Color
Enumerator
BLACK 
RED 
GREEN 
YELLOW 
BLUE 
MAGENTA 
CYAN 
WHITE 
3029 { BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE };
Definition: AppenderConsole.h:28
Definition: AppenderConsole.h:30
Definition: AppenderConsole.h:27
Definition: AppenderConsole.h:32
Definition: AppenderConsole.h:34
Definition: AppenderConsole.h:26
Definition: AppenderConsole.h:31
Definition: AppenderConsole.h:40

Function Documentation

template<typename T >
internal::NamedArg<char> fmt::arg ( StringRef  name,
const T &  arg 
)
inline

Returns a named argument for formatting functions.

Example**::

print("Elapsed time: {s:.2f} seconds", arg("s", 1.23));

3248  {
3249  return internal::NamedArg<char>(name, arg);
3250 }
void arg(WStringRef, const internal::NamedArg< Char > &) FMT_DELETED_OR_UNDEFINED

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T >
internal::NamedArg<wchar_t> fmt::arg ( WStringRef  name,
const T &  arg 
)
inline
3253  {
3254  return internal::NamedArg<wchar_t>(name, arg);
3255 }
void arg(WStringRef, const internal::NamedArg< Char > &) FMT_DELETED_OR_UNDEFINED

+ Here is the call graph for this function:

template<typename Char >
void fmt::arg ( StringRef  ,
const internal::NamedArg< Char > &   
)
template<typename Char >
void fmt::arg ( WStringRef  ,
const internal::NamedArg< Char > &   
)

+ Here is the caller graph for this function:

IntFormatSpec<int, TypeSpec<'b'> > fmt::bin ( int  value)

Returns an integer format specifier to format the value in base 2.

template<typename Char , typename T >
void fmt::format ( BasicFormatter< Char > &  f,
const Char *&  format_str,
const T &  value 
)
2963  {
2964  internal::MemoryBuffer<Char, internal::INLINE_BUFFER_SIZE> buffer;
2965 
2966  internal::FormatBuf<Char> format_buf(buffer);
2967  std::basic_ostream<Char> output(&format_buf);
2968  output << value;
2969 
2970  BasicStringRef<Char> str(&buffer[0], format_buf.size());
2971  typedef internal::MakeArg< BasicFormatter<Char> > MakeArg;
2972  format_str = f.format(format_str, MakeArg(str));
2973 }
void format(BasicCStringRef< Char > format_str)
Definition: format.h:3689
#define output
Definition: wire_format_lite.h:381
const FieldDescriptor value
Definition: descriptor.h:1522
Definition: format.h:1244

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string fmt::format ( CStringRef  format_str,
ArgList  args 
)
inline

Formats arguments and returns the result as a string.

Example**::

std::string message = format("The answer is {}", 42);

3048  {
3049  MemoryWriter w;
3050  w.write(format_str, args);
3051  return w.str();
3052 }
BasicMemoryWriter< char > MemoryWriter
Definition: format.h:2909

+ Here is the call graph for this function:

std::wstring fmt::format ( WCStringRef  format_str,
ArgList  args 
)
inline
3054  {
3055  WMemoryWriter w;
3056  w.write(format_str, args);
3057  return w.str();
3058 }
BasicMemoryWriter< wchar_t > WMemoryWriter
Definition: format.h:2910

+ Here is the call graph for this function:

template<typename T >
void fmt::format_decimal ( char *&  buffer,
value 
)
inline
3215  {
3216  typedef typename internal::IntTraits<T>::MainType MainType;
3217  MainType abs_value = static_cast<MainType>(value);
3219  *buffer++ = '-';
3220  abs_value = 0 - abs_value;
3221  }
3222  if (abs_value < 100) {
3223  if (abs_value < 10) {
3224  *buffer++ = static_cast<char>('0' + abs_value);
3225  return;
3226  }
3227  unsigned index = static_cast<unsigned>(abs_value * 2);
3228  *buffer++ = internal::Data::DIGITS[index];
3229  *buffer++ = internal::Data::DIGITS[index + 1];
3230  return;
3231  }
3232  unsigned num_digits = internal::count_digits(abs_value);
3233  internal::format_decimal(buffer, abs_value, num_digits);
3234  buffer += num_digits;
3235 }
bool is_negative(T value)
Definition: format.h:801
unsigned count_digits(uint64_t n)
Definition: format.h:844
const FieldDescriptor value
Definition: descriptor.h:1522
void format_decimal(char *&buffer, T value)
Definition: format.h:3215

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

FMT_API int fmt::fprintf ( std::FILE *  f,
CStringRef  format,
ArgList  args 
)

Prints formatted data to the file f.

Example**::

fmt::fprintf(stderr, "Don't %s!", "panic");

+ Here is the caller graph for this function:

FMT_API int fmt::fprintf ( std::ostream &  os,
CStringRef  format_str,
ArgList  args 
)

Prints formatted data to the stream os.

Example**::

fprintf(cerr, "Don't %s!", "panic");

+ Here is the caller graph for this function:

long fmt::getpagesize ( )
IntFormatSpec<int, TypeSpec<'x'> > fmt::hex ( int  value)

Returns an integer format specifier to format the value in base 16 using lower-case letters for the digits above 9.

+ Here is the caller graph for this function:

IntFormatSpec<int, TypeSpec<'X'> > fmt::hexu ( int  value)

Returns an integer formatter format specifier to format in base 16 using upper-case letters for the digits above 9.

IntFormatSpec<int, TypeSpec<'o'> > fmt::oct ( int  value)

Returns an integer format specifier to format the value in base 8.

template<char TYPE_CODE, typename Char >
IntFormatSpec<int, AlignTypeSpec<TYPE_CODE>, Char> fmt::pad ( int  value,
unsigned  width,
Char  fill = ' ' 
)

Returns an integer format specifier to pad the formatted argument with the fill character to the specified width using the default (right) numeric alignment.

Example**::

MemoryWriter out; out << pad(hex(0xcafe), 8, '0'); out.str() == "0000cafe"

+ Here is the caller graph for this function:

template<typename Char >
StrFormatSpec<Char> fmt::pad ( const Char str,
unsigned  width,
Char  fill = ' ' 
)
inline

Returns a string formatter that pads the formatted argument with the fill character to the specified width using the default (left) string alignment.

Example**::

std::string s = str(MemoryWriter() << pad("abc", 8)); s == "abc "

1671  {
1672  return StrFormatSpec<Char>(str, width, fill);
1673 }
StrFormatSpec<wchar_t> fmt::pad ( const wchar_t *  str,
unsigned  width,
char  fill = ' ' 
)
inline
1676  {
1677  return StrFormatSpec<wchar_t>(str, width, fill);
1678 }
FMT_API void fmt::print ( std::FILE *  f,
CStringRef  format_str,
ArgList  args 
)

Prints formatted data to the file f.

Example**::

print(stderr, "Don't {}!", "panic");

+ Here is the caller graph for this function:

FMT_API void fmt::print ( CStringRef  format_str,
ArgList  args 
)

Prints formatted data to stdout.

Example**::

print("Elapsed time: {0:.2f} seconds", 1.23);

FMT_API void fmt::print ( std::ostream &  os,
CStringRef  format_str,
ArgList  args 
)

Prints formatted data to the stream os.

Example**::

print(cerr, "Don't {}!", "panic");

FMT_API void fmt::print_colored ( Color  c,
CStringRef  format,
ArgList  args 
)

Formats a string and prints it to stdout using ANSI escape sequences to specify color (experimental). Example: print_colored(fmt::RED, "Elapsed time: {0:.2f} seconds", 1.23);

template<typename Char >
void fmt::printf ( BasicWriter< Char > &  w,
BasicCStringRef< Char format,
ArgList  args 
)
3083  {
3084  internal::PrintfFormatter<Char>(args).format(w, format);
3085 }
std::string __cdecl format(const char *fmt...) G3D_CHECK_PRINTF_ARGS

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int fmt::printf ( CStringRef  format,
ArgList  args 
)
inline

Prints formatted data to stdout.

Example**::

fmt::printf("Elapsed time: %.2f seconds", 1.23);

3128  {
3129  return fprintf(stdout, format, args);
3130 }
FMT_API int fprintf(std::ostream &os, CStringRef format_str, ArgList args)
std::string __cdecl format(const char *fmt...) G3D_CHECK_PRINTF_ARGS

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

FMT_API void fmt::report_system_error ( int  error_code,
StringRef  message 
)
std::string fmt::sprintf ( CStringRef  format,
ArgList  args 
)
inline

Formats arguments and returns the result as a string.

Example**::

std::string message = fmt::sprintf("The answer is %d", 42);

3096  {
3097  MemoryWriter w;
3098  printf(w, format, args);
3099  return w.str();
3100 }
int printf(CStringRef format, ArgList args)
Definition: format.h:3128
BasicMemoryWriter< char > MemoryWriter
Definition: format.h:2909
std::string __cdecl format(const char *fmt...) G3D_CHECK_PRINTF_ARGS

+ Here is the call graph for this function:

std::wstring fmt::sprintf ( WCStringRef  format,
ArgList  args 
)
inline
3102  {
3103  WMemoryWriter w;
3104  printf(w, format, args);
3105  return w.str();
3106 }
int printf(CStringRef format, ArgList args)
Definition: format.h:3128
std::string __cdecl format(const char *fmt...) G3D_CHECK_PRINTF_ARGS
BasicMemoryWriter< wchar_t > WMemoryWriter
Definition: format.h:2910

+ Here is the call graph for this function:

Variable Documentation

FMT_GCC_EXTENSION typedef long long fmt::LongLong
FMT_GCC_EXTENSION typedef unsigned long long fmt::ULongLong