Scippy

SoPlex

Sequential object-oriented simPlex

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

Namespaces

 internal
 

Typedefs

template<typename Char >
using basic_printf_context_t = basic_printf_context< std::back_insert_iterator< internal::buffer< 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 , 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

using basic_printf_context_t = basic_printf_context<std::back_insert_iterator<internal::buffer<Char> >, Char>

Definition at line 565 of file printf.h.

◆ 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]

int fprintf ( std::FILE *  f,
const S &  format,
const Args &...  args 
)

Prints formatted data to the file f.

Example**::

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

Definition at line 643 of file printf.h.

References internal::to_string_view(), and vfprintf().

◆ fprintf() [2/2]

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

Prints formatted data to the stream os.

Example**::

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

Definition at line 703 of file printf.h.

References FMT_END_NAMESPACE, internal::to_string_view(), and vfprintf().

◆ make_printf_args()

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

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

Definition at line 580 of file printf.h.

◆ make_wprintf_args()

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

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

Definition at line 592 of file printf.h.

◆ printf()

int printf ( const S &  format_str,
const Args &...  args 
)

Prints formatted data to stdout.

Example**::

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

Definition at line 666 of file printf.h.

References internal::to_string_view(), and vprintf().

Referenced by StableSum< double >::operator double().

◆ sprintf()

std::basic_string<Char> sprintf ( const S &  format,
const Args &...  args 
)

Formats arguments and returns the result as a string.

Example**::

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

Definition at line 616 of file printf.h.

References internal::to_string_view(), and vsprintf().

◆ vfprintf() [1/2]

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(), internal::printf(), buffer< T >::size(), and internal::to_string_view().

Referenced by fprintf(), and vprintf().

◆ vfprintf() [2/2]

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

◆ vprintf() [1/2]

int vprintf ( const S &  format,
basic_format_args< basic_printf_context_t< Char >>  args 
)

Definition at line 650 of file printf.h.

References FMT_ENABLE_IF, internal::to_string_view(), and vfprintf().

Referenced by printf().

◆ vprintf() [2/2]

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()

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 internal::printf(), to_string(), and internal::to_string_view().

Referenced by sprintf().