SoPlex Documentation
Loading...
Searching...
No Matches
printf.h File Reference
#include <algorithm>
#include <limits>
#include "ostream.h"

Go to the source code of this file.

Classes

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 >
 
class  printf_width_handler< Char >
 
class  printf_arg_formatter< Range >
 
struct  printf_formatter< T >
 
class  basic_printf_context< OutputIt, Char >
 

Namespaces

namespace  internal
 

Typedefs

template<typename Char >
using basic_printf_context_t
 
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 , typename Context >
void printf (buffer< Char > &buf, basic_string_view< Char > format, basic_format_args< Context > args)
 
template<typename OutputIt , typename Char , typename Context >
internal::truncating_iterator< OutputIt > printf (internal::truncating_iterator< OutputIt > it, basic_string_view< Char > format, basic_format_args< Context > args)
 
template<typename... Args>
format_arg_store< printf_context, Args... > make_printf_args (const Args &... args)
 
template<typename... Args>
format_arg_store< wprintf_context, Args... > make_wprintf_args (const Args &... args)
 
template<typename S , typename Char = char_t<S>>
std::basic_string< Char > vsprintf (const S &format, basic_format_args< basic_printf_context_t< Char > > args)
 
template<typename S , typename... Args, typename Char = enable_if_t<internal::is_string<S>::value, char_t<S>>>
std::basic_string< Char > sprintf (const S &format, const Args &... args)
 
template<typename S , typename Char = char_t<S>>
int vfprintf (std::FILE *f, const S &format, basic_format_args< basic_printf_context_t< Char > > args)
 
template<typename S , typename... Args, typename Char = enable_if_t<internal::is_string<S>::value, char_t<S>>>
int fprintf (std::FILE *f, const S &format, const Args &... args)
 
template<typename S , typename Char = char_t<S>>
int vprintf (const S &format, basic_format_args< basic_printf_context_t< Char > > args)
 
template<typename S , typename... Args, FMT_ENABLE_IF(internal::is_string< S >::value) >
int printf (const S &format_str, const Args &... args)
 
template<typename S , typename Char = char_t<S>>
int vfprintf (std::basic_ostream< Char > &os, const S &format, basic_format_args< basic_printf_context_t< Char > > args)
 
template<typename ArgFormatter , typename Char , typename Context = basic_printf_context<typename ArgFormatter::iterator, Char>>
ArgFormatter::iterator vprintf (internal::buffer< Char > &out, basic_string_view< Char > format_str, basic_format_args< Context > args)
 
template<typename S , typename... Args, typename Char = char_t<S>>
int fprintf (std::basic_ostream< Char > &os, const S &format_str, const Args &... args)
 

Typedef Documentation

◆ basic_printf_context_t

template<typename Char >
using basic_printf_context_t

◆ printf_args

Definition at line 570 of file printf.h.

◆ printf_context

Definition at line 567 of file printf.h.

◆ wprintf_args

Definition at line 571 of file printf.h.

◆ wprintf_context

Definition at line 568 of file printf.h.

Function Documentation

◆ fprintf() [1/2]

template<typename S , typename... Args, typename Char = char_t<S>>
int fprintf ( std::basic_ostream< Char > & os,
const S & format_str,
const Args &... args )

\rst Prints formatted data to the stream os.

Example**::

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

Definition at line 703 of file printf.h.

References to_string_view(), and vfprintf().

◆ fprintf() [2/2]

template<typename S , typename... Args, typename Char = enable_if_t<internal::is_string<S>::value, char_t<S>>>
int fprintf ( std::FILE * f,
const S & format,
const Args &... args )

\rst Prints formatted data to the file f.

Example**::

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

Definition at line 643 of file printf.h.

References format(), to_string_view(), and vfprintf().

◆ make_printf_args()

template<typename... Args>
format_arg_store< printf_context, Args... > make_printf_args ( const Args &... args)

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

Definition at line 580 of file printf.h.

◆ make_wprintf_args()

template<typename... Args>
format_arg_store< wprintf_context, Args... > make_wprintf_args ( const Args &... args)

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

Definition at line 592 of file printf.h.

◆ printf()

template<typename S , typename... Args, FMT_ENABLE_IF(internal::is_string< S >::value) >
int printf ( const S & format_str,
const Args &... args )

\rst Prints formatted data to stdout.

Example**::

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

Definition at line 666 of file printf.h.

References to_string_view(), and vprintf().

Referenced by StableSum< double >::operator double(), vfprintf(), vfprintf(), and vsprintf().

◆ sprintf()

template<typename S , typename... Args, typename Char = enable_if_t<internal::is_string<S>::value, char_t<S>>>
std::basic_string< Char > sprintf ( const S & format,
const Args &... args )

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

Example**::

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

Definition at line 616 of file printf.h.

References format(), to_string_view(), and vsprintf().

◆ vfprintf() [1/2]

template<typename S , typename Char = char_t<S>>
int vfprintf ( std::basic_ostream< Char > & os,
const S & format,
basic_format_args< basic_printf_context_t< Char > > args )

Definition at line 673 of file printf.h.

References format(), printf(), buffer< T >::size(), to_string_view(), and internal::write().

◆ vfprintf() [2/2]

template<typename S , typename Char = char_t<S>>
int vfprintf ( std::FILE * f,
const S & format,
basic_format_args< basic_printf_context_t< Char > > args )

Definition at line 622 of file printf.h.

References buffer< T >::data(), format(), printf(), buffer< T >::size(), and to_string_view().

Referenced by fprintf(), fprintf(), and vprintf().

◆ vprintf() [1/2]

template<typename S , typename Char = char_t<S>>
int vprintf ( const S & format,
basic_format_args< basic_printf_context_t< Char > > args )

Definition at line 650 of file printf.h.

References format(), to_string_view(), and vfprintf().

Referenced by printf().

◆ vprintf() [2/2]

template<typename ArgFormatter , typename Char , typename Context = basic_printf_context<typename ArgFormatter::iterator, Char>>
ArgFormatter::iterator vprintf ( internal::buffer< Char > & out,
basic_string_view< Char > format_str,
basic_format_args< Context > args )

Formats arguments and writes the output to the range.

Definition at line 685 of file printf.h.

◆ vsprintf()

template<typename S , typename Char = char_t<S>>
std::basic_string< Char > vsprintf ( const S & format,
basic_format_args< basic_printf_context_t< Char > > args )

Definition at line 598 of file printf.h.

References format(), printf(), to_string(), and to_string_view().

Referenced by sprintf().