WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
printf.h File Reference
#include <algorithm>
#include <limits>
#include "format.h"

Go to the source code of this file.

Classes

class  basic_printf_context< Char >
struct  detail::int_checker< IS_SIGNED >
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
class  detail::printf_arg_formatter< Char >
struct  vprintf_args< Char >

Namespaces

namespace  detail
 Converts a string literal into a format string that will be parsed at compile time and converted into efficient formatting code.

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<bool IS_CONSTEXPR, typename T, typename Ptr = const T*>
FMT_CONSTEXPR auto detail::find (Ptr first, Ptr last, T value, Ptr &out) -> bool
template<>
auto detail::find< false, char > (const char *first, const char *last, char value, const char *&out) -> bool
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 (basic_appender< Char > iter, format_specs &s) -> arg_formatter< Char >
template<typename Char>
void detail::parse_flags (format_specs &specs, const Char *&it, const Char *end)
template<typename Char, typename GetArg>
auto detail::parse_header (const Char *&it, const Char *end, format_specs &specs, GetArg get_arg) -> int
auto detail::parse_printf_presentation_type (char c, type t, bool &upper) -> 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 Char = char, typename... T>
auto make_printf_args (T &... args) -> decltype(fmt::make_format_args< basic_printf_context< Char > >(args...))
 Constructs an format_arg_store object that contains references to arguments and can be implicitly converted to printf_args.
template<typename Char>
auto vsprintf (basic_string_view< Char > fmt, typename vprintf_args< Char >::type args) -> std::basic_string< Char >
template<typename... T>
auto sprintf (string_view fmt, const T &... args) -> std::string
 Formats args according to specifications in fmt and returns the result as as string.
template<typename... T>
FMT_DEPRECATED auto sprintf (basic_string_view< wchar_t > fmt, const T &... args) -> std::wstring
template<typename Char>
auto vfprintf (std::FILE *f, basic_string_view< Char > fmt, typename vprintf_args< Char >::type args) -> int
template<typename... T>
auto fprintf (std::FILE *f, string_view fmt, const T &... args) -> int
 Formats args according to specifications in fmt and writes the output to f.
template<typename... T>
FMT_DEPRECATED auto fprintf (std::FILE *f, basic_string_view< wchar_t > fmt, const T &... args) -> int
template<typename... T>
auto printf (string_view fmt, const T &... args) -> int
 Formats args according to specifications in fmt and writes the output to stdout.

Typedef Documentation

◆ printf_args

◆ printf_context

◆ wprintf_args

◆ wprintf_context

Function Documentation

◆ fprintf() [1/2]

template<typename... T>
FMT_DEPRECATED auto fprintf ( std::FILE * f,
basic_string_view< wchar_t > fmt,
const T &... args )->int

◆ fprintf() [2/2]

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

Formats args according to specifications in fmt and writes the output to f.

Example:

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

◆ make_printf_args()

template<typename Char = char, typename... T>
auto make_printf_args ( T &... args) ->decltype(fmt::make_format_args< basic_printf_context< Char > >(args...))
inline

Constructs an format_arg_store object that contains references to arguments and can be implicitly converted to printf_args.

◆ printf()

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

Formats args according to specifications in fmt and writes the output to stdout.

Example:

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

◆ sprintf() [1/2]

template<typename... T>
FMT_DEPRECATED auto sprintf ( basic_string_view< wchar_t > fmt,
const T &... args )->std::wstring

◆ sprintf() [2/2]

template<typename... T>
auto sprintf ( string_view fmt,
const T &... args )->std::string
inline

Formats args according to specifications in fmt and returns the result as as string.

Example:

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

◆ vfprintf()

template<typename Char>
auto vfprintf ( std::FILE * f,
basic_string_view< Char > fmt,
typename vprintf_args< Char >::type args )->int

◆ vsprintf()

template<typename Char>
auto vsprintf ( basic_string_view< Char > fmt,
typename vprintf_args< Char >::type args )->std::basic_string< Char >
inline