16 #include <type_traits> 19 #define FMT_VERSION 80000 22 # define FMT_CLANG_VERSION (__clang_major__ * 100 + __clang_minor__) 24 # define FMT_CLANG_VERSION 0 27 #if defined(__GNUC__) && !defined(__clang__) 28 # define FMT_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) 29 # define FMT_GCC_PRAGMA(arg) _Pragma(arg) 31 # define FMT_GCC_VERSION 0 32 # define FMT_GCC_PRAGMA(arg) 35 #if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) 36 # define FMT_HAS_GXX_CXX11 FMT_GCC_VERSION 38 # define FMT_HAS_GXX_CXX11 0 41 #if defined(__INTEL_COMPILER) 42 # define FMT_ICC_VERSION __INTEL_COMPILER 44 # define FMT_ICC_VERSION 0 48 # define FMT_NVCC __NVCC__ 54 # define FMT_MSC_VER _MSC_VER 55 # define FMT_MSC_WARNING(...) __pragma(warning(__VA_ARGS__)) 57 # define FMT_MSC_VER 0 58 # define FMT_MSC_WARNING(...) 62 # define FMT_HAS_FEATURE(x) __has_feature(x) 64 # define FMT_HAS_FEATURE(x) 0 67 #if defined(__has_include) && !defined(__INTELLISENSE__) && \ 68 (!FMT_ICC_VERSION || FMT_ICC_VERSION >= 1600) 69 # define FMT_HAS_INCLUDE(x) __has_include(x) 71 # define FMT_HAS_INCLUDE(x) 0 74 #ifdef __has_cpp_attribute 75 # define FMT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) 77 # define FMT_HAS_CPP_ATTRIBUTE(x) 0 80 #define FMT_HAS_CPP14_ATTRIBUTE(attribute) \ 81 (__cplusplus >= 201402L && FMT_HAS_CPP_ATTRIBUTE(attribute)) 83 #define FMT_HAS_CPP17_ATTRIBUTE(attribute) \ 84 (__cplusplus >= 201703L && FMT_HAS_CPP_ATTRIBUTE(attribute)) 88 #ifndef FMT_USE_CONSTEXPR 89 # define FMT_USE_CONSTEXPR \ 90 (FMT_HAS_FEATURE(cxx_relaxed_constexpr) || FMT_MSC_VER >= 1910 || \ 91 (FMT_GCC_VERSION >= 600 && __cplusplus >= 201402L)) && \ 92 !FMT_NVCC && !FMT_ICC_VERSION 95 # define FMT_CONSTEXPR constexpr 96 # define FMT_CONSTEXPR_DECL constexpr 98 # define FMT_CONSTEXPR 99 # define FMT_CONSTEXPR_DECL 103 #if defined(__GLIBCXX__) 104 # if __cplusplus >= 201703L && defined(_GLIBCXX_RELEASE) && \ 105 _GLIBCXX_RELEASE >= 7 // GCC 7+ libstdc++ has _GLIBCXX_RELEASE. 106 # define FMT_CONSTEXPR_CHAR_TRAITS constexpr 108 #elif defined(_LIBCPP_VERSION) && __cplusplus >= 201703L && \ 109 _LIBCPP_VERSION >= 4000 110 # define FMT_CONSTEXPR_CHAR_TRAITS constexpr 111 #elif FMT_MSC_VER >= 1914 && _MSVC_LANG >= 201703L 112 # define FMT_CONSTEXPR_CHAR_TRAITS constexpr 114 #ifndef FMT_CONSTEXPR_CHAR_TRAITS 115 # define FMT_CONSTEXPR_CHAR_TRAITS 119 # if FMT_HAS_FEATURE(cxx_override_control) || \ 120 (FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || FMT_MSC_VER >= 1900 121 # define FMT_OVERRIDE override 123 # define FMT_OVERRIDE 128 #ifndef FMT_EXCEPTIONS 129 # if (defined(__GNUC__) && !defined(__EXCEPTIONS)) || \ 130 FMT_MSC_VER && !_HAS_EXCEPTIONS 131 # define FMT_EXCEPTIONS 0 133 # define FMT_EXCEPTIONS 1 138 #ifndef FMT_USE_NOEXCEPT 139 # define FMT_USE_NOEXCEPT 0 142 #if FMT_USE_NOEXCEPT || FMT_HAS_FEATURE(cxx_noexcept) || \ 143 (FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || FMT_MSC_VER >= 1900 144 # define FMT_DETECTED_NOEXCEPT noexcept 145 # define FMT_HAS_CXX11_NOEXCEPT 1 147 # define FMT_DETECTED_NOEXCEPT throw() 148 # define FMT_HAS_CXX11_NOEXCEPT 0 152 # if FMT_EXCEPTIONS || FMT_HAS_CXX11_NOEXCEPT 153 # define FMT_NOEXCEPT FMT_DETECTED_NOEXCEPT 155 # define FMT_NOEXCEPT 161 #if FMT_EXCEPTIONS && FMT_HAS_CPP_ATTRIBUTE(noreturn) && !FMT_MSC_VER && \ 163 # define FMT_NORETURN [[noreturn]] 165 # define FMT_NORETURN 168 #ifndef FMT_MAYBE_UNUSED 169 # if FMT_HAS_CPP17_ATTRIBUTE(maybe_unused) 170 # define FMT_MAYBE_UNUSED [[maybe_unused]] 172 # define FMT_MAYBE_UNUSED 176 #if __cplusplus == 201103L || __cplusplus == 201402L 177 # if defined(__INTEL_COMPILER) || defined(__PGI) 178 # define FMT_FALLTHROUGH 179 # elif defined(__clang__) 180 # define FMT_FALLTHROUGH [[clang::fallthrough]] 181 # elif FMT_GCC_VERSION >= 700 && \ 182 (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 520) 183 # define FMT_FALLTHROUGH [[gnu::fallthrough]] 185 # define FMT_FALLTHROUGH 187 #elif FMT_HAS_CPP17_ATTRIBUTE(fallthrough) || \ 188 (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) 189 # define FMT_FALLTHROUGH [[fallthrough]] 191 # define FMT_FALLTHROUGH 194 #ifndef FMT_USE_FLOAT 195 # define FMT_USE_FLOAT 1 197 #ifndef FMT_USE_DOUBLE 198 # define FMT_USE_DOUBLE 1 200 #ifndef FMT_USE_LONG_DOUBLE 201 # define FMT_USE_LONG_DOUBLE 1 205 # if FMT_GCC_VERSION || FMT_CLANG_VERSION 206 # define FMT_INLINE inline __attribute__((always_inline)) 208 # define FMT_INLINE inline 212 #ifndef FMT_USE_INLINE_NAMESPACES 213 # if FMT_HAS_FEATURE(cxx_inline_namespaces) || FMT_GCC_VERSION >= 404 || \ 214 (FMT_MSC_VER >= 1900 && (!defined(_MANAGED) || !_MANAGED)) 215 # define FMT_USE_INLINE_NAMESPACES 1 217 # define FMT_USE_INLINE_NAMESPACES 0 221 #ifndef FMT_BEGIN_NAMESPACE 222 # if FMT_USE_INLINE_NAMESPACES 223 # define FMT_INLINE_NAMESPACE inline namespace 224 # define FMT_END_NAMESPACE \ 228 # define FMT_INLINE_NAMESPACE namespace 229 # define FMT_END_NAMESPACE \ 231 using namespace v7; \ 234 # define FMT_BEGIN_NAMESPACE \ 236 FMT_INLINE_NAMESPACE v7 { 239 #ifndef FMT_MODULE_EXPORT 240 # define FMT_MODULE_EXPORT 241 # define FMT_MODULE_EXPORT_BEGIN 242 # define FMT_MODULE_EXPORT_END 243 # define FMT_BEGIN_DETAIL_NAMESPACE namespace detail { 244 # define FMT_END_DETAIL_NAMESPACE } 247 #if !defined(FMT_HEADER_ONLY) && defined(_WIN32) 248 # define FMT_CLASS_API FMT_MSC_WARNING(suppress : 4275) 250 # define FMT_API __declspec(dllexport) 251 # elif defined(FMT_SHARED) 252 # define FMT_API __declspec(dllimport) 255 # define FMT_CLASS_API 256 # if defined(FMT_EXPORT) || defined(FMT_SHARED) 257 # if defined(__GNUC__) || defined(__clang__) 258 # define FMT_API __attribute__((visibility("default"))) 267 # define FMT_GCC_VISIBILITY_HIDDEN __attribute__((visibility("hidden"))) 269 # define FMT_GCC_VISIBILITY_HIDDEN 273 #if (FMT_HAS_INCLUDE(<string_view>) && \ 274 (__cplusplus > 201402L || defined(_LIBCPP_VERSION))) || \ 275 (defined(_MSVC_LANG) && _MSVC_LANG > 201402L && _MSC_VER >= 1910) 276 # include <string_view> 277 # define FMT_USE_STRING_VIEW 278 #elif FMT_HAS_INCLUDE("experimental/string_view") && __cplusplus >= 201402L 279 # include <experimental/string_view> 280 # define FMT_USE_EXPERIMENTAL_STRING_VIEW 284 # define FMT_UNICODE !FMT_MSC_VER 287 #ifndef FMT_CONSTEVAL 288 # if ((FMT_GCC_VERSION >= 1000 || FMT_CLANG_VERSION >= 1101) && \ 289 __cplusplus > 201703L) || \ 290 (defined(__cpp_consteval) && \ 291 !FMT_MSC_VER) // consteval is broken in MSVC. 292 # define FMT_CONSTEVAL consteval 293 # define FMT_HAS_CONSTEVAL 295 # define FMT_CONSTEVAL 299 #ifndef FMT_USE_NONTYPE_TEMPLATE_PARAMETERS 300 # if defined(__cpp_nontype_template_args) && \ 301 ((FMT_GCC_VERSION >= 903 && __cplusplus >= 201709L) || \ 302 __cpp_nontype_template_args >= 201911L) 303 # define FMT_USE_NONTYPE_TEMPLATE_PARAMETERS 1 305 # define FMT_USE_NONTYPE_TEMPLATE_PARAMETERS 0 319 template <
bool B,
class T =
void>
321 template <
bool B,
class T,
class F>
324 template <
typename T>
326 template <
typename T>
339 # define FMT_ENABLE_IF(...) 341 # define FMT_ENABLE_IF(...) enable_if_t<(__VA_ARGS__), int> = 0 347 #ifdef __cpp_lib_is_constant_evaluated 358 const char* message);
363 # define FMT_ASSERT(condition, message) ((void)0) 365 # define FMT_ASSERT(condition, message) \ 368 : ::fmt::detail::assert_fail(__FILE__, __LINE__, (message))) 372 #if defined(FMT_USE_STRING_VIEW) 373 template <
typename Char>
using std_string_view = std::basic_string_view<Char>;
374 #elif defined(FMT_USE_EXPERIMENTAL_STRING_VIEW) 375 template <
typename Char>
381 #ifdef FMT_USE_INT128 383 #elif defined(__SIZEOF_INT128__) && !FMT_NVCC && \ 384 !(FMT_CLANG_VERSION && FMT_MSC_VER) 385 # define FMT_USE_INT128 1 392 # define FMT_USE_INT128 0 404 template <
typename Int>
411 FMT_MSC_WARNING(suppress : 4566) constexpr
unsigned char micro[] =
"\u00B5";
416 using uchar =
unsigned char;
418 uchar(micro[1]) == 0xB5);
456 size_ = std::strlen(reinterpret_cast<const char*>(s));
458 size_ = std::char_traits<Char>::length(s);
462 template <
typename Traits,
typename Alloc>
464 const std::basic_string<Char, Traits, Alloc>& s)
FMT_NOEXCEPT 469 S, detail::std_string_view<Char>>::value)>
474 constexpr
auto data() const -> const Char* {
return data_; }
477 constexpr
auto size() const ->
size_t {
return size_; }
493 size_t str_size = size_ < other.size_ ? size_ : other.size_;
494 int result = std::char_traits<Char>::compare(data_, other.data_, str_size);
496 result = size_ == other.size_ ? 0 : (size_ < other.size_ ? -1 : 1);
503 return lhs.compare(rhs) == 0;
506 return lhs.compare(rhs) != 0;
509 return lhs.compare(rhs) < 0;
512 return lhs.compare(rhs) <= 0;
515 return lhs.compare(rhs) > 0;
518 return lhs.compare(rhs) >= 0;
544 template <typename Char, FMT_ENABLE_IF(is_char<Char>::value)>
549 template <
typename Char,
typename Traits,
typename Alloc>
555 template <
typename Char>
561 template <
typename Char,
562 FMT_ENABLE_IF(!std::is_empty<detail::std_string_view<Char>>::value)>
572 template <
typename S>
575 template <typename S, FMT_ENABLE_IF(is_compile_string<S>::value)>
589 template <
typename S>
590 struct is_string : std::is_class<decltype(to_string_view(std::declval<S>()))> {
602 #ifdef FMT_ENFORCE_COMPILE_STRING 604 "FMT_ENFORCE_COMPILE_STRING requires all format strings to use " 630 template <
typename Char,
typename ErrorHandler = detail::error_handler>
643 : ErrorHandler(eh), format_str_(format_str), next_arg_id_(next_arg_id) {}
650 return format_str_.
begin();
657 return format_str_.
end();
672 if (next_arg_id_ >= 0)
return next_arg_id_++;
673 on_error(
"cannot switch from manual to automatic argument indexing");
682 if (next_arg_id_ > 0)
683 on_error(
"cannot switch from automatic to manual argument indexing");
691 ErrorHandler::on_error(message);
704 template <
typename T,
typename Char =
char,
typename Enable =
void>
712 template <
typename T,
typename Context>
714 std::is_constructible<typename Context::template formatter_type<T>>;
718 template <
typename Char>
726 template <
typename Container>
729 using bi_iterator = std::back_insert_iterator<Container>;
730 struct accessor : bi_iterator {
731 accessor(bi_iterator iter) : bi_iterator(iter) {}
732 using bi_iterator::container;
734 return *accessor(it).container;
737 template <
typename Char,
typename InputIt,
typename OutputIt>
740 while (begin != end) *out++ =
static_cast<Char
>(*begin++);
744 template <typename Char, FMT_ENABLE_IF(std::is_same<Char, char>::value)>
748 return copy_str<Char, const Char*, Char*>(begin, end, out);
750 memcpy(out, begin,
size);
782 capacity_ = buf_capacity;
786 virtual void grow(
size_t capacity) = 0;
793 void operator=(
const buffer&) =
delete;
820 size_ = count <= capacity_ ?
count : capacity_;
828 if (new_capacity > capacity_) grow(new_capacity);
832 try_reserve(size_ + 1);
833 ptr_[size_++] = value;
837 template <
typename U>
void append(
const U* begin,
const U* end);
847 auto count() const ->
size_t {
return 0; }
858 auto count() const ->
size_t {
return count_; }
860 size_t n = limit_ > count_ ? limit_ - count_ : 0;
867 template <
typename OutputIt,
typename T,
typename Traits = buffer_traits>
871 enum { buffer_size = 256 };
872 T data_[buffer_size];
876 if (this->
size() == buffer_size) flush();
882 out_ = copy_str<T>(data_, data_ + this->limit(
size), out_);
887 : Traits(n),
buffer<T>(data_, 0, buffer_size), out_(out) {}
889 : Traits(other),
buffer<T>(data_, 0, buffer_size), out_(other.out_) {}
906 auto out() -> T* {
return &*this->
end(); }
910 template <
typename Container>
913 typename Container::value_type>>
914 final :
public buffer<typename Container::value_type> {
920 container_.resize(capacity);
921 this->
set(&container_[0], capacity);
929 auto out() -> std::back_insert_iterator<Container> {
930 return std::back_inserter(container_);
937 enum { buffer_size = 256 };
938 T data_[buffer_size];
943 if (this->
size() != buffer_size)
return;
944 count_ += this->
size();
951 auto count() ->
size_t {
return count_ + this->
size(); }
954 template <
typename T>
956 std::back_insert_iterator<buffer<T>>>;
959 template <
typename T,
typename OutputIt>
964 template <
typename Buffer>
972 template <
typename T,
typename Char =
char,
typename Enable =
void>
978 template <
typename T,
typename Char>
980 std::is_constructible<fallback_formatter<T, Char>>;
987 named_arg(
const Char* n,
const T& v) : name(n), value(v) {}
995 template <
typename T,
typename Char,
size_t NUM_ARGS,
size_t NUM_NAMED_ARGS>
999 T args_[1 + (NUM_ARGS != 0 ? NUM_ARGS : +1)];
1002 template <
typename... U>
1003 arg_data(
const U&... init) : args_{T(named_args_, NUM_NAMED_ARGS), init...} {}
1005 auto args() const -> const T* {
return args_ + 1; }
1009 template <
typename T,
typename Char,
size_t NUM_ARGS>
1012 T args_[NUM_ARGS != 0 ? NUM_ARGS : +1];
1014 template <
typename... U>
1022 template <
typename Char>
1028 template <
typename T,
typename Char>
1031 template <
typename Char,
typename T,
typename... Tail,
1034 int named_arg_count,
const T&,
const Tail&...
args) {
1038 template <
typename Char,
typename T,
typename... Tail,
1041 int named_arg_count,
const T&
arg,
const Tail&...
args) {
1042 named_args[named_arg_count++] = {arg.
name, arg_count};
1046 template <
typename... Args>
1050 template <
bool B = false> constexpr
auto count() ->
size_t {
return B ? 1 : 0; }
1051 template <
bool B1,
bool B2,
bool... Tail> constexpr
auto count() ->
size_t {
1052 return (B1 ? 1 : 0) +
count<B2, Tail...>();
1056 return count<is_named_arg<Args>::value...>();
1083 template <
typename T,
typename Char>
1086 #define FMT_TYPE_CONSTANT(Type, constant) \ 1087 template <typename Char> \ 1088 struct type_constant<Type, Char> \ 1089 : std::integral_constant<type, type::constant> {} 1131 template <
typename Context>
class value {
1171 string.data = val.
data();
1172 string.size = val.
size();
1176 : named_args{
args, size} {}
1179 custom.value = &val;
1183 custom.format = format_custom_arg<
1185 typename Context::template formatter_type<T>,
1191 template <
typename T,
typename Formatter>
1193 typename Context::parse_context_type& parse_ctx,
1196 parse_ctx.advance_to(f.parse(parse_ctx));
1197 ctx.advance_to(f.format(*static_cast<const T*>(arg), ctx));
1201 template <
typename Context,
typename T>
1232 ->
unsigned long long {
1239 template <typename T, FMT_ENABLE_IF(is_char<T>::value)>
1242 std::is_same<T, char>::value || std::is_same<T, char_type>::value,
1243 "mixing character types is disallowed");
1259 template <typename T, FMT_ENABLE_IF(is_string<T>::value)>
1263 "mixing character types is disallowed");
1266 template <
typename T,
1287 static_assert(std::is_same<char_type, char>::value,
"invalid string type");
1288 return reinterpret_cast<const char*
>(val);
1291 static_assert(std::is_same<char_type, char>::value,
"invalid string type");
1292 return reinterpret_cast<const char*
>(val);
1295 const auto* const_val = val;
1296 return map(const_val);
1299 const auto* const_val = val;
1300 return map(const_val);
1313 template <
typename T>
1319 static_assert(!
sizeof(T),
"formatting of non-void pointers is disallowed");
1323 template <
typename T, std::
size_t N>
1328 template <
typename T,
1333 -> decltype(std::declval<arg_mapper>().map(
1337 template <
typename T,
1345 template <typename T, FMT_ENABLE_IF(is_named_arg<T>::value)>
1347 -> decltype(std::declval<arg_mapper>().map(named_arg.value)) {
1348 return map(named_arg.value);
1355 template <
typename T,
typename Context>
1358 typename Context::char_type>;
1370 class appender :
public std::back_insert_iterator<detail::buffer<char>> {
1371 using base = std::back_insert_iterator<detail::buffer<char>>;
1373 template <
typename T>
1379 using std::back_insert_iterator<detail::buffer<char>>::back_insert_iterator;
1402 template <
typename ContextType,
typename T>
1406 template <
typename Visitor,
typename Ctx>
1409 -> decltype(vis(0));
1416 template <
typename T,
typename Char,
size_t NUM_ARGS,
size_t NUM_NAMED_ARGS>
1417 friend struct detail::arg_data;
1420 : value_(args, size) {}
1425 explicit handle(detail::custom_value<Context> custom) : custom_(custom) {}
1427 void format(
typename Context::parse_context_type& parse_ctx,
1428 Context& ctx)
const {
1429 custom_.format(custom_.value, parse_ctx, ctx);
1439 return type_ != detail::type::none_type;
1457 template <
typename Visitor,
typename Context>
1460 switch (arg.type_) {
1461 case detail::type::none_type:
1463 case detail::type::int_type:
1464 return vis(arg.value_.int_value);
1465 case detail::type::uint_type:
1466 return vis(arg.value_.uint_value);
1467 case detail::type::long_long_type:
1468 return vis(arg.value_.long_long_value);
1469 case detail::type::ulong_long_type:
1470 return vis(arg.value_.ulong_long_value);
1471 case detail::type::int128_type:
1473 case detail::type::uint128_type:
1475 case detail::type::bool_type:
1476 return vis(arg.value_.bool_value);
1477 case detail::type::char_type:
1478 return vis(arg.value_.char_value);
1479 case detail::type::float_type:
1480 return vis(arg.value_.float_value);
1481 case detail::type::double_type:
1482 return vis(arg.value_.double_value);
1483 case detail::type::long_double_type:
1484 return vis(arg.value_.long_double_value);
1485 case detail::type::cstring_type:
1486 return vis(arg.value_.string.data);
1487 case detail::type::string_type:
1489 return vis(sv(arg.value_.string.data, arg.value_.string.size));
1490 case detail::type::pointer_type:
1491 return vis(arg.value_.pointer);
1492 case detail::type::custom_type:
1500 template <
typename Char,
typename InputIt>
1501 auto copy_str(InputIt begin, InputIt end, appender out) -> appender {
1506 #if FMT_GCC_VERSION && FMT_GCC_VERSION < 500 1508 template <
typename... Ts>
struct void_t_impl {
using type =
void; };
1509 template <
typename... Ts>
1510 using void_t =
typename detail::void_t_impl<Ts...>
::type;
1512 template <
typename...>
using void_t =
void;
1515 template <
typename It,
typename T,
typename Enable =
void>
1518 template <
typename It,
typename T>
1522 decltype(*std::declval<It>() = std::declval<T>())>>
1525 template <
typename OutputIt>
1527 template <
typename Container>
1531 template <
typename OutputIt>
1533 template <
typename Container>
1546 template <
typename Locale>
explicit locale_ref(
const Locale& loc);
1550 template <
typename Locale>
auto get()
const -> Locale;
1557 template <
typename Context,
typename Arg,
typename... Args>
1563 template <
typename Context,
typename T>
1574 template <
bool IS_PACKED,
typename Context,
type,
typename T,
1580 "Cannot format an argument. To make type T formattable provide a " 1581 "formatter<T> specialization: https://fmt.dev/latest/api.html#udt");
1585 template <
bool IS_PACKED,
typename Context,
type,
typename T,
1588 return make_arg<Context>(value);
1618 detail::locale_ref loc = detail::locale_ref())
1619 : out_(out), args_(ctx_args), loc_(loc) {}
1640 if (!detail::is_back_insert_iterator<iterator>()) out_ = it;
1646 template <
typename Char>
1652 #define FMT_BUFFER_CONTEXT(Char) \ 1653 basic_format_context<detail::buffer_appender<Char>, Char> 1655 template <
typename T,
typename Char =
char>
1657 !std::is_same<decltype(detail::arg_mapper<buffer_context<Char>>().map(
1658 std::declval<T>())),
1659 detail::unformattable>
::value &&
1660 !detail::has_fallback_formatter<T, Char>::value>;
1669 template <
typename Context,
typename... Args>
1690 static constexpr
unsigned long long desc =
1693 (num_named_args != 0
1705 detail::mapped_type_constant<Args, Context>::value>(
args)...} {
1735 template <
typename Char,
typename T>
1736 inline auto arg(
const Char*
name,
const T& arg) -> detail::named_arg<Char, T> {
1737 static_assert(!detail::is_named_arg<T>(),
"nested named arguments");
1782 return static_cast<detail::type
>((desc_ >> shift) & mask);
1786 const detail::value<Context>* values)
1787 : desc_(desc), values_(values) {}
1789 : desc_(desc), args_(args) {}
1799 template <
typename... Args>
1803 store.data_.args()) {}
1813 : basic_format_args(store.get_types(), store.
data()) {}
1828 if (
id < max_size()) arg = args_[
id];
1833 if (arg.
type_ == detail::type::none_type)
return arg;
1834 arg.
value_ = values_[id];
1838 template <
typename Char>
1840 int id = get_id(
name);
1844 template <
typename Char>
1846 if (!has_named_args())
return -1;
1847 const auto& named_args =
1848 (is_packed() ? values_[-1] : args_[-1].value_).named_args;
1849 for (
size_t i = 0; i < named_args.size; ++i) {
1850 if (named_args.data[i].
name ==
name)
return named_args.data[i].
id;
1857 return static_cast<int>(is_packed() ? max_packed
1885 enum { max_size = 4 };
1886 Char data_[max_size] = {Char(
' '), Char(0), Char(0), Char(0)};
1887 unsigned char size_ = 1;
1893 for (
size_t i = 0; i <
size; ++i) data_[i] = s[i];
1894 size_ =
static_cast<unsigned char>(
size);
1897 constexpr
auto size() const ->
size_t {
return size_; }
1898 constexpr
auto data() const -> const Char* {
return data_; }
1902 return data_[
index];
1962 template <
typename Char>
1980 : specs_(other.specs_) {}
1992 specs_.
fill[0] = Char(
'0');
2002 specs_.
type =
static_cast<char>(
type);
2008 template <
typename ParseContext>
2010 :
public specs_setter<typename ParseContext::char_type> {
2020 specs_(other.specs_),
2021 context_(other.context_) {}
2024 specs_.width_ref = make_arg_ref(arg_id);
2028 specs_.precision_ref = make_arg_ref(arg_id);
2032 context_.on_error(message);
2042 context_.check_arg_id(arg_id);
2052 context_.check_arg_id(arg_id);
2054 context_.begin(),
to_unsigned(context_.end() - context_.begin()));
2060 return (c >=
'a' && c <=
'z') || (c >=
'A' && c <=
'Z');
2064 template <typename Char, FMT_ENABLE_IF(std::is_integral<Char>::value)>
2068 template <typename Char, FMT_ENABLE_IF(std::is_enum<Char>::value)>
2069 constexpr
auto to_ascii(Char value) ->
2074 template <
typename Char>
2077 constexpr
char lengths[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2078 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 3, 3, 4, 0};
2079 int len = lengths[
static_cast<unsigned char>(*begin) >> 3];
2088 template <
bool IS_CONSTEXPR,
typename T,
typename Ptr = const T*>
2090 for (out =
first; out != last; ++out) {
2091 if (*out == value)
return true;
2098 const char*& out) ->
bool {
2099 out =
static_cast<const char*
>(
2100 std::memchr(first, value,
to_unsigned(last - first)));
2101 return out !=
nullptr;
2106 template <
typename Char>
2108 int error_value) noexcept ->
int {
2109 FMT_ASSERT(begin != end &&
'0' <= *begin && *begin <=
'9',
"");
2110 unsigned value = 0, prev = 0;
2114 value = value * 10 + unsigned(*p -
'0');
2116 }
while (p != end &&
'0' <= *p && *p <=
'9');
2117 auto num_digits = p - begin;
2120 return static_cast<int>(value);
2122 const unsigned max =
to_unsigned((std::numeric_limits<int>::max)());
2124 prev * 10ull + unsigned(p[-1] -
'0') <= max
2125 ?
static_cast<int>(value)
2130 template <
typename Char,
typename Handler>
2132 Handler&& handler) ->
const Char* {
2136 if (p >= end) p = begin;
2155 return handler.on_error(
"invalid fill character '{'"), begin;
2160 handler.on_align(
align);
2162 }
else if (p == begin) {
2171 return (
'a' <= c && c <=
'z') || (
'A' <= c && c <=
'Z') ||
'_' == c;
2174 template <
typename Char,
typename IDHandler>
2176 IDHandler&& handler) ->
const Char* {
2179 if (c >=
'0' && c <=
'9') {
2186 if (begin == end || (*begin !=
'}' && *begin !=
':'))
2187 handler.on_error(
"invalid format string");
2193 handler.on_error(
"invalid format string");
2199 }
while (it != end && (
is_name_start(c = *it) || (
'0' <= c && c <=
'9')));
2204 template <
typename Char,
typename IDHandler>
2206 IDHandler&& handler) ->
const Char* {
2208 if (c !=
'}' && c !=
':')
return do_parse_arg_id(begin, end, handler);
2213 template <
typename Char,
typename Handler>
2215 Handler&& handler) ->
const Char* {
2216 using detail::auto_id;
2217 struct width_adapter {
2221 FMT_CONSTEXPR void operator()(
int id) { handler.on_dynamic_width(
id); }
2223 handler.on_dynamic_width(
id);
2226 if (message) handler.on_error(message);
2231 if (
'0' <= *begin && *begin <=
'9') {
2234 handler.on_width(width);
2236 handler.on_error(
"number is too big");
2237 }
else if (*begin ==
'{') {
2239 if (begin != end) begin =
parse_arg_id(begin, end, width_adapter{handler});
2240 if (begin == end || *begin !=
'}')
2241 return handler.on_error(
"invalid format string"), begin;
2247 template <
typename Char,
typename Handler>
2249 Handler&& handler) ->
const Char* {
2250 using detail::auto_id;
2251 struct precision_adapter {
2255 FMT_CONSTEXPR void operator()(
int id) { handler.on_dynamic_precision(
id); }
2257 handler.on_dynamic_precision(
id);
2260 if (message) handler.on_error(message);
2265 auto c = begin != end ? *begin : Char();
2266 if (
'0' <= c && c <=
'9') {
2268 if (precision != -1)
2269 handler.on_precision(precision);
2271 handler.on_error(
"number is too big");
2272 }
else if (c ==
'{') {
2275 begin =
parse_arg_id(begin, end, precision_adapter{handler});
2276 if (begin == end || *begin++ !=
'}')
2277 return handler.on_error(
"invalid format string"), begin;
2279 return handler.on_error(
"missing precision specifier"), begin;
2281 handler.end_precision();
2287 template <
typename Char,
typename SpecHandler>
2290 SpecHandler&& handler)
2294 handler.on_type(*begin++);
2298 if (begin == end)
return begin;
2301 if (begin == end)
return begin;
2320 if (begin == end)
return begin;
2322 if (*begin ==
'#') {
2324 if (++begin == end)
return begin;
2328 if (*begin ==
'0') {
2330 if (++begin == end)
return begin;
2334 if (begin == end)
return begin;
2337 if (*begin ==
'.') {
2339 if (begin == end)
return begin;
2342 if (*begin ==
'L') {
2343 handler.on_localized();
2348 if (begin != end && *begin !=
'}') handler.on_type(*begin++);
2352 template <
typename Char,
typename Handler>
2354 Handler&& handler) ->
const Char* {
2359 FMT_CONSTEXPR void operator()() { arg_id = handler.on_arg_id(); }
2360 FMT_CONSTEXPR void operator()(
int id) { arg_id = handler.on_arg_id(
id); }
2362 arg_id = handler.on_arg_id(
id);
2365 if (message) handler.on_error(message);
2370 if (begin == end)
return handler.on_error(
"invalid format string"), end;
2371 if (*begin ==
'}') {
2372 handler.on_replacement_field(handler.on_arg_id(), begin);
2373 }
else if (*begin ==
'{') {
2374 handler.on_text(begin, begin + 1);
2376 auto adapter = id_adapter{handler, 0};
2378 Char c = begin != end ? *begin : Char();
2380 handler.on_replacement_field(adapter.arg_id, begin);
2381 }
else if (c ==
':') {
2382 begin = handler.on_format_specs(adapter.arg_id, begin + 1, end);
2383 if (begin == end || *begin !=
'}')
2384 return handler.on_error(
"unknown format specifier"), end;
2386 return handler.on_error(
"missing '}' in format string"), end;
2392 template <
bool IS_CONSTEXPR,
typename Char,
typename Handler>
2398 auto begin = format_str.
data();
2399 auto end = begin + format_str.
size();
2400 if (end - begin < 32) {
2402 const Char* p = begin;
2406 handler.on_text(begin, p - 1);
2408 }
else if (c ==
'}') {
2409 if (p == end || *p !=
'}')
2410 return handler.on_error(
"unmatched '}' in format string");
2411 handler.on_text(begin, p);
2415 handler.on_text(begin, end);
2419 FMT_CONSTEXPR void operator()(
const Char* pbegin,
const Char* pend) {
2420 if (pbegin == pend)
return;
2422 const Char* p =
nullptr;
2423 if (!find<IS_CONSTEXPR>(pbegin, pend,
'}', p))
2424 return handler_.on_text(pbegin, pend);
2426 if (p == pend || *p !=
'}')
2427 return handler_.
on_error(
"unmatched '}' in format string");
2428 handler_.on_text(pbegin, p);
2434 while (begin != end) {
2437 const Char* p = begin;
2438 if (*begin !=
'{' && !find<IS_CONSTEXPR>(begin + 1, end,
'{', p))
2439 return write(begin, end);
2445 template <
typename T,
typename ParseContext>
2447 -> decltype(ctx.begin()) {
2448 using char_type =
typename ParseContext::char_type;
2456 return f.parse(ctx);
2463 template <
typename Char,
typename ErrorHandler = error_handler>
2473 int num_args = (std::numeric_limits<int>::max)(), ErrorHandler eh = {})
2474 :
base(format_str, eh), num_args_(num_args) {}
2477 int id = base::next_arg_id();
2478 if (
id >= num_args_) this->on_error(
"argument not found");
2483 base::check_arg_id(
id);
2484 if (
id >= num_args_) this->on_error(
"argument not found");
2486 using base::check_arg_id;
2489 template <
typename ErrorHandler>
2502 eh.on_error(
"invalid type specifier");
2508 template <
typename Char,
typename ErrorHandler = error_handler>
2510 ErrorHandler&& eh = {}) ->
bool {
2511 if (specs.
type && specs.
type !=
'c') {
2516 eh.on_error(
"invalid format specifier for char");
2539 template <
typename ErrorHandler = error_handler,
typename Char>
2541 ErrorHandler&& eh = {})
2546 switch (specs.
type) {
2577 eh.on_error(
"invalid type specifier");
2583 template <
typename Char,
typename ErrorHandler = error_handler>
2586 if (spec == 0 || spec ==
's')
return true;
2587 if (spec !=
'p') eh.on_error(
"invalid type specifier");
2591 template <
typename Char,
typename ErrorHandler>
2593 if (spec != 0 && spec !=
's') eh.on_error(
"invalid type specifier");
2596 template <
typename Char,
typename ErrorHandler>
2598 if (spec != 0 && spec !=
'p') eh.on_error(
"invalid type specifier");
2609 this->on_error(
"format specifier requires numeric argument");
2614 : Handler(handler), arg_type_(arg_type) {}
2618 Handler::on_align(align);
2622 require_numeric_argument();
2625 this->on_error(
"format specifier requires signed argument");
2627 Handler::on_sign(s);
2631 require_numeric_argument();
2636 require_numeric_argument();
2637 Handler::on_localized();
2641 require_numeric_argument();
2647 this->on_error(
"precision not allowed for this argument type");
2653 #if FMT_USE_NONTYPE_TEMPLATE_PARAMETERS 2654 template <
int N,
typename T,
typename... Args,
typename Char>
2656 if constexpr (detail::is_statically_named_arg<T>()) {
2657 if (name == T::name)
return N;
2659 if constexpr (
sizeof...(Args) > 0)
2666 template <
typename... Args,
typename Char>
2668 #if FMT_USE_NONTYPE_TEMPLATE_PARAMETERS 2669 if constexpr (
sizeof...(Args) > 0)
2676 template <
typename Char,
typename ErrorHandler,
typename... Args>
2680 enum { num_args =
sizeof...(Args) };
2691 : context_(format_str, num_args, eh),
2692 parse_funcs_{&parse_format_specs<Args, parse_context_type>...} {}
2701 #if FMT_USE_NONTYPE_TEMPLATE_PARAMETERS 2703 if (
index == invalid_arg_index) on_error(
"named argument is not found");
2707 on_error(
"compile-time checks for named arguments require C++20 support");
2718 return id >= 0 &&
id < num_args ? parse_funcs_[id](context_) : begin;
2726 template <
typename... Args,
typename S,
2733 (parse_format_string<true>(s, checker(s, {})),
true);
2734 (
void)invalid_format;
2737 template <
typename Char>
2741 detail::locale_ref loc = {});
2751 template <
typename T,
typename Char>
2754 detail::type::custom_type>> {
2761 template <
typename ParseContext>
2763 auto begin = ctx.begin(), end = ctx.end();
2764 if (begin == end)
return begin;
2765 using handler_type = detail::dynamic_specs_handler<ParseContext>;
2766 auto type = detail::type_constant<T, Char>::value;
2768 detail::specs_checker<handler_type>(handler_type(specs_, ctx),
type);
2770 auto eh = ctx.error_handler();
2772 case detail::type::none_type:
2775 case detail::type::bool_type:
2776 if (!specs_.type || specs_.type ==
's')
break;
2778 case detail::type::int_type:
2779 case detail::type::uint_type:
2780 case detail::type::long_long_type:
2781 case detail::type::ulong_long_type:
2782 case detail::type::int128_type:
2783 case detail::type::uint128_type:
2786 case detail::type::char_type:
2789 case detail::type::float_type:
2795 case detail::type::double_type:
2799 FMT_ASSERT(
false,
"double support disabled");
2801 case detail::type::long_double_type:
2805 FMT_ASSERT(
false,
"long double support disabled");
2807 case detail::type::cstring_type:
2810 case detail::type::string_type:
2813 case detail::type::pointer_type:
2816 case detail::type::custom_type:
2824 template <
typename FormatContext>
2826 -> decltype(ctx.out());
2836 template <
typename S,
2843 std::is_reference<Args>::value)...>() == 0,
2844 "passing views as lvalues is disallowed");
2845 #ifdef FMT_HAS_CONSTEVAL 2846 if constexpr (detail::count_named_args<Args...>() == 0) {
2847 using checker = detail::format_string_checker<Char, detail::error_handler,
2849 detail::parse_format_string<true>(str_, checker(s, {}));
2860 #if FMT_GCC_VERSION && FMT_GCC_VERSION < 409 2867 template <
typename... Args>
2888 template <
typename... T>
2894 template <
typename OutputIt,
2895 FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, char>::value)>
2898 auto&& buf = get_buffer<char>(out);
2915 template <
typename OutputIt,
typename... T,
2916 FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, char>::value)>
2929 template <
typename OutputIt,
typename... T,
2930 FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, char>::value)>
2934 detail::iterator_buffer<OutputIt, char, detail::fixed_buffer_traits>;
2935 auto buf =
buffer(out, n);
2937 return {buf.out(), buf.count()};
2947 template <
typename OutputIt,
typename... T,
2948 FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, char>::value)>
2955 template <
typename... T>
2957 auto buf = detail::counting_buffer<>();
2975 template <
typename... T>
2992 template <
typename... T>
3003 #ifdef FMT_HEADER_ONLY 3006 #endif // FMT_CORE_H_
iterator_buffer(T *out, size_t=0)
FMT_CONSTEXPR auto to_unsigned(Int value) -> typename std::make_unsigned< Int >::type
#define FMT_MODULE_EXPORT_END
basic_string_view< Char > name
#define FMT_ENABLE_IF(...)
FMT_INLINE void check_format_string(const S &)
FMT_CONSTEXPR FMT_INLINE auto map(T val) -> char_type
FMT_CONSTEXPR FMT_INLINE auto map(unsigned short val) -> unsigned
FMT_CONSTEXPR auto make_arg_ref(basic_string_view< char_type > arg_id) -> arg_ref_type
named_arg_value< char_type > named_args
FMT_CONSTEXPR FMT_INLINE auto map(std::nullptr_t val) -> const void *
FMT_CONSTEXPR void on_localized()
typename std::remove_cv< remove_reference_t< T > >::type remove_cvref_t
FMT_CONSTEXPR basic_string_view(const std::basic_string< Char, Traits, Alloc > &s) FMT_NOEXCEPT
FMT_API void vprint_mojibake(std::FILE *, string_view, format_args)
FMT_CONSTEXPR dynamic_specs_handler(const dynamic_specs_handler &other)
auto operator[](I index) const -> const T &
FMT_CONSTEXPR auto operator[](size_t index) -> Char &
FMT_INLINE value(uint128_t val)
typename Context::char_type char_type
typename detail::char_t_impl< S >::type char_t
FMT_API auto vformat(string_view fmt, format_args args) -> std::string
FMT_CONSTEXPR FMT_INLINE auto parse_format_specs(const Char *begin, const Char *end, SpecHandler &&handler) -> const Char *
FMT_CONSTEXPR_CHAR_TRAITS friend auto operator==(basic_string_view lhs, basic_string_view rhs) -> bool
auto begin() const FMT_NOEXCEPT -> const T *
#define FMT_BEGIN_DETAIL_NAMESPACE
FMT_CONSTEXPR void operator=(basic_string_view< Char > s)
FMT_CONSTEXPR void check_arg_id(int id)
constexpr auto data() const -> const Char *
#define FMT_END_DETAIL_NAMESPACE
FMT_CONSTEXPR FMT_INLINE auto map(int128_t val) -> int128_t
FMT_CONSTEXPR void end_precision()
FMT_CONSTEXPR auto do_parse_arg_id(const Char *begin, const Char *end, IDHandler &&handler) -> const Char *
FMT_CONSTEXPR auto arg_id(basic_string_view< char_type > name) -> int
FMT_CONSTEXPR void on_width(int width)
constexpr FMT_INLINE value(long long val)
auto count() const -> size_t
FMT_CONSTEXPR void advance_to(iterator it)
constexpr std::uintptr_t align(std::size_t alignment, std::uintptr_t ptr, std::size_t &space)
FMT_CONSTEXPR void check_pointer_type_spec(Char spec, ErrorHandler &&eh)
FMT_CONSTEXPR void on_align(align_t align)
void grow(size_t capacity) final FMT_OVERRIDE
typename std::conditional< B, T, F >::type conditional_t
constexpr auto begin() const FMT_NOEXCEPT -> iterator
span_CONFIG_SIZE_TYPE size_t
auto limit(size_t size) -> size_t
conditional_t< long_short, int, long long > long_type
FMT_CONSTEXPR FMT_INLINE auto map(signed char *val) -> const char *
constexpr auto count_named_args() -> size_t
FMT_INLINE auto format_to_n(OutputIt out, size_t n, format_string< T... > fmt, const T &... args) -> format_to_n_result< OutputIt >
dynamic_format_specs< char_type > & specs_
FMT_CONSTEXPR void on_hash()
static int writer(lua_State *L, const void *b, size_t size, void *ud)
#define FMT_CONSTEXPR_CHAR_TRAITS
constexpr bool is_ascii_letter(Char c)
constexpr auto const_check(T value) -> T
FMT_CONSTEXPR FMT_INLINE auto map(long double val) -> long double
auto end() FMT_NOEXCEPT -> T *
FMT_CONSTEXPR_CHAR_TRAITS FMT_INLINE basic_string_view(const Char *s)
constexpr FMT_INLINE value(int val)
string_value< char_type > string
FMT_CONSTEXPR void on_localized()
FMT_CONSTEXPR arg_ref(basic_string_view< Char > name)
auto map(...) -> unformattable
FMT_CONSTEXPR FMT_INLINE auto map(const T &val) -> basic_string_view< char_type >
constexpr auto to_ascii(Char value) -> Char
auto args() const -> const basic_format_args< basic_format_context > &
auto count() const -> size_t
FMT_CONSTEXPR FMT_INLINE auto map(const T(&values)[N]) -> const T(&)[N]
FMT_CONSTEXPR FMT_INLINE value(const T &val)
auto vformat_to_n(OutputIt out, size_t n, string_view fmt, format_args args) -> format_to_n_result< OutputIt >
auto arg(const Char *name, const T &arg) -> detail::named_arg< Char, T >
FMT_CONSTEXPR auto operator=(int idx) -> arg_ref &
void vformat_to(buffer< Char > &buf, basic_string_view< Char > fmt, basic_format_args< FMT_BUFFER_CONTEXT(type_identity_t< Char >)> args, detail::locale_ref loc={})
constexpr auto size() const -> size_t
FMT_CONSTEXPR auto parse_nonnegative_int(const Char *&begin, const Char *end, int error_value) noexcept -> int
FMT_CONSTEXPR FMT_INLINE auto map(double val) -> double
FMT_CONSTEXPR void on_error(const char *message)
FMT_CONSTEXPR auto operator[](size_t index) const -> const Char &
FMT_CONSTEXPR FMT_INLINE auto map(const T &val) -> decltype(std::declval< arg_mapper >().map(static_cast< typename std::underlying_type< T >::type >(val)))
FMT_INLINE value(long double val)
long double long_double_value
auto operator[](I index) -> T &
constexpr auto is_utf8() -> bool
FMT_CONSTEXPR void on_precision(int precision)
FMT_CONSTEXPR FMT_INLINE auto map(long long val) -> long long
FMT_CONSTEXPR void on_zero()
constexpr int invalid_arg_index
void push_back(const T &value)
auto end() const FMT_NOEXCEPT -> const T *
FMT_INLINE auto format_to(OutputIt out, format_string< T... > fmt, T &&... args) -> OutputIt
FMT_CONSTEXPR auto parse_precision(const Char *begin, const Char *end, Handler &&handler) -> const Char *
constexpr auto make_format_args(const Args &... args) -> format_arg_store< Context, Args... >
#define FMT_END_NAMESPACE
FMT_CONSTEXPR FMT_INLINE auto named_args() -> std::nullptr_t
FMT_CONSTEXPR void on_fill(basic_string_view< Char > fill)
FMT_CONSTEXPR void require_numeric_argument()
arg_data(const U &... init)
basic_string_view< char > string_view
basic_format_specs< Char > & specs_
constexpr auto end() const FMT_NOEXCEPT -> iterator
buffer_context< char > format_context
FMT_CONSTEXPR FMT_INLINE arg_data(const U &... init)
FMT_BEGIN_DETAIL_NAMESPACE void throw_format_error(const char *message)
FMT_CONSTEXPR FMT_INLINE auto map(unsigned val) -> unsigned
long long long_long_value
void try_reserve(size_t new_capacity)
FMT_CONSTEXPR void on_dynamic_precision(Id arg_id)
constexpr auto size() const -> size_t
constexpr auto error_handler() const -> ErrorHandler
auto get_iterator(Buffer &buf) -> decltype(buf.out())
FMT_CONSTEXPR auto copy_str(InputIt begin, InputIt end, OutputIt out) -> OutputIt
auto args() const -> const T *
FMT_CONSTEXPR auto map(T) -> enable_if_t< std::is_pointer< T >::value, int >
auto runtime(const S &s) -> basic_runtime< char_t< S >>
constexpr auto data() const -> const Char *
#define FMT_MSC_WARNING(...)
FMT_CONSTEXPR auto arg(basic_string_view< char_type > name) -> format_arg
FMT_CONSTEXPR_CHAR_TRAITS auto compare(basic_string_view other) const -> int
FMT_NORETURN FMT_API void assert_fail(const char *file, int line, const char *message)
FMT_INLINE value(int128_t val)
std::back_insert_iterator< detail::buffer< char > > base
FMT_API void vprint(string_view fmt, format_args args)
integral_constant< bool, false > false_type
typename Context::parse_context_type parse_context
auto write(OutputIt out, const std::tm &time, const std::locale &loc, char format, char modifier=0) -> OutputIt
FMT_CONSTEXPR auto error_handler() -> detail::error_handler
FMT_CONSTEXPR void on_hash()
basic_string_view< Char > str
FMT_CONSTEXPR auto next_arg_id() -> int
bool_constant< !std::is_same< decltype(detail::arg_mapper< buffer_context< Char > >().map(std::declval< T >())), detail::unformattable >::value &&!detail::has_fallback_formatter< T, Char >::value > is_formattable
auto data() const FMT_NOEXCEPT -> const T *
FMT_INLINE auto to_string_view(const Char *s) -> basic_string_view< Char >
auto find< false, char >(const char *first, const char *last, char value, const char *&out) -> bool
conditional_t< std::is_same< T, char >::value, appender, std::back_insert_iterator< buffer< T > >> buffer_appender
void grow(size_t) final FMT_OVERRIDE
constexpr auto operator[](size_t pos) const -> const Char &
constexpr auto arg(int id) const -> format_arg
constexpr auto count() -> size_t
FMT_CONSTEXPR auto parse_replacement_field(const Char *begin, const Char *end, Handler &&handler) -> const Char *
friend auto operator!=(basic_string_view lhs, basic_string_view rhs) -> bool
FMT_INLINE value(const named_arg_info< char_type > *args, size_t size)
typename std::remove_reference< T >::type remove_reference_t
constexpr auto begin() const -> iterator
iterator_buffer(Container &c)
integral_constant< bool, true > true_type
FMT_CONSTEXPR FMT_INLINE auto map(unsigned char *val) -> const char *
#define FMT_GCC_PRAGMA(arg)
FMT_BEGIN_DETAIL_NAMESPACE constexpr FMT_INLINE auto is_constant_evaluated() FMT_NOEXCEPT -> bool
FMT_CONSTEXPR FMT_INLINE auto map(unsigned long val) -> ulong_type
FMT_CONSTEXPR FMT_INLINE auto map(signed char val) -> int
FMT_CONSTEXPR auto make_arg(const T &value) -> basic_format_arg< Context >
FMT_CONSTEXPR void on_align(align_t align)
auto operator++() -> appender &
FMT_BEGIN_DETAIL_NAMESPACE auto get_container(std::back_insert_iterator< Container > it) -> Container &
#define FMT_BUFFER_CONTEXT(Char)
auto operator++(int) -> appender
void try_resize(size_t count)
#define FMT_TYPE_CONSTANT(Type, constant)
iterator_buffer(OutputIt out, size_t n=buffer_size)
#define FMT_USE_LONG_DOUBLE
conditional_t< long_short, unsigned, unsigned long long > ulong_type
FMT_CONSTEXPR FMT_INLINE auto parse_arg_id(const Char *begin, const Char *end, IDHandler &&handler) -> const Char *
constexpr basic_string_view(const Char *s, size_t count) FMT_NOEXCEPT
FMT_CONSTEXPR FMT_INLINE auto map(const T &named_arg) -> decltype(std::declval< arg_mapper >().map(named_arg.value))
FMT_CONSTEXPR FMT_INLINE void parse_format_string(basic_string_view< Char > format_str, Handler &&handler)
FMT_CONSTEXPR FMT_INLINE auto map(bool val) -> bool
FMT_CONSTEXPR void check_arg_id(basic_string_view< Char >)
FMT_CONSTEXPR FMT_INLINE auto map(unsigned char val) -> unsigned
FMT_NORETURN FMT_API void on_error(const char *message)
FMT_INLINE value(float val)
auto get_buffer(OutputIt out) -> iterator_buffer< OutputIt, T >
FMT_CONSTEXPR void on_zero()
void advance_to(iterator it)
typename ParseContext::char_type char_type
FMT_CONSTEXPR FMT_INLINE auto map(float val) -> float
FMT_CONSTEXPR dynamic_specs_handler(dynamic_format_specs< char_type > &specs, ParseContext &ctx)
FMT_CONSTEXPR auto get_arg_index_by_name(basic_string_view< Char > name) -> int
friend auto get_buffer(appender out) -> detail::buffer< char > &
FMT_CONSTEXPR void end_precision()
auto out() -> std::back_insert_iterator< Container >
FMT_CONSTEXPR specs_checker(const Handler &handler, detail::type arg_type)
void on_error(const char *message)
const T & first(const T &value, const Tail &...)
friend auto operator>=(basic_string_view lhs, basic_string_view rhs) -> bool
FMT_INLINE auto formatted_size(format_string< T... > fmt, T &&... args) -> size_t
FMT_INLINE void print(format_string< T... > fmt, T &&... args)
unsigned long long ulong_long_value
typename result::value_type type
FMT_CONSTEXPR compile_parse_context(basic_string_view< Char > format_str, int num_args=(std::numeric_limits< int >::max)(), ErrorHandler eh={})
iterator_buffer(iterator_buffer &&other)
remove_cvref_t< decltype(*detail::range_begin(std::declval< Range >()))> value_type
FMT_CONSTEXPR FMT_INLINE auto map(char_type *val) -> const char_type *
named_arg(const Char *n, const T &v)
FMT_CONSTEXPR void on_error(const char *message)
constexpr FMT_INLINE value(unsigned val)
friend auto operator>(basic_string_view lhs, basic_string_view rhs) -> bool
typename basic_string_view< Char >::iterator iterator
FMT_CONSTEXPR FMT_INLINE auto map(int val) -> int
typename type_identity< T >::type type_identity_t
auto size() const FMT_NOEXCEPT -> size_t
basic_format_args< basic_format_context > args_
void grow(size_t) final FMT_OVERRIDE
FMT_CONSTEXPR auto make_arg_ref(int arg_id) -> arg_ref_type
FMT_CONSTEXPR FMT_INLINE auto map(long val) -> long_type
static void format_custom_arg(const void *arg, typename Context::parse_context_type &parse_ctx, Context &ctx)
FMT_INLINE auto format(format_string< T... > fmt, T &&... args) -> std::string
FMT_CONSTEXPR auto parse_width(const Char *begin, const Char *end, Handler &&handler) -> const Char *
FMT_CONSTEXPR specs_setter(const specs_setter &other)
FMT_CONSTEXPR void on_dynamic_width(Id arg_id)
typename Context::char_type char_type
std::is_constructible< fallback_formatter< T, Char > > has_fallback_formatter
constexpr auto end() const -> iterator
FMT_CONSTEXPR FMT_INLINE auto map(const signed char *val) -> const char *
constexpr bool is_arithmetic_type(type t)
FMT_CONSTEXPR auto code_point_length(const Char *begin) -> int
constexpr auto encode_types() -> unsigned long long
FMT_CONSTEXPR bool is_name_start(Char c)
FMT_CONSTEXPR FMT_INLINE auto visit_format_arg(Visitor &&vis, const basic_format_arg< Context > &arg) -> decltype(vis(0))
FMT_CONSTEXPR void on_type(Char type)
FMT_CONSTEXPR FMT_INLINE auto map(short val) -> int
FMT_CONSTEXPR auto next_arg_id() -> int
decltype(to_string_view(std::declval< S >())) result
FMT_CONSTEXPR FMT_INLINE auto map(const unsigned char *val) -> const char *
typename std::enable_if< B, T >::type enable_if_t
auto limit(size_t size) -> size_t
span_constexpr std::size_t size(span< T, Extent > const &spn)
void clear(lua_State *L, int table_index)
constexpr bool is_integral_type(type t)
FMT_CONSTEXPR auto check_cstring_type_spec(Char spec, ErrorHandler &&eh={}) -> bool
friend auto operator<=(basic_string_view lhs, basic_string_view rhs) -> bool
FMT_CONSTEXPR FMT_INLINE auto map(const void *val) -> const void *
FMT_CONSTEXPR FMT_INLINE auto map(unsigned long long val) -> unsigned long long
FMT_CONSTEXPR basic_string_view(S s) FMT_NOEXCEPT
basic_string_view< Char > format_str_
auto named_args() -> named_arg_info< Char > *
#define FMT_ASSERT(condition, message)
FMT_INLINE value(const void *val)
FMT_CONSTEXPR arg_ref(int index)
#define FMT_BEGIN_NAMESPACE
auto count() const -> size_t
auto convert_for_visit(T) -> monostate
FMT_CONSTEXPR value(int id=0)
constexpr FMT_INLINE value(unsigned long long val)
FMT_CONSTEXPR auto out() -> iterator
constexpr FMT_INLINE value(bool val)
constexpr basic_string_view() FMT_NOEXCEPT
FMT_INLINE value(double val)
FMT_CONSTEXPR void on_sign(sign_t s)
auto begin() FMT_NOEXCEPT -> T *
FMT_CONSTEXPR void check_arg_id(int)
FMT_CONSTEXPR auto locale() -> detail::locale_ref
FMT_CONSTEXPR FMT_INLINE value(const char_type *val)
FMT_CONSTEXPR specs_setter(basic_format_specs< Char > &specs)
#define FMT_MODULE_EXPORT_BEGIN
FMT_CONSTEXPR auto make_arg_ref(auto_id) -> arg_ref_type
FMT_CONSTEXPR FMT_INLINE auto map(const T &val) -> const T &
void init_named_args(named_arg_info< Char > *, int, int)
FMT_CONSTEXPR void remove_prefix(size_t n)
std::integral_constant< bool, B > bool_constant
void grow(size_t) final FMT_OVERRIDE
FMT_CONSTEXPR FMT_INLINE auto args() const -> const T *
FMT_CONSTEXPR FMT_INLINE auto map(void *val) -> const void *
FMT_CONSTEXPR auto parse_float_type_spec(const basic_format_specs< Char > &specs, ErrorHandler &&eh={}) -> float_specs
const Char & const_reference
FMT_CONSTEXPR FMT_INLINE auto map(uint128_t val) -> uint128_t
constexpr FMT_INLINE value()
constexpr FMT_INLINE value(char_type val)
constexpr basic_format_parse_context(basic_string_view< Char > format_str, ErrorHandler eh={}, int next_arg_id=0)
buffer(T *p=nullptr, size_t sz=0, size_t cap=0) FMT_NOEXCEPT
constexpr basic_format_context(OutputIt out, basic_format_args< basic_format_context > ctx_args, detail::locale_ref loc=detail::locale_ref())
std::is_constructible< typename Context::template formatter_type< T > > has_formatter
QCXXHighlighter::QCXXHighlighter(QTextDocument *document) m_highlightRule append)({ QRegularExpression(R"(#[a-zA-Z_]+)"), "Preprocessor" })
FMT_CONSTEXPR value(basic_string_view< Char > n)
FMT_CONSTEXPR auto parse_align(const Char *begin, const Char *end, Handler &&handler) -> const Char *
auto capacity() const FMT_NOEXCEPT -> size_t
FMT_CONSTEXPR FMT_INLINE value(basic_string_view< char_type > val)
FMT_CONSTEXPR FMT_INLINE auto map(const char_type *val) -> const char_type *
FMT_CONSTEXPR void check_string_type_spec(Char spec, ErrorHandler &&eh)
FMT_CONSTEXPR auto check_char_specs(const basic_format_specs< Char > &specs, ErrorHandler &&eh={}) -> bool
auto data() FMT_NOEXCEPT -> T *
fixed_buffer_traits(size_t limit)
FMT_CONSTEXPR void on_sign(sign_t s)
custom_value< Context > custom
iterator_buffer(std::back_insert_iterator< Container > out, size_t=0)
friend auto operator<(basic_string_view lhs, basic_string_view rhs) -> bool
FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
FMT_CONSTEXPR void check_int_type_spec(char spec, ErrorHandler &&eh)
const named_arg_info< Char > * data