Classes | Namespaces | Typedefs | Functions | Variables
printf.h File Reference
#include <algorithm>
#include <limits>
#include "ostream.h"

Go to the source code of this file.

Classes

class  internal::null_terminating_iterator< Char >
 
struct  internal::int_checker< IsSigned >
 
struct  internal::int_checker< true >
 
class  internal::printf_precision_handler
 
class  internal::is_zero_int
 
struct  internal::make_unsigned_or_bool< T >
 
struct  internal::make_unsigned_or_bool< bool >
 
class  internal::arg_converter< T, Context >
 
class  internal::char_converter< Context >
 
class  internal::printf_width_handler< Char >
 
class  printf_arg_formatter< Range >
 
class  basic_printf_context< OutputIt, Char, ArgFormatter >
 
class  printf_arg_formatter< Range >
 
struct  printf_formatter< T >
 
class  basic_printf_context< OutputIt, Char, ArgFormatter >
 
struct  basic_printf_context< OutputIt, Char, ArgFormatter >::formatter_type< T >
 
struct  basic_printf_context_t< Buffer >
 

Namespaces

 internal
 

Typedefs

typedef basic_printf_context_t< internal::buffer >::type printf_context
 
typedef basic_printf_context_t< internal::wbuffer >::type wprintf_context
 
typedef basic_format_args< printf_contextprintf_args
 
typedef basic_format_args< wprintf_contextwprintf_args
 
typedef internal::basic_buffer< FMT_CHAR(S)> buffer
 
typedef basic_printf_context_t< buffer >::type context
 

Functions

template<typename T >
FMT_CONSTEXPR const T * internal::pointer_from (const T *p)
 
template<typename Char >
FMT_CONSTEXPR const Char * internal::pointer_from (null_terminating_iterator< Char > it)
 
template<typename Iterator , typename ErrorHandler >
FMT_CONSTEXPR unsigned internal::parse_nonnegative_int (Iterator &it, ErrorHandler &&eh)
 
template<typename T , typename Context , typename Char >
void internal::convert_arg (basic_format_arg< Context > &arg, Char type)
 
template<typename Char , typename Context >
void internal::printf (basic_buffer< Char > &buf, 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 = FMT_CHAR(S)>
std::basic_string< Char > vsprintf (const S &format, basic_format_args< typename basic_printf_context_t< internal::basic_buffer< Char >>::type > args)
 
template<typename S , typename... Args>
 FMT_ENABLE_IF_T (internal::is_string< S >::value, std::basic_string< FMT_CHAR(S)>) sprintf(const S &format
 
return vsprintf (to_string_view(format), basic_format_args< context >(as))
 
template<typename S , typename Char = FMT_CHAR(S)>
int vfprintf (std::FILE *f, const S &format, basic_format_args< typename basic_printf_context_t< internal::basic_buffer< Char >>::type > args)
 
template<typename S , typename... Args>
 FMT_ENABLE_IF_T (internal::is_string< S >::value, int) fprintf(std
 
template<typename S , typename Char = FMT_CHAR(S)>
int vprintf (const S &format, basic_format_args< typename basic_printf_context_t< internal::basic_buffer< Char >>::type > args)
 
return vprintf (to_string_view(format_str), basic_format_args< context >(as))
 
template<typename S , typename Char = FMT_CHAR(S)>
int vfprintf (std::basic_ostream< Char > &os, const S &format, basic_format_args< typename basic_printf_context_t< internal::basic_buffer< Char >>::type > args)
 

Variables

const Args & args
 
format_arg_store< context, Args... > as { args... }
 

Typedef Documentation

Definition at line 757 of file printf.h.

Definition at line 758 of file printf.h.

Definition at line 710 of file printf.h.

Definition at line 707 of file printf.h.

Definition at line 711 of file printf.h.

Definition at line 708 of file printf.h.

Function Documentation

template<typename S , typename... Args>
FMT_ENABLE_IF_T ( internal::is_string< S >::value  ,
std::basic_string< FMT_CHAR(S)>   
) const
inline

Formats arguments and returns the result as a string.

Example**::

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

template<typename S , typename... Args>
FMT_ENABLE_IF_T ( internal::is_string< S >::value  ,
int   
)
inline

Prints formatted data to the file f.

Example**::

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

Prints formatted data to stdout.

Example**::

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

Prints formatted data to the stream os.

Example**::

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

Definition at line 785 of file printf.h.

786  {
790  format_arg_store<context, Args...> as{ args... };
791  return vfprintf(f, to_string_view(format),
793 }
basic_printf_context_t< buffer >::type context
Definition: printf.h:758
std::enable_if<!is_compile_string< S >::value >::type check_format_string(const S &)
Definition: core.h:1352
internal::basic_buffer< FMT_CHAR(S)> buffer
Definition: printf.h:757
string_view_t & to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
Definition: common.h:132
int vfprintf(std::FILE *f, const S &format, basic_format_args< typename basic_printf_context_t< internal::basic_buffer< Char >>::type > args)
Definition: printf.h:765
const Args & args
Definition: printf.h:755
format_arg_store< context, Args... > as
Definition: printf.h:759
template<typename... Args>
format_arg_store<printf_context, Args...> make_printf_args ( const Args &...  args)
inline

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

Definition at line 721 of file printf.h.

721 { return {args...}; }
const Args & args
Definition: printf.h:755
template<typename... Args>
format_arg_store<wprintf_context, Args...> make_wprintf_args ( const Args &...  args)
inline

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

Definition at line 731 of file printf.h.

731 { return {args...}; }
const Args & args
Definition: printf.h:755
template<typename S , typename Char = FMT_CHAR(S)>
int vfprintf ( std::FILE *  f,
const S format,
basic_format_args< typename basic_printf_context_t< internal::basic_buffer< Char >>::type args 
)
inline

Definition at line 765 of file printf.h.

767  {
769  printf(buffer, to_string_view(format), args);
770  std::size_t size = buffer.size();
771  return std::fwrite(
772  buffer.data(), sizeof(Char), size, f) < size ? -1 : static_cast<int>(size);
773 }
void printf(basic_buffer< Char > &buf, basic_string_view< Char > format, basic_format_args< Context > args)
Definition: printf.h:321
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:87
T * data() FMT_NOEXCEPT
Definition: core.h:256
internal::basic_buffer< FMT_CHAR(S)> buffer
Definition: printf.h:757
std::size_t size() const FMT_NOEXCEPT
Definition: core.h:250
string_view_t & to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
Definition: common.h:132
template<typename S , typename Char = FMT_CHAR(S)>
int vfprintf ( std::basic_ostream< Char > &  os,
const S format,
basic_format_args< typename basic_printf_context_t< internal::basic_buffer< Char >>::type args 
)
inline

Definition at line 823 of file printf.h.

826  {
828  printf(buffer, to_string_view(format), args);
829  internal::write(os, buffer);
830  return static_cast<int>(buffer.size());
831 }
void printf(basic_buffer< Char > &buf, basic_string_view< Char > format, basic_format_args< Context > args)
Definition: printf.h:321
void write(std::basic_ostream< Char > &os, basic_buffer< Char > &buf)
Definition: ostream.h:76
internal::basic_buffer< FMT_CHAR(S)> buffer
Definition: printf.h:757
std::size_t size() const FMT_NOEXCEPT
Definition: core.h:250
string_view_t & to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
Definition: common.h:132
template<typename S , typename Char = FMT_CHAR(S)>
int vprintf ( const S format,
basic_format_args< typename basic_printf_context_t< internal::basic_buffer< Char >>::type args 
)
inline

Definition at line 796 of file printf.h.

798  {
799  return vfprintf(stdout, to_string_view(format), args);
800 }
string_view_t & to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
Definition: common.h:132
int vfprintf(std::FILE *f, const S &format, basic_format_args< typename basic_printf_context_t< internal::basic_buffer< Char >>::type > args)
Definition: printf.h:765
template<typename S , typename Char = FMT_CHAR(S)>
std::basic_string<Char> vsprintf ( const S format,
basic_format_args< typename basic_printf_context_t< internal::basic_buffer< Char >>::type args 
)
inline

Definition at line 735 of file printf.h.

737  {
739  printf(buffer, to_string_view(format), args);
740  return to_string(buffer);
741 }
void printf(basic_buffer< Char > &buf, basic_string_view< Char > format, basic_format_args< Context > args)
Definition: printf.h:321
internal::basic_buffer< FMT_CHAR(S)> buffer
Definition: printf.h:757
string_view_t & to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
Definition: common.h:132
std::string to_string(ModuleType const mt)
Definition: ModuleType.h:34
return vsprintf ( to_string_view(format ,
basic_format_args< context as 
)

Variable Documentation

const Args& args
Initial value:
{
std::enable_if<!is_compile_string< S >::value >::type check_format_string(const S &)
Definition: core.h:1352

Definition at line 755 of file printf.h.

format_arg_store<context, Args...> as { args... }

Definition at line 759 of file printf.h.