Flow123d  JS_before_hm-2150-g5e4b4b118
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
fmt Namespace Reference

Namespaces

 internal
 

Classes

struct  AlignSpec
 
struct  AlignTypeSpec
 
class  ArgFormatter
 
class  ArgList
 
class  ArgVisitor
 
class  BasicArgFormatter
 
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

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< Char > pad (const Char *str, unsigned width, Char fill=' ')
 
StrFormatSpec< wchar_t > pad (const wchar_t *str, unsigned width, char fill=' ')
 
FMT_API void format_system_error (fmt::Writer &out, int error_code, fmt::StringRef message) FMT_NOEXCEPT
 
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 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_FUNC void print (std::ostream &os, CStringRef format_str, ArgList args)
 
FMT_FUNC int fprintf (std::ostream &os, CStringRef format, ArgList args)
 
template<typename Char , typename ArgFormatter , typename T >
void format (BasicFormatter< Char, ArgFormatter > &f, const Char *&format_str, const T &value)
 
long getpagesize ()
 
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 >
std::string to_string (const T &value)
 

Variables

FMT_GCC_EXTENSION typedef long long LongLong
 
FMT_GCC_EXTENSION typedef unsigned long long ULongLong
 

Typedef Documentation

◆ ArrayWriter

Definition at line 3065 of file format.h.

◆ CStringRef

Definition at line 531 of file format.h.

◆ MemoryWriter

Definition at line 3016 of file format.h.

◆ StringRef

Definition at line 483 of file format.h.

◆ WArrayWriter

Definition at line 3066 of file format.h.

◆ WCStringRef

Definition at line 532 of file format.h.

◆ WMemoryWriter

Definition at line 3017 of file format.h.

◆ Writer

typedef BasicWriter<char> fmt::Writer

Definition at line 376 of file format.h.

◆ WStringRef

typedef BasicStringRef<wchar_t> fmt::WStringRef

Definition at line 484 of file format.h.

◆ WWriter

typedef BasicWriter<wchar_t> fmt::WWriter

Definition at line 379 of file format.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SIGN_FLAG 
PLUS_FLAG 
MINUS_FLAG 
HASH_FLAG 
CHAR_FLAG 

Definition at line 1558 of file format.h.

◆ Alignment

Enumerator
ALIGN_DEFAULT 
ALIGN_LEFT 
ALIGN_RIGHT 
ALIGN_CENTER 
ALIGN_NUMERIC 

Definition at line 1553 of file format.h.

◆ Color

enum fmt::Color
Enumerator
BLACK 
RED 
GREEN 
YELLOW 
BLUE 
MAGENTA 
CYAN 
WHITE 

Definition at line 3122 of file format.h.

Function Documentation

◆ arg() [1/4]

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

\rst Returns a named argument for formatting functions.

Example**::

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

\endrst

Definition at line 3291 of file format.h.

Here is the caller graph for this function:

◆ arg() [2/4]

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

◆ arg() [3/4]

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

Definition at line 3296 of file format.h.

◆ arg() [4/4]

template<typename Char >
void fmt::arg ( WStringRef  ,
const internal::NamedArg< Char > &   
)
Here is the caller graph for this function:

◆ bin()

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

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

◆ format() [1/3]

template<typename Char , typename ArgFormatter , typename T >
void fmt::format ( BasicFormatter< Char, ArgFormatter > &  f,
const Char *&  format_str,
const T &  value 
)

Definition at line 91 of file ostream.h.

◆ format() [2/3]

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

\rst Formats arguments and returns the result as a string.

Example**::

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

Definition at line 3141 of file format.h.

◆ format() [3/3]

std::wstring fmt::format ( WCStringRef  format_str,
ArgList  args 
)
inline

Definition at line 3147 of file format.h.

◆ format_decimal()

template<typename T >
void fmt::format_decimal ( char *&  buffer,
value 
)
inline

Definition at line 3258 of file format.h.

Here is the caller graph for this function:

◆ format_system_error()

FMT_FUNC void fmt::format_system_error ( fmt::Writer out,
int  error_code,
fmt::StringRef  message 
)

\rst Formats an error returned by an operating system or a language runtime, for example a file opening error, and writes it to out in the following form:

.. parsed-literal:: <message>*: *<system-message>*

where *<message>* is the passed message and *<system-message>* is the system message corresponding to the error code. error_code* is a system error code as given by errno. If error_code is not a valid error code such as -1, the system message may look like "Unknown error -1" and is platform-dependent. \endrst

Definition at line 388 of file format.cc.

Here is the caller graph for this function:

◆ fprintf() [1/2]

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

\rst Prints formatted data to the file f.

Example**::

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

Definition at line 507 of file format.cc.

◆ fprintf() [2/2]

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

\rst Prints formatted data to the stream os.

Example**::

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

Definition at line 56 of file ostream.cc.

Here is the caller graph for this function:

◆ getpagesize()

long fmt::getpagesize ( )

Definition at line 245 of file posix.cc.

◆ hex()

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:

◆ hexu()

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.

◆ oct()

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

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

◆ pad() [1/3]

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

\rst 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 "

\endrst

Definition at line 1764 of file format.h.

◆ pad() [2/3]

StrFormatSpec<wchar_t> fmt::pad ( const wchar_t *  str,
unsigned  width,
char  fill = ' ' 
)
inline

Definition at line 1769 of file format.h.

◆ pad() [3/3]

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

\rst 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"

\endrst

Here is the caller graph for this function:

◆ print() [1/3]

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

\rst Prints formatted data to stdout.

Example**::

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

Definition at line 495 of file format.cc.

◆ print() [2/3]

FMT_FUNC void fmt::print ( std::FILE *  f,
CStringRef  format_str,
ArgList  args 
)

\rst Prints formatted data to the file f.

Example**::

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

Definition at line 489 of file format.cc.

Here is the caller graph for this function:

◆ print() [3/3]

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

\rst Prints formatted data to the stream os.

Example**::

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

Definition at line 50 of file ostream.cc.

◆ print_colored()

FMT_FUNC 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);

Definition at line 499 of file format.cc.

◆ printf() [1/2]

template<typename Char >
void fmt::printf ( BasicWriter< Char > &  w,
BasicCStringRef< Char >  format,
ArgList  args 
)

Definition at line 444 of file printf.h.

Here is the caller graph for this function:

◆ printf() [2/2]

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

\rst Prints formatted data to stdout.

Example**::

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

Definition at line 492 of file printf.h.

◆ report_system_error()

FMT_FUNC void fmt::report_system_error ( int  error_code,
fmt::StringRef  message 
)

Definition at line 475 of file format.cc.

Here is the caller graph for this function:

◆ sprintf() [1/2]

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

\rst Formats arguments and returns the result as a string.

Example**::

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

Definition at line 457 of file printf.h.

Here is the caller graph for this function:

◆ sprintf() [2/2]

std::wstring fmt::sprintf ( WCStringRef  format,
ArgList  args 
)
inline

Definition at line 464 of file printf.h.

◆ to_string()

template<typename T >
std::string fmt::to_string ( const T &  value)

\rst Converts value to std::string using the default format for type T.

Example**::

#include "fmt/string.h"

std::string answer = fmt::to_string(42); \endrst

Definition at line 29 of file string.h.

Here is the caller graph for this function:

Variable Documentation

◆ LongLong

FMT_GCC_EXTENSION typedef long long fmt::LongLong

Definition at line 368 of file format.h.

◆ ULongLong

FMT_GCC_EXTENSION typedef unsigned long long fmt::ULongLong

Definition at line 369 of file format.h.