Bitcoin Core 28.99.0
P2P Digital Currency
Namespaces | Classes | Typedefs | Functions
tinyformat Namespace Reference

Namespaces

namespace  detail
 

Classes

class  format_error
 
class  FormatList
 List of template arguments format(), held in a type-opaque way. More...
 
struct  FormatStringCheck
 
struct  RuntimeFormat
 

Typedefs

typedef const FormatListFormatListRef
 Reference to type-opaque format list for passing to vformat() More...
 

Functions

template<typename T >
void formatValue (std::ostream &out, const char *, const char *fmtEnd, int ntrunc, const T &value)
 Format a value into a stream, delegating to operator<< by default. More...
 
template<typename... Args>
detail::FormatListN< sizeof...(Args)> makeFormatList (const Args &... args)
 Make type-agnostic format list from list of template arguments. More...
 
void vformat (std::ostream &out, const char *fmt, FormatListRef list)
 Format list of arguments to the stream according to the given format string. More...
 
template<typename... Args>
void format (std::ostream &out, FormatStringCheck< sizeof...(Args)> fmt, const Args &... args)
 Format list of arguments to the stream according to given format string. More...
 
template<typename... Args>
std::string format (FormatStringCheck< sizeof...(Args)> fmt, const Args &... args)
 Format list of arguments according to the given format string and return the result as a string. More...
 
template<typename... Args>
void printf (FormatStringCheck< sizeof...(Args)> fmt, const Args &... args)
 Format list of arguments to std::cout, according to the given format string. More...
 
template<typename... Args>
void printfln (FormatStringCheck< sizeof...(Args)> fmt, const Args &... args)
 
template<>
void formatValue (std::ostream &, const char *, const char *, int, const std::filesystem::path &)=delete
 
template<>
void formatValue (std::ostream &, const char *, const char *, int, const fs::path &)=delete
 
template<typename... Args>
bilingual_str format (util::BilingualFmt< sizeof...(Args)> fmt, const Args &... args)
 

Typedef Documentation

◆ FormatListRef

Reference to type-opaque format list for passing to vformat()

Definition at line 977 of file tinyformat.h.

Function Documentation

◆ format() [1/3]

template<typename... Args>
std::string tinyformat::format ( FormatStringCheck< sizeof...(Args)>  fmt,
const Args &...  args 
)

Format list of arguments according to the given format string and return the result as a string.

Definition at line 1087 of file tinyformat.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ format() [2/3]

template<typename... Args>
void tinyformat::format ( std::ostream &  out,
FormatStringCheck< sizeof...(Args)>  fmt,
const Args &...  args 
)

Format list of arguments to the stream according to given format string.

Definition at line 1079 of file tinyformat.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ format() [3/3]

template<typename... Args>
bilingual_str tinyformat::format ( util::BilingualFmt< sizeof...(Args)>  fmt,
const Args &...  args 
)

Definition at line 87 of file translation.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatValue() [1/3]

template<>
void tinyformat::formatValue ( std::ostream &  ,
const char *  ,
const char *  ,
int  ,
const fs::path  
)
inlinedelete

◆ formatValue() [2/3]

template<>
void tinyformat::formatValue ( std::ostream &  ,
const char *  ,
const char *  ,
int  ,
const std::filesystem::path &   
)
inlinedelete

◆ formatValue() [3/3]

template<typename T >
void tinyformat::formatValue ( std::ostream &  out,
const char *  ,
const char *  fmtEnd,
int  ntrunc,
const T &  value 
)
inline

Format a value into a stream, delegating to operator<< by default.

Users may override this for their own types. When this function is called, the stream flags will have been modified according to the format string. The format specification is provided in the range [fmtBegin, fmtEnd). For truncating conversions, ntrunc is set to the desired maximum number of characters, for example "%.7s" calls formatValue with ntrunc = 7.

By default, formatValue() uses the usual stream insertion operator operator<< to format the type T, with special cases for the c and p conversions.

Definition at line 349 of file tinyformat.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeFormatList()

template<typename... Args>
detail::FormatListN< sizeof...(Args)> tinyformat::makeFormatList ( const Args &...  args)

Make type-agnostic format list from list of template arguments.

The exact return type of this function is an implementation detail and shouldn't be relied upon. Instead it should be stored as a FormatListRef:

FormatListRef formatList = makeFormatList( /*...*‍/ );

Definition at line 1043 of file tinyformat.h.

Here is the caller graph for this function:

◆ printf()

template<typename... Args>
void tinyformat::printf ( FormatStringCheck< sizeof...(Args)>  fmt,
const Args &...  args 
)

Format list of arguments to std::cout, according to the given format string.

Definition at line 1096 of file tinyformat.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printfln()

template<typename... Args>
void tinyformat::printfln ( FormatStringCheck< sizeof...(Args)>  fmt,
const Args &...  args 
)

Definition at line 1102 of file tinyformat.h.

Here is the call graph for this function:

◆ vformat()

void tinyformat::vformat ( std::ostream &  out,
const char *  fmt,
FormatListRef  list 
)
inline

Format list of arguments to the stream according to the given format string.

The name vformat() is chosen for the semantic similarity to vprintf(): the list of format arguments is held in a single function argument.

Definition at line 1069 of file tinyformat.h.

Here is the call graph for this function:
Here is the caller graph for this function: