Pyrogenesis  trunk
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
fmt Namespace Reference

Namespaces

 internal
 

Classes

struct  AlignSpec
 
struct  AlignTypeSpec
 
class  ArgList
 An argument list. More...
 
class  BasicFormatter
 
class  BasicStringRef
 A string reference. More...
 
class  BasicWriter
 This template provides operations for formatting and writing data into a character stream. More...
 
struct  EmptySpec
 
class  FormatError
 A formatting error such as invalid format string. More...
 
class  FormatInt
 Fast integer formatter. More...
 
struct  FormatSpec
 
class  IntFormatSpec
 
class  StrFormatSpec
 
class  SystemError
 An error returned by an operating system or a language runtime, for example a file opening error. More...
 
struct  TypeSpec
 
struct  WidthSpec
 

Typedefs

typedef BasicWriter< char > Writer
 
typedef BasicWriter< wchar_tWWriter
 
typedef BasicStringRef< char > StringRef
 
typedef BasicStringRef< wchar_tWStringRef
 

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)
 Returns an integer format specifier to format the value in base 2. More...
 
IntFormatSpec< int, TypeSpec<'o'> > oct (int value)
 Returns an integer format specifier to format the value in base 8. More...
 
IntFormatSpec< int, TypeSpec<'x'> > hex (int value)
 Returns an integer format specifier to format the value in base 16 using lower-case letters for the digits above 9. More...
 
IntFormatSpec< int, TypeSpec<'X'> > hexu (int value)
 Returns an integer formatter format specifier to format in base 16 using upper-case letters for the digits above 9. More...
 
template<char TYPE_CODE, typename Char >
IntFormatSpec< int, AlignTypeSpec< TYPE_CODE >, Char > 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. More...
 
template<typename Char >
StrFormatSpec< Char > pad (const Char *str, unsigned width, Char fill= ' ')
 Returns a string formatter that pads the formatted argument with the fill character to the specified width using the default (left) string alignment. More...
 
StrFormatSpec< wchar_tpad (const wchar_t *str, unsigned width, char fill= ' ')
 
void report_system_error (int error_code, StringRef message) FMT_NOEXCEPT(true)
 
void print_colored (Color c, StringRef format, const ArgList &args)
 Formats a string and prints it to stdout using ANSI escape sequences to specify color (experimental). More...
 
std::string format (StringRef format_str, const ArgList &args)
 Formats arguments and returns the result as a string. More...
 
std::wstring format (WStringRef format_str, const ArgList &args)
 
void print (std::FILE *f, StringRef format_str, const ArgList &args)
 Prints formatted data to the file f. More...
 
void print (StringRef format_str, const ArgList &args)
 Prints formatted data to stdout. More...
 
void print (std::ostream &os, StringRef format_str, const ArgList &args)
 Prints formatted data to the stream os. More...
 
template<typename Char >
void printf (BasicWriter< Char > &w, BasicStringRef< Char > format, const ArgList &args)
 
std::string sprintf (StringRef format, const ArgList &args)
 Formats arguments and returns the result as a string. More...
 
int fprintf (std::FILE *f, StringRef format, const ArgList &args)
 Prints formatted data to the file f. More...
 
int printf (StringRef format, const ArgList &args)
 Prints formatted data to stdout. More...
 
template<typename T >
void format_decimal (char *&buffer, T value)
 

Variables

FMT_GCC_EXTENSION typedef long long LongLong
 
FMT_GCC_EXTENSION typedef unsigned long long ULongLong
 

Typedef Documentation

typedef BasicWriter<char> fmt::Writer

Enumeration Type Documentation

anonymous enum
Enumerator
SIGN_FLAG 
PLUS_FLAG 
MINUS_FLAG 
HASH_FLAG 
CHAR_FLAG 
Enumerator
ALIGN_DEFAULT 
ALIGN_LEFT 
ALIGN_RIGHT 
ALIGN_CENTER 
ALIGN_NUMERIC 
enum fmt::Color
Enumerator
BLACK 
RED 
GREEN 
YELLOW 
BLUE 
MAGENTA 
CYAN 
WHITE 

Function Documentation

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 
)
std::string fmt::format ( StringRef  format_str,
const ArgList args 
)
inline

Formats arguments and returns the result as a string.

Example**::

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

std::wstring fmt::format ( WStringRef  format_str,
const ArgList args 
)
inline
template<typename T >
void fmt::format_decimal ( char *&  buffer,
T  value 
)
inline
int fmt::fprintf ( std::FILE *  f,
StringRef  format,
const ArgList args 
)

Prints formatted data to the file f.

Example**::

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

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.

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**::

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

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(Writer() << pad("abc", 8)); s == "abc "

StrFormatSpec<wchar_t> fmt::pad ( const wchar_t str,
unsigned  width,
char  fill = ' ' 
)
inline
void fmt::print ( std::FILE *  f,
StringRef  format_str,
const ArgList args 
)

Prints formatted data to the file f.

Example**::

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

void fmt::print ( StringRef  format_str,
const ArgList args 
)
inline

Prints formatted data to stdout.

Example**::

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

void fmt::print ( std::ostream &  os,
StringRef  format_str,
const ArgList args 
)

Prints formatted data to the stream os.

Example**::

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

void fmt::print_colored ( Color  c,
StringRef  format,
const ArgList args 
)

Formats a string and prints it to stdout using ANSI escape sequences to specify color (experimental).

Example: PrintColored(fmt::RED, "Elapsed time: {0:.2f} seconds") << 1.23;

template<typename Char >
void fmt::printf ( BasicWriter< Char > &  w,
BasicStringRef< Char >  format,
const ArgList args 
)
int fmt::printf ( StringRef  format,
const ArgList args 
)
inline

Prints formatted data to stdout.

Example**::

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

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

Formats arguments and returns the result as a string.

Example**::

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

Variable Documentation

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