WPILibC++ 2023.4.3-108-ge5452e3
printf.h File Reference
#include <algorithm>
#include <limits>
#include "format.h"

Go to the source code of this file.

Classes

struct  printf_formatter< T >
 
class  basic_printf_parse_context< Char >
 
class  basic_printf_context< OutputIt, Char >
 
struct  int_checker< IsSigned >
 
struct  int_checker< true >
 
class  printf_precision_handler
 
class  is_zero_int
 
struct  make_unsigned_or_bool< T >
 
struct  make_unsigned_or_bool< bool >
 
class  arg_converter< T, Context >
 
class  char_converter< Context >
 
struct  get_cstring< Char >
 
class  printf_width_handler< Char >
 
class  printf_arg_formatter< OutputIt, Char >
 

Typedefs

template<typename Char >
using basic_printf_context_t = basic_printf_context< detail::buffer_appender< Char >, Char >
 
using printf_context = basic_printf_context_t< char >
 
using wprintf_context = basic_printf_context_t< wchar_t >
 
using printf_args = basic_format_args< printf_context >
 
using wprintf_args = basic_format_args< wprintf_context >
 

Functions

template<typename T , typename Context , typename Char >
void convert_arg (basic_format_arg< Context > &arg, Char type)
 
template<typename Char >
void parse_flags (basic_format_specs< Char > &specs, const Char *&it, const Char *end)
 
template<typename Char , typename GetArg >
int parse_header (const Char *&it, const Char *end, basic_format_specs< Char > &specs, GetArg get_arg)
 
template<typename Char , typename Context >
void vprintf (buffer< Char > &buf, basic_string_view< Char > format, basic_format_args< Context > args)
 
template<typename... T>
auto make_printf_args (const T &... args) -> format_arg_store< printf_context, T... >
 \rst Constructs an ~fmtformat_arg_store object that contains references to arguments and can be implicitly converted to ~fmtprintf_args. More...
 
template<typename... T>
auto make_wprintf_args (const T &... args) -> format_arg_store< wprintf_context, T... >
 \rst Constructs an ~fmtformat_arg_store object that contains references to arguments and can be implicitly converted to ~fmtwprintf_args. More...
 
template<typename S , typename Char = char_t<S>>
auto vsprintf (const S &fmt, basic_format_args< basic_printf_context_t< type_identity_t< Char > > > args) -> std::basic_string< Char >
 
template<typename S , typename... T, typename Char = enable_if_t<detail::is_string<S>::value, char_t<S>>>
auto sprintf (const S &fmt, const T &... args) -> std::basic_string< Char >
 \rst Formats arguments and returns the result as a string. More...
 
template<typename S , typename Char = char_t<S>>
auto vfprintf (std::FILE *f, const S &fmt, basic_format_args< basic_printf_context_t< type_identity_t< Char > > > args) -> int
 
template<typename S , typename... T, typename Char = char_t<S>>
auto fprintf (std::FILE *f, const S &fmt, const T &... args) -> int
 \rst Prints formatted data to the file f. More...
 
template<typename S , typename Char = char_t<S>>
auto vprintf (const S &fmt, basic_format_args< basic_printf_context_t< type_identity_t< Char > > > args) -> int
 
template<typename S , typename... T, FMT_ENABLE_IF(detail::is_string< S >::value) >
auto printf (const S &fmt, const T &... args) -> int
 \rst Prints formatted data to stdout. More...
 

Typedef Documentation

◆ basic_printf_context_t

template<typename Char >
using basic_printf_context_t = basic_printf_context<detail::buffer_appender<Char>, Char>

◆ printf_args

◆ printf_context

◆ wprintf_args

◆ wprintf_context

Function Documentation

◆ convert_arg()

template<typename T , typename Context , typename Char >
void convert_arg ( basic_format_arg< Context > &  arg,
Char  type 
)

◆ fprintf()

template<typename S , typename... T, typename Char = char_t<S>>
auto fprintf ( std::FILE *  f,
const S fmt,
const T &...  args 
) -> int
inline

\rst Prints formatted data to the file f.

Example**::

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

◆ make_printf_args()

template<typename... T>
auto make_printf_args ( const T &...  args) -> format_arg_store<printf_context, T...>
inline

\rst Constructs an ~fmtformat_arg_store object that contains references to arguments and can be implicitly converted to ~fmtprintf_args.

\endrst

◆ make_wprintf_args()

template<typename... T>
auto make_wprintf_args ( const T &...  args) -> format_arg_store<wprintf_context, T...>
inline

\rst Constructs an ~fmtformat_arg_store object that contains references to arguments and can be implicitly converted to ~fmtwprintf_args.

\endrst

◆ parse_flags()

template<typename Char >
void parse_flags ( basic_format_specs< Char > &  specs,
const Char *&  it,
const Char *  end 
)

◆ parse_header()

template<typename Char , typename GetArg >
int parse_header ( const Char *&  it,
const Char *  end,
basic_format_specs< Char > &  specs,
GetArg  get_arg 
)

◆ printf()

template<typename S , typename... T, FMT_ENABLE_IF(detail::is_string< S >::value) >
auto printf ( const S fmt,
const T &...  args 
) -> int
inline

\rst Prints formatted data to stdout.

Example**::

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

◆ sprintf()

template<typename S , typename... T, typename Char = enable_if_t<detail::is_string<S>::value, char_t<S>>>
auto sprintf ( const S fmt,
const T &...  args 
) -> std::basic_string<Char>
inline

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

Example**::

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

◆ vfprintf()

template<typename S , typename Char = char_t<S>>
auto vfprintf ( std::FILE *  f,
const S fmt,
basic_format_args< basic_printf_context_t< type_identity_t< Char > > >  args 
) -> int
inline

◆ vprintf() [1/2]

template<typename Char , typename Context >
void vprintf ( buffer< Char > &  buf,
basic_string_view< Char >  format,
basic_format_args< Context >  args 
)

◆ vprintf() [2/2]

template<typename S , typename Char = char_t<S>>
auto vprintf ( const S fmt,
basic_format_args< basic_printf_context_t< type_identity_t< Char > > >  args 
) -> int
inline

◆ vsprintf()

template<typename S , typename Char = char_t<S>>
auto vsprintf ( const S fmt,
basic_format_args< basic_printf_context_t< type_identity_t< Char > > >  args 
) -> std::basic_string<Char>
inline