NGL  6.5
The NCCA Graphics Library
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  BasicPrintfArgFormatter
 
class  BasicStringRef
 
class  BasicStringWriter
 
class  BasicWriter
 
class  Buffer
 
class  BufferedFile
 
struct  EmptySpec
 
class  ErrorCode
 
class  File
 
class  FormatError
 
class  FormatInt
 
struct  FormatSpec
 
class  IntFormatSpec
 
class  PrintfArgFormatter
 
class  PrintfFormatter
 
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
 
typedef BasicStringWriter< char > StringWriter
 
typedef BasicStringWriter< wchar_t > WStringWriter
 

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

FMT_FUNC void format_system_error (Writer &out, int error_code, StringRef message) FMT_NOEXCEPT
 
FMT_FUNC void report_system_error (int error_code, fmt::StringRef message) FMT_NOEXCEPT
 
FMT_FUNC void print (std::FILE *f, CStringRef format_str, ArgList args)
 
FMT_FUNC void print (CStringRef format_str, ArgList args)
 
FMT_FUNC void print_colored (Color c, CStringRef format, ArgList args)
 
template<typename Char >
void printf (BasicWriter< Char > &w, BasicCStringRef< Char > format, ArgList args)
 
FMT_FUNC int fprintf (std::FILE *f, CStringRef format, ArgList args)
 
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= ' ')
 
std::string format (CStringRef format_str, ArgList args)
 
std::wstring format (WCStringRef 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)
 
template<typename Char , typename ArgFormatter , typename T >
void format_arg (BasicFormatter< Char, ArgFormatter > &f, const Char *&format_str, const T &value)
 
long getpagesize ()
 
std::string sprintf (CStringRef format, ArgList args)
 
std::wstring sprintf (WCStringRef format, ArgList args)
 
int printf (CStringRef format, ArgList args)
 
int fprintf (std::ostream &os, CStringRef format_str, ArgList args)
 
template<typename T >
std::string to_string (const T &value)
 
template<typename ArgFormatter >
void format_arg (BasicFormatter< char, ArgFormatter > &f, const char *&format_str, const std::tm &tm)
 

Variables

FMT_GCC_EXTENSION typedef long long LongLong
 
FMT_GCC_EXTENSION typedef unsigned long long ULongLong
 

Typedef Documentation

Definition at line 3099 of file format.h.

Definition at line 534 of file format.h.

Definition at line 3050 of file format.h.

Definition at line 486 of file format.h.

Definition at line 97 of file string.h.

Definition at line 3100 of file format.h.

Definition at line 535 of file format.h.

Definition at line 3051 of file format.h.

typedef BasicWriter<char> fmt::Writer

Definition at line 376 of file format.h.

typedef BasicStringRef<wchar_t> fmt::WStringRef

Definition at line 487 of file format.h.

Definition at line 98 of file string.h.

typedef BasicWriter<wchar_t> fmt::WWriter

Definition at line 379 of file format.h.

Enumeration Type Documentation

anonymous enum
Enumerator
SIGN_FLAG 
PLUS_FLAG 
MINUS_FLAG 
HASH_FLAG 
CHAR_FLAG 

Definition at line 1593 of file format.h.

Enumerator
ALIGN_DEFAULT 
ALIGN_LEFT 
ALIGN_RIGHT 
ALIGN_CENTER 
ALIGN_NUMERIC 

Definition at line 1588 of file format.h.

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

Definition at line 3156 of file format.h.

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

Definition at line 3325 of file format.h.

+ Here is the caller graph for this function:

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

Definition at line 3330 of file format.h.

References arg(), and 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 > &   
)
IntFormatSpec<int, TypeSpec<'b'> > fmt::bin ( int  value)

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

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

Definition at line 3175 of file format.h.

References fmt::BasicWriter< Char >::str(), and fmt::BasicWriter< Char >::write().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 3181 of file format.h.

References FMT_API, print(), fmt::BasicWriter< Char >::str(), and fmt::BasicWriter< Char >::write().

+ Here is the call graph for this function:

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

Definition at line 76 of file ostream.h.

References FMT_API, FMT_VARIADIC, fmt::BasicFormatter< CharType, ArgFormatter >::format(), print(), and fmt::internal::FormatBuf< Char >::size().

+ Here is the call graph for this function:

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

Definition at line 3292 of file format.h.

References fmt::internal::count_digits(), fmt::internal::BasicData< T >::DIGITS, fmt::internal::format_decimal(), and fmt::internal::is_negative().

+ Here is the call graph for this function:

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

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.

Definition at line 386 of file format.cc.

References FMT_CATCH, FMT_TRY, fmt::internal::INLINE_BUFFER_SIZE, fmt::Buffer< T >::resize(), and fmt::Buffer< T >::size().

+ 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");

Definition at line 507 of file format.cc.

References fmt::BasicWriter< Char >::data(), fmt::PrintfFormatter< Char, ArgFormatter >::format(), fmt::internal::FixedBuffer< Char >::grow(), fmt::internal::ArgMap< Char >::init(), printf(), and fmt::BasicWriter< Char >::size().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Prints formatted data to the stream os.

Example**::

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

Definition at line 549 of file printf.h.

References FMT_VARIADIC, fprintf(), printf(), fmt::BasicWriter< Char >::size(), and fmt::internal::write().

+ Here is the call graph for this function:

long fmt::getpagesize ( )

Definition at line 227 of file posix.cc.

References FMT_POSIX_CALL.

+ Here is the caller graph for this function:

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.

+ Here is the caller graph for this function:

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

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

+ Here is the caller graph for this function:

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 "

Definition at line 1799 of file format.h.

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

Definition at line 1804 of file format.h.

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

Definition at line 30 of file ostream.cc.

References fmt::internal::write(), and fmt::BasicWriter< Char >::write().

+ Here is the call graph for this function:

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

Definition at line 486 of file format.cc.

References fmt::BasicWriter< Char >::data(), fmt::BasicWriter< Char >::size(), and fmt::BasicWriter< Char >::write().

+ Here is the call graph for this function:

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

Definition at line 492 of file format.cc.

References print().

+ Here is the call graph for this function:

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

Definition at line 496 of file format.cc.

References print(), and printf().

+ Here is the call graph for this function:

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

Definition at line 487 of file printf.h.

References format().

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

Definition at line 535 of file printf.h.

References FMT_VARIADIC, fprintf(), and printf().

+ Here is the call graph for this function:

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

Definition at line 472 of file format.cc.

References FMT_FUNC, FMT_NOEXCEPT, and fmt::internal::format_system_error().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 500 of file printf.h.

References FMT_VARIADIC, printf(), and fmt::BasicWriter< Char >::str().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 507 of file printf.h.

References FMT_API, FMT_VARIADIC, FMT_VARIADIC_W, fprintf(), printf(), sprintf(), and fmt::BasicWriter< Char >::str().

+ Here is the call graph for this function:

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

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

Example**::

#include "fmt/string.h"

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

Definition at line 112 of file string.h.

References fmt::BasicWriter< Char >::str().

+ Here is the call graph for this function:

Variable Documentation

FMT_GCC_EXTENSION typedef long long fmt::LongLong

Definition at line 368 of file format.h.

FMT_GCC_EXTENSION typedef unsigned long long fmt::ULongLong

Definition at line 369 of file format.h.