HDK
|
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <string>
#include <type_traits>
Go to the source code of this file.
Namespaces | |
internal | |
Typedefs | |
typedef basic_buffer< char > | internal::buffer |
typedef basic_buffer< wchar_t > | internal::wbuffer |
typedef basic_string_view< char > | string_view |
typedef basic_string_view < wchar_t > | wstring_view |
typedef std::conditional < sizeof(long)==sizeof(int), int, long long >::type | internal::long_type |
typedef basic_parse_context< char > | format_parse_context |
typedef basic_parse_context < wchar_t > | wformat_parse_context |
typedef basic_parse_context< char > | parse_context |
typedef basic_parse_context < wchar_t > | wparse_context |
typedef buffer_context< char > ::type | format_context |
typedef buffer_context < wchar_t >::type | wformat_context |
Enumerations | |
enum | internal::type { internal::none_type, internal::named_arg_type, internal::int_type, internal::uint_type, internal::long_long_type, internal::ulong_long_type, internal::bool_type, internal::char_type, internal::last_integer_type = char_type, internal::double_type, internal::long_double_type, internal::last_numeric_type = long_double_type, internal::cstring_type, internal::string_type, internal::pointer_type, internal::custom_type } |
enum | { internal::max_packed_args = 15 } |
Functions | |
template<typename T > | |
std::add_rvalue_reference< T > ::type | internal::declval () FMT_NOEXCEPT |
template<typename Int > | |
FMT_CONSTEXPR std::make_unsigned< Int > ::type | internal::to_unsigned (Int value) |
template<typename Container > | |
Container & | internal::get_container (std::back_insert_iterator< Container > it) |
template<typename Char > | |
basic_string_view< Char > | to_string_view (basic_string_view< Char > s) |
template<typename Char > | |
basic_string_view< Char > | to_string_view (const std::basic_string< Char > &s) |
template<typename Char > | |
basic_string_view< Char > | to_string_view (const Char *s) |
template<typename S , typename Enable = typename std::enable_if<is_compile_string<S>::value>::type> | |
FMT_CONSTEXPR basic_string_view< typename S::char_type > | to_string_view (const S &s) |
dummy_string_view | internal::to_string_view (...) |
FMT_CONSTEXPR bool | internal::is_integral (type t) |
FMT_CONSTEXPR bool | internal::is_arithmetic (type t) |
template<typename Context , typename T > | |
FMT_CONSTEXPR basic_format_arg < Context > | internal::make_arg (const T &value) |
FMT_MAKE_VALUE((sizeof(long)==sizeof(int)?int_type:long_long_type), long, long_type) typedef std | internal::FMT_MAKE_VALUE ((sizeof(unsigned long)==sizeof(unsigned)?uint_type:ulong_long_type), unsigned long, ulong_type) template< typename C |
FMT_MAKE_VALUE((sizeof(long)==sizeof(int)?int_type:long_long_type), long, long_type) typedef std Char FMT_CONSTEXPR std::enable_if< std::is_same < typename C::char_type, Char > ::value, init< C, int, char_type > >::type | internal::make_value (Char val) |
template<typename C > | |
FMT_CONSTEXPR std::enable_if < !std::is_same< typename C::char_type, char >::value, init< C, int, char_type > >::type | internal::make_value (char val) |
internal::FMT_MAKE_VALUE (cstring_type, typename C::char_type *, const typename C::char_type *) FMT_MAKE_VALUE(cstring_type | |
const C::char_type const C::char_type * | internal::FMT_MAKE_VALUE (string_type, typename basic_string_view< typename C::char_type >::type, basic_string_view< typename C::char_type >) FMT_MAKE_VALUE(string_type |
template<typename C , typename T > | |
const C::char_type const C::char_type const std::basic_string< typename C::char_type > basic_string_view< typename C::char_type > std::enable_if <!std::is_same< T, typename C::char_type >::value >::type | internal::make_value (const T *) |
template<typename C , typename T > | |
std::enable_if< std::is_enum < T >::value &&convert_to_int < T, typename C::char_type > ::value, init< C, int, int_type > >::type | internal::make_value (const T &val) |
template<typename C , typename T , typename Char = typename C::char_type> | |
std::enable_if < is_constructible < basic_string_view< Char >, T > ::value &&!internal::is_string < T >::value, init< C, basic_string_view< Char > , string_type > >::type | internal::make_value (const T &val) |
template<typename C , typename T , typename Char = typename C::char_type> | |
std::enable_if < !convert_to_int< T, Char > ::value &&!std::is_same< T, Char >::value &&!std::is_convertible< T, basic_string_view< Char > >::value &&!is_constructible < basic_string_view< Char >, T > ::value &&!internal::is_string < T >::value, init< C, const T &, custom_type > >::type | internal::make_value (const T &val) |
template<typename C , typename T > | |
init< C, const void *, named_arg_type > | internal::make_value (const named_arg< T, typename C::char_type > &val) |
template<typename C , typename S > | |
FMT_CONSTEXPR11 std::enable_if < internal::is_string< S > ::value, init< C, basic_string_view< typename C::char_type >, string_type > >::type | internal::make_value (const S &val) |
template<typename Visitor , typename Context > | |
FMT_CONSTEXPR internal::result_of< Visitor(int)> ::type | visit_format_arg (Visitor &&vis, const basic_format_arg< Context > &arg) |
template<typename Visitor , typename Context > | |
FMT_CONSTEXPR internal::result_of< Visitor(int)> ::type | visit (Visitor &&vis, const basic_format_arg< Context > &arg) |
template<typename Context > | |
FMT_CONSTEXPR11 unsigned long long | internal::get_types () |
template<typename Context , typename Arg , typename... Args> | |
FMT_CONSTEXPR11 unsigned long long | internal::get_types () |
template<bool IS_PACKED, typename Context , typename T > | |
std::enable_if< IS_PACKED, value< Context > >::type | internal::make_arg (const T &value) |
template<bool IS_PACKED, typename Context , typename T > | |
std::enable_if<!IS_PACKED, basic_format_arg< Context > >::type | internal::make_arg (const T &value) |
template<typename Context = format_context, typename... Args> | |
format_arg_store< Context, Args...> | make_format_args (const Args &...args) |
template<typename... Args, typename S > | |
std::enable_if <!is_compile_string< S > ::value >::type | internal::check_format_string (const S &) |
template<typename... Args, typename S > | |
std::enable_if < is_compile_string< S > ::value >::type | internal::check_format_string (S) |
template<typename Char > | |
std::basic_string< Char > | internal::vformat (basic_string_view< Char > format_str, basic_format_args< typename buffer_context< Char >::type > args) |
template<typename Char > | |
buffer_context< Char > ::type::iterator | internal::vformat_to (internal::basic_buffer< Char > &buf, basic_string_view< Char > format_str, basic_format_args< typename buffer_context< Char >::type > args) |
template<typename T > | |
internal::named_arg< T, char > | arg (string_view name, const T &arg) |
template<typename T > | |
internal::named_arg< T, wchar_t > | arg (wstring_view name, const T &arg) |
template<typename S , typename T , typename Char > | |
void | arg (S, internal::named_arg< T, Char >)=delete |
template<typename Container , typename S > | |
std::enable_if< is_contiguous < Container >::value, std::back_insert_iterator < Container > >::type | vformat_to (std::back_insert_iterator< Container > out, const S &format_str, basic_format_args< typename buffer_context< FMT_CHAR(S)>::type > args) |
template<typename Container , typename S , typename... Args> | |
std::enable_if< is_contiguous < Container >::value &&internal::is_string< S > ::value, std::back_insert_iterator < Container > >::type | format_to (std::back_insert_iterator< Container > out, const S &format_str, const Args &...args) |
template<typename S , typename Char = FMT_CHAR(S)> | |
std::basic_string< Char > | vformat (const S &format_str, basic_format_args< typename buffer_context< Char >::type > args) |
template<typename S , typename... Args> | |
std::basic_string< FMT_CHAR(S)> | format (const S &format_str, const Args &...args) |
FMT_API void | vprint (std::FILE *f, string_view format_str, format_args args) |
FMT_API void | vprint (std::FILE *f, wstring_view format_str, wformat_args args) |
template<typename S , typename... Args> | |
FMT_ENABLE_IF_STRING (S, void) print(std | |
FMT_API void | vprint (string_view format_str, format_args args) |
FMT_API void | vprint (wstring_view format_str, wformat_args args) |
const Args &args | vprint (to_string_view(format_str), internal::checked_args< S, Args...>(format_str, args...)) |
#define FMT_BEGIN_NAMESPACE namespace fmt { FMT_INLINE_NAMESPACE v5 { |
#define FMT_ENABLE_IF_STRING | ( | S, | |
T | |||
) | typename std::enable_if<internal::is_string<S>::value, T>::type |
#define FMT_MAKE_VALUE | ( | TAG, | |
ArgType, | |||
ValueType | |||
) |
#define FMT_MAKE_VALUE_SAME | ( | TAG, | |
Type | |||
) |
#define FMT_NOEXCEPT FMT_DETECTED_NOEXCEPT |
#define FMT_USE_ALIAS_TEMPLATES FMT_HAS_FEATURE(cxx_alias_templates) |
#define FMT_USE_CONSTEXPR |
#define FMT_USE_CONSTEXPR11 (FMT_USE_CONSTEXPR || FMT_GCC_VERSION >= 406 || FMT_MSC_VER >= 1900) |
typedef buffer_context<char>::type format_context |
typedef basic_parse_context<char> format_parse_context |
typedef basic_parse_context<char> parse_context |
typedef basic_string_view<char> string_view |
typedef buffer_context<wchar_t>::type wformat_context |
typedef basic_parse_context<wchar_t> wformat_parse_context |
typedef basic_parse_context<wchar_t> wparse_context |
typedef basic_string_view<wchar_t> wstring_view |
|
inline |
|
inline |
|
delete |
|
inline |
Prints formatted data to the file f. For wide format strings, f* should be in wide-oriented mode set via fwide(f, 1)
or _setmode(_fileno(f), _O_U8TEXT)
on Windows.
Example**::
fmt::print(stderr, "Don't {}!", "panic");
Prints formatted data to stdout
.
Example**::
fmt::print("Elapsed time: {0:.2f} seconds", 1.23);
|
inline |
|
inline |
Constructs an ~fmtformat_arg_store
object that contains references to arguments and can be implicitly converted to ~fmtformat_args
. Context
can be omitted in which case it defaults to ~fmtcontext
.
|
inline |
The function to_string_view
adapts non-intrusively any kind of string or string-like type if the user provides a (possibly templated) overload of to_string_view
which takes an instance of the string class StringType<Char>
and returns a fmt::basic_string_view<Char>
. The conversion function must live in the very same namespace as StringType<Char>
to be picked up by ADL. Non-templated string types like f.e. QString must return a basic_string_view
with a fixed matching char type.
Example**::
namespace my_ns { inline string_view to_string_view(const my_string &s) { return { s.data(), s.length() }; } }
std::string message = fmt::format(my_string("The answer is {}"), 42);
|
inline |
|
inline |
FMT_CONSTEXPR basic_string_view<typename S::char_type> to_string_view | ( | const S & | s | ) |
|
inline |
std::enable_if< is_contiguous<Container>::value, std::back_insert_iterator<Container> >::type vformat_to | ( | std::back_insert_iterator< Container > | out, |
const S & | format_str, | ||
basic_format_args< typename buffer_context< FMT_CHAR(S)>::type > | args | ||
) |
FMT_CONSTEXPR internal::result_of<Visitor(int)>::type visit | ( | Visitor && | vis, |
const basic_format_arg< Context > & | arg | ||
) |
FMT_CONSTEXPR internal::result_of<Visitor(int)>::type visit_format_arg | ( | Visitor && | vis, |
const basic_format_arg< Context > & | arg | ||
) |
FMT_API void vprint | ( | std::FILE * | f, |
string_view | format_str, | ||
format_args | args | ||
) |
Definition at line 944 of file format-inl.h.
FMT_API void vprint | ( | std::FILE * | f, |
wstring_view | format_str, | ||
wformat_args | args | ||
) |
Definition at line 951 of file format-inl.h.
FMT_API void vprint | ( | string_view | format_str, |
format_args | args | ||
) |
Definition at line 957 of file format-inl.h.
FMT_API void vprint | ( | wstring_view | format_str, |
wformat_args | args | ||
) |
Definition at line 961 of file format-inl.h.
const Args& args vprint | ( | to_string_view(format_str) | , |
internal::checked_args< S, Args...> | format_str, args... | ||
) |