Loading...
Searching...
No Matches
core.h File Reference #include <cstdio> #include <cstring> #include <functional> #include <iterator> #include <memory> #include <string> #include <type_traits> #include <vector> Go to the source code of this file.
Macro Definition Documentation◆ FMT_API◆ FMT_ASSERT
Value:
((condition) /* void() fails with -Winvalid-constexpr on clang 4.0.1 */ \
? (void)0 \
: ::fmt::detail::assert_fail(__FILE__, __LINE__, (message)))
Definition at line 292 of file core.h. Referenced by cache_accessor< double >::compute_mul_parity(), cache_accessor< float >::compute_mul_parity(), detail::dragonbox::divisible_by_power_of_2(), detail::dragonbox::divisible_by_power_of_2(), detail::dragonbox::divisible_by_power_of_5(), detail::dragonbox::divisible_by_power_of_5(), bigint::divmod_assign(), detail::dragonbox::floor_log10_pow2(), detail::dragonbox::floor_log10_pow2_minus_log10_4_over_3(), detail::dragonbox::floor_log2_pow10(), detail::format_decimal(), detail::format_float(), text_style::get_background(), cache_accessor< double >::get_cached_power(), cache_accessor< float >::get_cached_power(), text_style::get_emphasis(), text_style::get_foreground(), detail::get_round_direction(), detail::grisu_gen_digits(), fixed_handler::on_digit(), arg_formatter_base< OutputIt, Char, ErrorHandler >::operator()(), arg_formatter_base< OutputIt, Char, ErrorHandler >::operator()(), bigint::operator*=(), basic_memory_buffer< T, SIZE, Allocator >::operator=(), formatter< T, Char, enable_if_t< detail::type_constant< T, Char >::value !=detail::type::custom_type > >::parse(), detail::parse_align(), detail::parse_arg_id(), detail::parse_nonnegative_int(), detail::parse_width(), dynamic_format_arg_store< Context >::reserve(), detail::safe_strerror(), detail::dragonbox::small_division_by_pow10(), detail::snprintf_float(), bigint::subtract_aligned(), detail::to_nonnegative_int(), detail::to_unsigned(), detail::write(), and detail::write_exponent(). ◆ FMT_BEGIN_NAMESPACE
Value:
namespace fmt { \
FMT_INLINE_NAMESPACE v7 {
◆ FMT_BUFFER_CONTEXT
◆ FMT_CLANG_VERSION◆ FMT_CLASS_API◆ FMT_CONSTEXPR
Definition at line 98 of file core.h. Referenced by detail::compile_to_parts(), and detail::parse_format_string(). ◆ FMT_CONSTEXPR_DECL
Definition at line 99 of file core.h. Referenced by detail::check_format_string(), and compiled_format_base< S, enable_if_t< is_compile_string< S >::value > >::parts(). ◆ FMT_DEPRECATED◆ FMT_DEPRECATED_ALIAS
◆ FMT_DETECTED_NOEXCEPT◆ FMT_ENABLE_IF
◆ FMT_END_NAMESPACE◆ FMT_EXCEPTIONS◆ FMT_EXTERN◆ FMT_EXTERN_TEMPLATE_API◆ FMT_GCC_VERSION◆ FMT_HAS_CPP14_ATTRIBUTE
◆ FMT_HAS_CPP17_ATTRIBUTE
◆ FMT_HAS_CPP_ATTRIBUTE◆ FMT_HAS_CXX11_NOEXCEPT◆ FMT_HAS_FEATURE◆ FMT_HAS_GXX_CXX11◆ FMT_HAS_INCLUDE◆ FMT_ICC_VERSION◆ FMT_INLINE◆ FMT_INLINE_NAMESPACE◆ FMT_INSTANTIATION_DEF_API◆ FMT_MSC_VER◆ FMT_NOEXCEPT◆ FMT_NORETURN◆ FMT_NVCC◆ FMT_OVERRIDE◆ FMT_SUPPRESS_MSC_WARNING◆ FMT_TYPE_CONSTANT
◆ FMT_UNICODE
Definition at line 249 of file core.h. Referenced by detail::is_unicode(). ◆ FMT_USE_CONSTEXPR
Value:
(FMT_HAS_FEATURE(cxx_relaxed_constexpr) || FMT_MSC_VER >= 1910 || \
(FMT_GCC_VERSION >= 600 && __cplusplus >= 201402L)) && \
!FMT_NVCC && !FMT_ICC_VERSION
◆ FMT_USE_INLINE_NAMESPACES◆ FMT_USE_INT128◆ FMT_USE_NOEXCEPT◆ FMT_VERSIONTypedef Documentation◆ bool_constant
template<bool B>
◆ buffer_context
template<typename Char >
Initial value:
Definition core.h:1490 ◆ char_t
template<typename S >
◆ conditional_t
template<bool B, class T , class F >
◆ enable_if_t
template<bool B, class T = void>
◆ format_context
◆ format_parse_context
◆ has_formatter
template<typename T , typename Context >
◆ remove_const_t
template<typename T >
◆ remove_cvref_t
template<typename T >
◆ remove_reference_t
template<typename T >
◆ string_view
◆ type_identity_t
template<typename T >
◆ wformat_context
◆ wformat_parse_context
◆ wstring_view
Function Documentation◆ arg()
template<typename Char , typename T >
\rst Returns a named argument to be used in a formatting function. It should only be used in a call to a formatting function. Example**:: fmt::print("Elapsed time: {s:.2f} seconds", fmt::arg("s", 1.23)); \endrst Definition at line 1640 of file core.h. References arg(). Referenced by arg(), detail::convert_arg(), dynamic_format_arg_store< Context >::emplace_arg(), dynamic_format_arg_store< Context >::emplace_arg(), basic_printf_context< OutputIt, Char >::format(), formatter< tuple_arg_join< Char, T... >, Char >::format_args(), value< Context >::format_custom_arg(), basic_format_args< Context >::get(), detail::get_arg(), detail::get_dynamic_spec(), detail::init_named_args(), detail::make_arg(), format_handler< OutputIt, Char, Context >::on_format_specs(), format_handler< OutputIt, Char, Context >::on_replacement_field(), dynamic_arg_list::push(), dynamic_format_arg_store< Context >::push_back(), dynamic_format_arg_store< Context >::push_back(), dynamic_format_arg_store< Context >::push_back(), detail::vformat(), detail::cf::vformat_to(), and visit_format_arg(). ◆ format()
template<typename S , typename... Args, typename Char = char_t<S>>
\rst Formats arguments and returns the result as a string. Example**:: #include <fmt/core.h> std::string message = fmt::format("The answer is {}", 42); \endrst Definition at line 2074 of file core.h. References to_string_view(), and detail::vformat(). Referenced by formatter< tuple_arg_join< Char, T... >, Char >::format(). ◆ format_to()
template<typename OutputIt , typename S , typename... Args, bool enable = detail::is_output_iterator<OutputIt, char_t<S>>::value>
\rst Formats arguments, writes the result to the output iterator Example**:: std::vector<char> out; fmt::format_to(std::back_inserter(out), "{}", 42); \endrst Definition at line 2002 of file core.h. References to_string_view(), and vformat_to(). Referenced by formatter< detail::bigint >::format(), and formatter< T, Char, enable_if_t< fmt::is_range< T, Char >::value &&(has_formatter< detail::value_type< T >, format_context >::value||detail::has_fallback_formatter< detail::value_type< T >, format_context >::value) > >::format(). ◆ format_to_n()
template<typename OutputIt , typename S , typename... Args, bool enable = detail::is_output_iterator<OutputIt, char_t<S>>::value>
\rst Formats arguments, writes up to Definition at line 2035 of file core.h. References to_string_view(), and vformat_to_n(). ◆ formatted_size()
template<typename... Args>
Returns the number of characters in the output of Definition at line 2047 of file core.h. References counting_buffer< T >::count(), and detail::vformat_to(). ◆ make_args_checked()
template<typename... Args, typename S , typename Char = char_t<S>>
\rst Constructs a Definition at line 1617 of file core.h. References detail::check_format_string(), and detail::count(). ◆ make_format_args()
template<typename Context = format_context, typename... Args>
\rst Constructs a Definition at line 1603 of file core.h. Referenced by format(), format_to(), fprintf(), fprintf(), buffered_file::print(), printf(), sprintf(), and system_error::system_error(). ◆ print() [1/2]
template<typename S , typename... Args, typename Char = char_t<S>>
\rst Formats Example**:: fmt::print("Elapsed time: {0:.2f} seconds", 1.23); \endrst Definition at line 2113 of file core.h. References detail::is_unicode(), to_string_view(), vprint(), and detail::vprint_mojibake(). ◆ print() [2/2]
template<typename S , typename... Args, typename Char = char_t<S>>
\rst Formats Example**:: fmt::print(stderr, "Don't {}!", "panic"); \endrst Definition at line 2094 of file core.h. References detail::is_unicode(), to_string_view(), vprint(), and detail::vprint_mojibake(). ◆ to_string_view() [1/5]
template<typename Char >
◆ to_string_view() [2/5]
template<typename Char , FMT_ENABLE_IF(is_char< Char >::value) >
\rst Returns a string view of 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); \endrst Definition at line 468 of file core.h. Referenced by detail::check_format_string(), format(), format(), format(), format_to(), format_to(), format_to(), format_to(), format_to_n(), fprintf(), fprintf(), print(), print(), print(), printf(), sprintf(), vformat(), vformat(), vformat(), vformat_to(), vformat_to(), vformat_to(), vfprintf(), vfprintf(), vprint(), vprintf(), and vsprintf(). ◆ to_string_view() [3/5]
template<typename S , FMT_ENABLE_IF(is_compile_string< S >::value) >
◆ to_string_view() [4/5]
template<typename Char , typename Traits , typename Alloc >
◆ to_string_view() [5/5]
template<typename Char , FMT_ENABLE_IF(!std::is_empty< detail::std_string_view< Char > >::value) >
◆ vformat()
template<typename S , typename Char = char_t<S>>
Definition at line 2055 of file core.h. References to_string_view(), and detail::vformat(). ◆ vformat_to()
template<typename OutputIt , typename S , typename Char = char_t<S>, bool enable = detail::is_output_iterator<OutputIt, Char>::value>
Formats a string and writes the output to Definition at line 1980 of file core.h. References detail::get_buffer(), detail::get_buffer_init(), detail::get_iterator(), to_string_view(), and detail::vformat_to(). Referenced by format_to(). ◆ vformat_to_n()
template<typename OutputIt , typename Char , typename... Args, FMT_ENABLE_IF(detail::is_output_iterator< OutputIt, Char >::value) >
Definition at line 2017 of file core.h. References iterator_buffer< OutputIt, T, Traits >::count(), iterator_buffer< OutputIt, T, Traits >::out(), and detail::vformat_to(). Referenced by format_to_n(). ◆ visit_format_arg()
template<typename Visitor , typename Context >
\rst Visits an argument dispatching to the appropriate visit method based on the argument type. For example, if the argument type is Definition at line 1310 of file core.h. References arg(), detail::bool_type, detail::char_type, detail::cstring_type, detail::custom_type, detail::double_type, detail::float_type, detail::int128_type, detail::int_type, detail::long_double_type, detail::long_long_type, detail::none_type, detail::pointer_type, detail::string_type, detail::uint128_type, detail::uint_type, and detail::ulong_long_type. Referenced by detail::convert_arg(), basic_printf_context< OutputIt, Char >::format(), dynamic_formatter< Char >::format(), formatter< T, Char, enable_if_t< detail::type_constant< T, Char >::value !=detail::type::custom_type > >::format(), detail::format_arg(), detail::get_dynamic_spec(), format_handler< OutputIt, Char, Context >::on_format_specs(), format_handler< OutputIt, Char, Context >::on_replacement_field(), basic_printf_context< OutputIt, Char >::parse_header(), detail::vformat(), and detail::cf::vformat_to(). ◆ vprint() [1/2]
Definition at line 2764 of file format-inl.h. References utf8_to_utf16::c_str(), buffer< T >::data(), FMT_THROW, detail::fwrite_fully(), buffer< T >::size(), utf8_to_utf16::size(), and detail::vformat_to(). ◆ vprint() [2/2]
Definition at line 2795 of file format-inl.h. References vprint().
|