WPILibC++ 2025.2.1
Loading...
Searching...
No Matches
std.h
Go to the documentation of this file.
1// Formatting library for C++ - formatters for standard library types
2//
3// Copyright (c) 2012 - present, Victor Zverovich
4// All rights reserved.
5//
6// For the license information refer to format.h.
7
8#ifndef FMT_STD_H_
9#define FMT_STD_H_
10
11#include "format.h"
12#include "ostream.h"
13
14#ifndef FMT_MODULE
15# include <atomic>
16# include <bitset>
17# include <complex>
18# include <cstdlib>
19# include <exception>
20# include <functional>
21# include <memory>
22# include <thread>
23# include <type_traits>
24# include <typeinfo>
25# include <utility>
26# include <vector>
27
28// Check FMT_CPLUSPLUS to suppress a bogus warning in MSVC.
29# if FMT_CPLUSPLUS >= 201703L
30# if FMT_HAS_INCLUDE(<filesystem>) && \
31 (!defined(FMT_CPP_LIB_FILESYSTEM) || FMT_CPP_LIB_FILESYSTEM != 0)
32# include <filesystem>
33# endif
34# if FMT_HAS_INCLUDE(<variant>)
35# include <variant>
36# endif
37# if FMT_HAS_INCLUDE(<optional>)
38# include <optional>
39# endif
40# endif
41// Use > instead of >= in the version check because <source_location> may be
42// available after C++17 but before C++20 is marked as implemented.
43# if FMT_CPLUSPLUS > 201703L && FMT_HAS_INCLUDE(<source_location>)
44# include <source_location>
45# endif
46# if FMT_CPLUSPLUS > 202002L && FMT_HAS_INCLUDE(<expected>)
47# include <expected>
48# endif
49#endif // FMT_MODULE
50
51#if FMT_HAS_INCLUDE(<version>)
52# include <version>
53#endif
54
55// GCC 4 does not support FMT_HAS_INCLUDE.
56#if FMT_HAS_INCLUDE(<cxxabi.h>) || defined(__GLIBCXX__)
57# include <cxxabi.h>
58// Android NDK with gabi++ library on some architectures does not implement
59// abi::__cxa_demangle().
60# ifndef __GABIXX_CXXABI_H__
61# define FMT_HAS_ABI_CXA_DEMANGLE
62# endif
63#endif
64
65// For older Xcode versions, __cpp_lib_xxx flags are inaccurately defined.
66#ifndef FMT_CPP_LIB_FILESYSTEM
67# ifdef __cpp_lib_filesystem
68# define FMT_CPP_LIB_FILESYSTEM __cpp_lib_filesystem
69# else
70# define FMT_CPP_LIB_FILESYSTEM 0
71# endif
72#endif
73
74#ifndef FMT_CPP_LIB_VARIANT
75# ifdef __cpp_lib_variant
76# define FMT_CPP_LIB_VARIANT __cpp_lib_variant
77# else
78# define FMT_CPP_LIB_VARIANT 0
79# endif
80#endif
81
82#if FMT_CPP_LIB_FILESYSTEM
84
85namespace detail {
86
87template <typename Char, typename PathChar>
88auto get_path_string(const std::filesystem::path& p,
89 const std::basic_string<PathChar>& native) {
90 if constexpr (std::is_same_v<Char, char> && std::is_same_v<PathChar, wchar_t>)
91 return to_utf8<wchar_t>(native, to_utf8_error_policy::replace);
92 else
93 return p.string<Char>();
94}
95
96template <typename Char, typename PathChar>
97void write_escaped_path(basic_memory_buffer<Char>& quoted,
98 const std::filesystem::path& p,
99 const std::basic_string<PathChar>& native) {
100 if constexpr (std::is_same_v<Char, char> &&
101 std::is_same_v<PathChar, wchar_t>) {
102 auto buf = basic_memory_buffer<wchar_t>();
103 write_escaped_string<wchar_t>(std::back_inserter(buf), native);
104 bool valid = to_utf8<wchar_t>::convert(quoted, {buf.data(), buf.size()});
105 FMT_ASSERT(valid, "invalid utf16");
106 } else if constexpr (std::is_same_v<Char, PathChar>) {
108 std::back_inserter(quoted), native);
109 } else {
110 write_escaped_string<Char>(std::back_inserter(quoted), p.string<Char>());
111 }
112}
113
114} // namespace detail
115
117template <typename Char> struct formatter<std::filesystem::path, Char> {
118 private:
119 format_specs specs_;
120 detail::arg_ref<Char> width_ref_;
121 bool debug_ = false;
122 char path_type_ = 0;
123
124 public:
125 FMT_CONSTEXPR void set_debug_format(bool set = true) { debug_ = set; }
126
127 FMT_CONSTEXPR auto parse(parse_context<Char>& ctx) {
128 auto it = ctx.begin(), end = ctx.end();
129 if (it == end) return it;
130
131 it = detail::parse_align(it, end, specs_);
132 if (it == end) return it;
133
134 Char c = *it;
135 if ((c >= '0' && c <= '9') || c == '{')
136 it = detail::parse_width(it, end, specs_, width_ref_, ctx);
137 if (it != end && *it == '?') {
138 debug_ = true;
139 ++it;
140 }
141 if (it != end && (*it == 'g')) path_type_ = detail::to_ascii(*it++);
142 return it;
143 }
144
145 template <typename FormatContext>
146 auto format(const std::filesystem::path& p, FormatContext& ctx) const {
147 auto specs = specs_;
148 auto path_string =
149 !path_type_ ? p.native()
150 : p.generic_string<std::filesystem::path::value_type>();
151
152 detail::handle_dynamic_spec(specs.dynamic_width(), specs.width, width_ref_,
153 ctx);
154 if (!debug_) {
155 auto s = detail::get_path_string<Char>(p, path_string);
156 return detail::write(ctx.out(), basic_string_view<Char>(s), specs);
157 }
158 auto quoted = basic_memory_buffer<Char>();
159 detail::write_escaped_path(quoted, p, path_string);
160 return detail::write(ctx.out(),
161 basic_string_view<Char>(quoted.data(), quoted.size()),
162 specs);
163 }
164};
165
166class path : public std::filesystem::path {
167 public:
168 auto display_string() const -> std::string {
169 const std::filesystem::path& base = *this;
170 return fmt::format(FMT_STRING("{}"), base);
171 }
172 auto system_string() const -> std::string { return string(); }
173
174 auto generic_display_string() const -> std::string {
175 const std::filesystem::path& base = *this;
176 return fmt::format(FMT_STRING("{:g}"), base);
177 }
178 auto generic_system_string() const -> std::string { return generic_string(); }
179};
180
182#endif // FMT_CPP_LIB_FILESYSTEM
183
186template <std::size_t N, typename Char>
187struct formatter<std::bitset<N>, Char> : nested_formatter<string_view> {
188 private:
189 // Functor because C++11 doesn't support generic lambdas.
190 struct writer {
191 const std::bitset<N>& bs;
192
193 template <typename OutputIt>
194 FMT_CONSTEXPR auto operator()(OutputIt out) -> OutputIt {
195 for (auto pos = N; pos > 0; --pos) {
196 out = detail::write<Char>(out, bs[pos - 1] ? Char('1') : Char('0'));
197 }
198
199 return out;
200 }
201 };
202
203 public:
204 template <typename FormatContext>
205 auto format(const std::bitset<N>& bs, FormatContext& ctx) const
206 -> decltype(ctx.out()) {
207 return write_padded(ctx, writer{bs});
208 }
209};
210
212template <typename Char>
213struct formatter<std::thread::id, Char> : basic_ostream_formatter<Char> {};
215
216#ifdef __cpp_lib_optional
219template <typename T, typename Char>
220struct formatter<std::optional<T>, Char,
221 std::enable_if_t<is_formattable<T, Char>::value>> {
222 private:
223 formatter<T, Char> underlying_;
224 static constexpr basic_string_view<Char> optional =
225 detail::string_literal<Char, 'o', 'p', 't', 'i', 'o', 'n', 'a', 'l',
226 '('>{};
227 static constexpr basic_string_view<Char> none =
228 detail::string_literal<Char, 'n', 'o', 'n', 'e'>{};
229
230 template <class U>
231 FMT_CONSTEXPR static auto maybe_set_debug_format(U& u, bool set)
232 -> decltype(u.set_debug_format(set)) {
233 u.set_debug_format(set);
234 }
235
236 template <class U>
237 FMT_CONSTEXPR static void maybe_set_debug_format(U&, ...) {}
238
239 public:
240 FMT_CONSTEXPR auto parse(parse_context<Char>& ctx) {
241 maybe_set_debug_format(underlying_, true);
242 return underlying_.parse(ctx);
243 }
244
245 template <typename FormatContext>
246 auto format(const std::optional<T>& opt, FormatContext& ctx) const
247 -> decltype(ctx.out()) {
248 if (!opt) return detail::write<Char>(ctx.out(), none);
249
250 auto out = ctx.out();
251 out = detail::write<Char>(out, optional);
252 ctx.advance_to(out);
253 out = underlying_.format(*opt, ctx);
254 return detail::write(out, ')');
255 }
256};
258#endif // __cpp_lib_optional
259
260#if defined(__cpp_lib_expected) || FMT_CPP_LIB_VARIANT
261
263namespace detail {
264
265template <typename Char, typename OutputIt, typename T>
266auto write_escaped_alternative(OutputIt out, const T& v) -> OutputIt {
267 if constexpr (has_to_string_view<T>::value)
269 if constexpr (std::is_same_v<T, Char>) return write_escaped_char(out, v);
270 return write<Char>(out, v);
271}
272
273} // namespace detail
274
276#endif
277
278#ifdef __cpp_lib_expected
280
282template <typename T, typename E, typename Char>
283struct formatter<std::expected<T, E>, Char,
284 std::enable_if_t<(std::is_void<T>::value ||
285 is_formattable<T, Char>::value) &&
286 is_formattable<E, Char>::value>> {
287 FMT_CONSTEXPR auto parse(parse_context<Char>& ctx) -> const Char* {
288 return ctx.begin();
289 }
290
291 template <typename FormatContext>
292 auto format(const std::expected<T, E>& value, FormatContext& ctx) const
293 -> decltype(ctx.out()) {
294 auto out = ctx.out();
295
296 if (value.has_value()) {
297 out = detail::write<Char>(out, "expected(");
298 if constexpr (!std::is_void<T>::value)
299 out = detail::write_escaped_alternative<Char>(out, *value);
300 } else {
301 out = detail::write<Char>(out, "unexpected(");
302 out = detail::write_escaped_alternative<Char>(out, value.error());
303 }
304 *out++ = ')';
305 return out;
306 }
307};
309#endif // __cpp_lib_expected
310
311#ifdef __cpp_lib_source_location
314template <> struct formatter<std::source_location> {
315 FMT_CONSTEXPR auto parse(parse_context<>& ctx) { return ctx.begin(); }
316
317 template <typename FormatContext>
318 auto format(const std::source_location& loc, FormatContext& ctx) const
319 -> decltype(ctx.out()) {
320 auto out = ctx.out();
321 out = detail::write(out, loc.file_name());
322 out = detail::write(out, ':');
323 out = detail::write<char>(out, loc.line());
324 out = detail::write(out, ':');
325 out = detail::write<char>(out, loc.column());
326 out = detail::write(out, ": ");
327 out = detail::write(out, loc.function_name());
328 return out;
329 }
330};
332#endif
333
334#if FMT_CPP_LIB_VARIANT
336namespace detail {
337
338template <typename T>
339using variant_index_sequence =
340 std::make_index_sequence<std::variant_size<T>::value>;
341
342template <typename> struct is_variant_like_ : std::false_type {};
343template <typename... Types>
344struct is_variant_like_<std::variant<Types...>> : std::true_type {};
345
346// formattable element check.
347template <typename T, typename C> class is_variant_formattable_ {
348 template <std::size_t... Is>
349 static std::conjunction<
351 check(std::index_sequence<Is...>);
352
353 public:
354 static constexpr const bool value =
355 decltype(check(variant_index_sequence<T>{}))::value;
356};
357
358} // namespace detail
359
360template <typename T> struct is_variant_like {
361 static constexpr const bool value = detail::is_variant_like_<T>::value;
362};
363
364template <typename T, typename C> struct is_variant_formattable {
365 static constexpr const bool value =
366 detail::is_variant_formattable_<T, C>::value;
367};
368
370template <typename Char> struct formatter<std::monostate, Char> {
371 FMT_CONSTEXPR auto parse(parse_context<Char>& ctx) -> const Char* {
372 return ctx.begin();
373 }
374
375 template <typename FormatContext>
376 auto format(const std::monostate&, FormatContext& ctx) const
377 -> decltype(ctx.out()) {
378 return detail::write<Char>(ctx.out(), "monostate");
379 }
380};
381
383template <typename Variant, typename Char>
384struct formatter<
385 Variant, Char,
386 std::enable_if_t<std::conjunction_v<
387 is_variant_like<Variant>, is_variant_formattable<Variant, Char>>>> {
388 FMT_CONSTEXPR auto parse(parse_context<Char>& ctx) -> const Char* {
389 return ctx.begin();
390 }
391
392 template <typename FormatContext>
393 auto format(const Variant& value, FormatContext& ctx) const
394 -> decltype(ctx.out()) {
395 auto out = ctx.out();
396
397 out = detail::write<Char>(out, "variant(");
398 FMT_TRY {
399 std::visit(
400 [&](const auto& v) {
401 out = detail::write_escaped_alternative<Char>(out, v);
402 },
403 value);
404 }
405 FMT_CATCH(const std::bad_variant_access&) {
406 detail::write<Char>(out, "valueless by exception");
407 }
408 *out++ = ')';
409 return out;
410 }
411};
413#endif // FMT_CPP_LIB_VARIANT
414
417template <> struct formatter<std::error_code> {
418 private:
419 format_specs specs_;
420 detail::arg_ref<char> width_ref_;
421
422 public:
423 FMT_CONSTEXPR auto parse(parse_context<>& ctx) -> const char* {
424 auto it = ctx.begin(), end = ctx.end();
425 if (it == end) return it;
426
427 it = detail::parse_align(it, end, specs_);
428 if (it == end) return it;
429
430 char c = *it;
431 if ((c >= '0' && c <= '9') || c == '{')
432 it = detail::parse_width(it, end, specs_, width_ref_, ctx);
433 return it;
434 }
435
436 template <typename FormatContext>
437 FMT_CONSTEXPR20 auto format(const std::error_code& ec,
438 FormatContext& ctx) const -> decltype(ctx.out()) {
439 auto specs = specs_;
440 detail::handle_dynamic_spec(specs.dynamic_width(), specs.width, width_ref_,
441 ctx);
442 memory_buffer buf;
443 buf.append(string_view(ec.category().name()));
444 buf.push_back(':');
445 detail::write<char>(appender(buf), ec.value());
446 return detail::write<char>(ctx.out(), string_view(buf.data(), buf.size()),
447 specs);
448 }
449};
450
451#if FMT_USE_RTTI
452namespace detail {
453
454template <typename Char, typename OutputIt>
455auto write_demangled_name(OutputIt out, const std::type_info& ti) -> OutputIt {
456# ifdef FMT_HAS_ABI_CXA_DEMANGLE
457 int status = 0;
458 std::size_t size = 0;
459 std::unique_ptr<char, void (*)(void*)> demangled_name_ptr(
460 abi::__cxa_demangle(ti.name(), nullptr, &size, &status), &std::free);
461
462 string_view demangled_name_view;
463 if (demangled_name_ptr) {
464 demangled_name_view = demangled_name_ptr.get();
465
466 // Normalization of stdlib inline namespace names.
467 // libc++ inline namespaces.
468 // std::__1::* -> std::*
469 // std::__1::__fs::* -> std::*
470 // libstdc++ inline namespaces.
471 // std::__cxx11::* -> std::*
472 // std::filesystem::__cxx11::* -> std::filesystem::*
473 if (demangled_name_view.starts_with("std::")) {
474 char* begin = demangled_name_ptr.get();
475 char* to = begin + 5; // std::
476 for (char *from = to, *end = begin + demangled_name_view.size();
477 from < end;) {
478 // This is safe, because demangled_name is NUL-terminated.
479 if (from[0] == '_' && from[1] == '_') {
480 char* next = from + 1;
481 while (next < end && *next != ':') next++;
482 if (next[0] == ':' && next[1] == ':') {
483 from = next + 2;
484 continue;
485 }
486 }
487 *to++ = *from++;
488 }
489 demangled_name_view = {begin, detail::to_unsigned(to - begin)};
490 }
491 } else {
492 demangled_name_view = string_view(ti.name());
493 }
494 return detail::write_bytes<Char>(out, demangled_name_view);
495# elif FMT_MSC_VERSION
496 const string_view demangled_name(ti.name());
497 for (std::size_t i = 0; i < demangled_name.size(); ++i) {
498 auto sub = demangled_name;
499 sub.remove_prefix(i);
500 if (sub.starts_with("enum ")) {
501 i += 4;
502 continue;
503 }
504 if (sub.starts_with("class ") || sub.starts_with("union ")) {
505 i += 5;
506 continue;
507 }
508 if (sub.starts_with("struct ")) {
509 i += 6;
510 continue;
511 }
512 if (*sub.begin() != ' ') *out++ = *sub.begin();
513 }
514 return out;
515# else
516 return detail::write_bytes<Char>(out, string_view(ti.name()));
517# endif
518}
519
520} // namespace detail
521
523template <typename Char>
524struct formatter<std::type_info, Char // DEPRECATED! Mixing code unit types.
525 > {
526 public:
527 FMT_CONSTEXPR auto parse(parse_context<Char>& ctx) -> const Char* {
528 return ctx.begin();
529 }
530
531 template <typename Context>
532 auto format(const std::type_info& ti, Context& ctx) const
533 -> decltype(ctx.out()) {
534 return detail::write_demangled_name<Char>(ctx.out(), ti);
535 }
536};
537#endif
538
540template <typename T, typename Char>
542 T, Char, // DEPRECATED! Mixing code unit types.
543 typename std::enable_if<std::is_base_of<std::exception, T>::value>::type> {
544 private:
545 bool with_typename_ = false;
546
547 public:
548 FMT_CONSTEXPR auto parse(parse_context<Char>& ctx) -> const Char* {
549 auto it = ctx.begin();
550 auto end = ctx.end();
551 if (it == end || *it == '}') return it;
552 if (*it == 't') {
553 ++it;
554 with_typename_ = FMT_USE_RTTI != 0;
555 }
556 return it;
557 }
558
559 template <typename Context>
560 auto format(const std::exception& ex, Context& ctx) const
561 -> decltype(ctx.out()) {
562 auto out = ctx.out();
563#if FMT_USE_RTTI
564 if (with_typename_) {
565 out = detail::write_demangled_name<Char>(out, typeid(ex));
566 *out++ = ':';
567 *out++ = ' ';
568 }
569#endif
570 return detail::write_bytes<Char>(out, string_view(ex.what()));
571 }
572};
573
574namespace detail {
575
576template <typename T, typename Enable = void>
577struct has_flip : std::false_type {};
578
579template <typename T>
580struct has_flip<T, void_t<decltype(std::declval<T>().flip())>>
581 : std::true_type {};
582
583template <typename T> struct is_bit_reference_like {
584 static constexpr const bool value =
585 std::is_convertible<T, bool>::value &&
586 std::is_nothrow_assignable<T, bool>::value && has_flip<T>::value;
587};
588
589#ifdef _LIBCPP_VERSION
590
591// Workaround for libc++ incompatibility with C++ standard.
592// According to the Standard, `bitset::operator[] const` returns bool.
593template <typename C>
594struct is_bit_reference_like<std::__bit_const_reference<C>> {
595 static constexpr const bool value = true;
596};
597
598#endif
599
600} // namespace detail
601
602// We can't use std::vector<bool, Allocator>::reference and
603// std::bitset<N>::reference because the compiler can't deduce Allocator and N
604// in partial specialization.
606template <typename BitRef, typename Char>
607struct formatter<BitRef, Char,
608 enable_if_t<detail::is_bit_reference_like<BitRef>::value>>
609 : formatter<bool, Char> {
610 template <typename FormatContext>
611 FMT_CONSTEXPR auto format(const BitRef& v, FormatContext& ctx) const
612 -> decltype(ctx.out()) {
613 return formatter<bool, Char>::format(v, ctx);
614 }
615};
616
617template <typename T, typename Deleter>
618auto ptr(const std::unique_ptr<T, Deleter>& p) -> const void* {
619 return p.get();
620}
621template <typename T> auto ptr(const std::shared_ptr<T>& p) -> const void* {
622 return p.get();
623}
624
626template <typename T, typename Char>
627struct formatter<std::atomic<T>, Char,
628 enable_if_t<is_formattable<T, Char>::value>>
629 : formatter<T, Char> {
630 template <typename FormatContext>
631 auto format(const std::atomic<T>& v, FormatContext& ctx) const
632 -> decltype(ctx.out()) {
633 return formatter<T, Char>::format(v.load(), ctx);
634 }
635};
636
637#ifdef __cpp_lib_atomic_flag_test
639template <typename Char>
640struct formatter<std::atomic_flag, Char> : formatter<bool, Char> {
641 template <typename FormatContext>
642 auto format(const std::atomic_flag& v, FormatContext& ctx) const
643 -> decltype(ctx.out()) {
644 return formatter<bool, Char>::format(v.test(), ctx);
645 }
646};
647#endif // __cpp_lib_atomic_flag_test
648
650template <typename T, typename Char> struct formatter<std::complex<T>, Char> {
651 private:
653
654 template <typename FormatContext, typename OutputIt>
655 FMT_CONSTEXPR auto do_format(const std::complex<T>& c,
657 FormatContext& ctx, OutputIt out) const
658 -> OutputIt {
659 if (c.real() != 0) {
660 *out++ = Char('(');
661 out = detail::write<Char>(out, c.real(), specs, ctx.locale());
662 specs.set_sign(sign::plus);
663 out = detail::write<Char>(out, c.imag(), specs, ctx.locale());
664 if (!detail::isfinite(c.imag())) *out++ = Char(' ');
665 *out++ = Char('i');
666 *out++ = Char(')');
667 return out;
668 }
669 out = detail::write<Char>(out, c.imag(), specs, ctx.locale());
670 if (!detail::isfinite(c.imag())) *out++ = Char(' ');
671 *out++ = Char('i');
672 return out;
673 }
674
675 public:
676 FMT_CONSTEXPR auto parse(parse_context<Char>& ctx) -> const Char* {
677 if (ctx.begin() == ctx.end() || *ctx.begin() == '}') return ctx.begin();
678 return parse_format_specs(ctx.begin(), ctx.end(), specs_, ctx,
680 }
681
682 template <typename FormatContext>
683 auto format(const std::complex<T>& c, FormatContext& ctx) const
684 -> decltype(ctx.out()) {
685 auto specs = specs_;
686 if (specs.dynamic()) {
688 specs.width_ref, ctx);
690 specs.precision_ref, ctx);
691 }
692
693 if (specs.width == 0) return do_format(c, specs, ctx, ctx.out());
694 auto buf = basic_memory_buffer<Char>();
695
696 auto outer_specs = format_specs();
697 outer_specs.width = specs.width;
698 auto fill = specs.template fill<Char>();
699 if (fill)
700 outer_specs.set_fill(basic_string_view<Char>(fill, specs.fill_size()));
701 outer_specs.set_align(specs.align());
702
703 specs.width = 0;
704 specs.set_fill({});
705 specs.set_align(align::none);
706
707 do_format(c, specs, ctx, basic_appender<Char>(buf));
708 return detail::write<Char>(ctx.out(),
709 basic_string_view<Char>(buf.data(), buf.size()),
710 outer_specs);
711 }
712};
713
715template <typename T, typename Char>
716struct formatter<std::reference_wrapper<T>, Char,
717 enable_if_t<is_formattable<remove_cvref_t<T>, Char>::value>>
718 : formatter<remove_cvref_t<T>, Char> {
719 template <typename FormatContext>
720 auto format(std::reference_wrapper<T> ref, FormatContext& ctx) const
721 -> decltype(ctx.out()) {
722 return formatter<remove_cvref_t<T>, Char>::format(ref.get(), ctx);
723 }
724};
725
727#endif // FMT_STD_H_
and restrictions which apply to each piece of software is included later in this file and or inside of the individual applicable source files The disclaimer of warranty in the WPILib license above applies to all code in and nothing in any of the other licenses gives permission to use the names of FIRST nor the names of the WPILib contributors to endorse or promote products derived from this software The following pieces of software have additional or alternate and or and nanopb were all modified for use in Google Inc All rights reserved Redistribution and use in source and binary with or without are permitted provided that the following conditions are this list of conditions and the following disclaimer *Redistributions in binary form must reproduce the above copyright this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution *Neither the name of Google Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY OR CONSEQUENTIAL WHETHER IN STRICT OR EVEN IF ADVISED OF THE POSSIBILITY OF SUCH January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source including but not limited to compiled object generated and conversions to other media types Work shall mean the work of whether in Source or Object made available under the as indicated by a copyright notice that is included in or attached to the whether in Source or Object that is based or other modifications as a an original work of authorship For the purposes of this Derivative Works shall not include works that remain separable from
Definition ThirdPartyNotices.txt:141
Definition base.h:2408
A dynamically growing memory buffer for trivially copyable/constructible types with the first SIZE el...
Definition format.h:790
FMT_CONSTEXPR20 void append(const ContiguousRange &range)
Definition format.h:886
constexpr bool dynamic() const
Definition base.h:768
FMT_CONSTEXPR void set_fill(char c)
Definition base.h:811
constexpr auto align() const -> align
Definition base.h:745
FMT_CONSTEXPR auto dynamic_precision() const -> arg_id_kind
Definition base.h:759
FMT_CONSTEXPR void set_sign(fmt::sign s)
Definition base.h:775
constexpr auto dynamic_width() const -> arg_id_kind
Definition base.h:752
FMT_CONSTEXPR void set_align(fmt::align a)
Definition base.h:748
constexpr auto fill_size() const -> size_t
Definition base.h:791
An implementation of std::basic_string_view for pre-C++17.
Definition base.h:504
constexpr auto size() const noexcept -> size_t
Returns the string size.
Definition base.h:549
FMT_CONSTEXPR auto starts_with(basic_string_view< Char > sv) const noexcept -> bool
Definition base.h:563
FMT_CONSTEXPR void push_back(const T &value)
Definition base.h:1767
constexpr auto size() const noexcept -> size_t
Returns the size of this buffer.
Definition base.h:1740
FMT_CONSTEXPR auto data() noexcept -> T *
Returns a pointer to the buffer data (not null-terminated).
Definition base.h:1746
auto convert(basic_string_view< WChar > s, to_utf8_error_policy policy=to_utf8_error_policy::abort) -> bool
Definition format.h:1311
Definition base.h:2081
Parsing context consisting of a format string range being parsed and an argument counter for automati...
Definition base.h:845
constexpr auto begin() const noexcept -> iterator
Returns an iterator to the beginning of the format string range being parsed.
Definition base.h:864
FMT_CONSTEXPR void advance_to(iterator it)
Advances the begin iterator to it.
Definition base.h:870
constexpr auto end() const noexcept -> iterator
Returns an iterator past the end of the format string range being parsed.
Definition base.h:867
#define FMT_STRING(s)
Constructs a legacy compile-time format string from a string literal s.
Definition format.h:4092
FMT_INLINE auto format(detail::locale_ref loc, format_string< T... > fmt, T &&... args) -> std::string
Definition format.h:4146
#define FMT_USE_RTTI
Definition format.h:104
detail namespace with internal helper functions
Definition input_adapters.h:32
FMT_CONSTEXPR20 auto isfinite(T value) -> bool
Definition format.h:2486
constexpr auto to_ascii(Char c) -> char
Definition base.h:1242
FMT_CONSTEXPR auto write(OutputIt out, Char value, const format_specs &specs, locale_ref loc={}) -> OutputIt
Definition format.h:1824
FMT_CONSTEXPR auto write_bytes(OutputIt out, string_view bytes, const format_specs &specs={}) -> OutputIt
Definition format.h:1670
@ value
the parser finished reading a JSON value
FMT_CONSTEXPR auto to_unsigned(Int value) -> make_unsigned_t< Int >
Definition base.h:422
auto write_escaped_char(OutputIt out, Char v) -> OutputIt
Definition format.h:1798
FMT_CONSTEXPR auto parse_width(const Char *begin, const Char *end, format_specs &specs, arg_ref< Char > &width_ref, parse_context< Char > &ctx) -> const Char *
Definition base.h:1378
typename make_void< Ts... >::type void_t
Definition void_t.h:21
FMT_CONSTEXPR auto parse_align(const Char *begin, const Char *end, format_specs &specs) -> const Char *
Definition format.h:2184
constexpr auto to_string_view(const Char *s) -> basic_string_view< Char >
Definition base.h:910
FMT_CONSTEXPR void handle_dynamic_spec(arg_id_kind kind, int &value, const arg_ref< typename Context::char_type > &ref, Context &ctx)
Definition format.h:3548
FMT_CONSTEXPR auto maybe_set_debug_format(Formatter &f, bool set) -> decltype(f.set_debug_format(set))
Definition ranges.h:240
auto write_escaped_string(OutputIt out, basic_string_view< Char > str) -> OutputIt
Definition format.h:1782
Implement std::hash so that hash_code can be used in STL containers.
Definition PointerIntPair.h:280
auto ptr(const std::unique_ptr< T, Deleter > &p) -> const void *
Definition std.h:618
Definition ostream.h:75
Definition base.h:1235
arg_ref< Char > width_ref
Definition base.h:1236
arg_ref< Char > precision_ref
Definition base.h:1237
Definition std.h:577
Definition std.h:583
Definition format.h:247
Definition base.h:962
Definition base.h:834
int width
Definition base.h:835
int precision
Definition base.h:836
FMT_CONSTEXPR auto format(const BitRef &v, FormatContext &ctx) const -> decltype(ctx.out())
Definition std.h:611
FMT_CONSTEXPR auto parse(parse_context< Char > &ctx) -> const Char *
Definition std.h:548
auto format(const std::exception &ex, Context &ctx) const -> decltype(ctx.out())
Definition std.h:560
auto format(const std::atomic< T > &v, FormatContext &ctx) const -> decltype(ctx.out())
Definition std.h:631
auto format(const std::bitset< N > &bs, FormatContext &ctx) const -> decltype(ctx.out())
Definition std.h:205
auto format(const std::complex< T > &c, FormatContext &ctx) const -> decltype(ctx.out())
Definition std.h:683
FMT_CONSTEXPR auto parse(parse_context< Char > &ctx) -> const Char *
Definition std.h:676
FMT_CONSTEXPR20 auto format(const std::error_code &ec, FormatContext &ctx) const -> decltype(ctx.out())
Definition std.h:437
FMT_CONSTEXPR auto parse(parse_context<> &ctx) -> const char *
Definition std.h:423
auto format(std::reference_wrapper< T > ref, FormatContext &ctx) const -> decltype(ctx.out())
Definition std.h:720
Definition base.h:651
Definition base.h:324
Definition format.h:3945
Definition base.h:1224
typename std::enable_if< B, T >::type enable_if_t
Definition base.h:297
#define FMT_ASSERT(condition, message)
Definition base.h:381
basic_string_view< char > string_view
Definition base.h:603
#define FMT_TRY
Definition base.h:160
basic_appender< char > appender
Definition base.h:619
#define FMT_CONSTEXPR
Definition base.h:113
#define FMT_BEGIN_NAMESPACE
Definition base.h:239
#define FMT_CATCH(x)
Definition base.h:161
#define FMT_CONSTEXPR20
Definition base.h:141
#define FMT_END_NAMESPACE
Definition base.h:242
#define FMT_EXPORT
Definition base.h:248
bool_constant<!std::is_same< detail::mapped_t< conditional_t< std::is_void< T >::value, int *, T >, Char >, void >::value > is_formattable
Definition base.h:2723