WPILibC++ 2024.3.2
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_context< Char >
 
struct  detail::int_checker< IsSigned >
 
struct  detail::int_checker< true >
 
struct  detail::printf_precision_handler
 
struct  detail::is_zero_int
 
struct  detail::make_unsigned_or_bool< T >
 
struct  detail::make_unsigned_or_bool< bool >
 
class  detail::arg_converter< T, Context >
 
class  detail::char_converter< Context >
 
struct  detail::get_cstring< Char >
 
class  detail::printf_width_handler< Char >
 
class  detail::printf_arg_formatter< Char >
 

Namespaces

namespace  detail
 detail namespace with internal helper functions
 

Typedefs

using printf_context = basic_printf_context< char >
 
using wprintf_context = basic_printf_context< 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 detail::convert_arg (basic_format_arg< Context > &arg, Char type)
 
template<typename Char >
auto detail::make_arg_formatter (buffer_appender< Char > iter, format_specs< Char > &s) -> arg_formatter< Char >
 
template<typename Char >
void detail::parse_flags (format_specs< Char > &specs, const Char *&it, const Char *end)
 
template<typename Char , typename GetArg >
auto detail::parse_header (const Char *&it, const Char *end, format_specs< Char > &specs, GetArg get_arg) -> int
 
auto detail::parse_printf_presentation_type (char c, type t) -> presentation_type
 
template<typename Char , typename Context >
void detail::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... >
 
template<typename Char >
auto vsprintf (basic_string_view< Char > fmt, basic_format_args< basic_printf_context< 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 Char >
auto vfprintf (std::FILE *f, basic_string_view< Char > fmt, basic_format_args< basic_printf_context< 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 Char >
FMT_DEPRECATED auto vprintf (basic_string_view< Char > fmt, basic_format_args< basic_printf_context< type_identity_t< Char > > > args) -> int
 
template<typename... T>
auto printf (string_view fmt, const T &... args) -> int
 \rst Prints formatted data to stdout. More...
 
template<typename... T>
FMT_DEPRECATED auto printf (basic_string_view< wchar_t > fmt, const T &... args) -> int
 

Typedef Documentation

◆ printf_args

◆ printf_context

◆ wprintf_args

◆ wprintf_context

Function Documentation

◆ 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

◆ printf() [1/2]

template<typename... T>
FMT_DEPRECATED auto printf ( basic_string_view< wchar_t >  fmt,
const T &...  args 
) -> int
inline

◆ printf() [2/2]

template<typename... T>
auto printf ( string_view  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 Char >
auto vfprintf ( std::FILE *  f,
basic_string_view< Char >  fmt,
basic_format_args< basic_printf_context< type_identity_t< Char > > >  args 
) -> int
inline

◆ vprintf()

template<typename Char >
FMT_DEPRECATED auto vprintf ( basic_string_view< Char >  fmt,
basic_format_args< basic_printf_context< type_identity_t< Char > > >  args 
) -> int
inline

◆ vsprintf()

template<typename Char >
auto vsprintf ( basic_string_view< Char >  fmt,
basic_format_args< basic_printf_context< type_identity_t< Char > > >  args 
) -> std::basic_string<Char>
inline