11 #include <string_view> 12 #include <type_traits> 15 #include "quill/bundled/fmt/base.h" 16 #include "quill/core/Attributes.h" 26 virtual ~Node() =
default;
27 std::unique_ptr<Node> next;
31 struct TypedNode : Node
33 template <
typename Arg>
34 explicit TypedNode(Arg&& arg) :
value(_construct(static_cast<Arg&&>(arg)))
39 template <
typename Arg>
40 static T _construct(Arg&& arg)
42 if constexpr (std::is_move_constructible<T>::value)
44 return T(static_cast<Arg&&>(arg));
58 std::unique_ptr<Node> _head;
61 template <
typename T,
typename Arg>
62 T
const& push(Arg&& arg)
64 auto new_node = std::unique_ptr<TypedNode<T>>(
new TypedNode<T>(
static_cast<Arg&&
>(arg)));
65 T&
value = new_node->value;
66 new_node->next =
static_cast<std::unique_ptr<Node>&&
>(_head);
67 _head =
static_cast<std::unique_ptr<TypedNode<T>
>&&>(new_node);
81 std::vector<fmtquill::basic_format_arg<fmtquill::format_context>> _data;
86 bool _has_string_related_type{
false};
89 void emplace_arg(T&& arg)
91 _data.emplace_back(static_cast<T&&>(arg));
97 QUILL_NODISCARD
int size()
const {
return static_cast<int>(_data.size()); }
99 QUILL_NODISCARD fmtquill::basic_format_arg<fmtquill::format_context>
const* data()
const 115 template <
typename T>
119 using bare_type = std::remove_cv_t<std::remove_reference_t<T>>;
120 constexpr
auto mapped_type = fmtquill::detail::mapped_type_constant<bare_type, char_type>::value;
122 std::conditional_t<std::is_convertible_v<bare_type, std::string>, std::string, bare_type>;
124 if constexpr (!(std::is_same_v<bare_type, std::string_view> || std::is_same_v<bare_type, fmtquill::string_view> ||
125 (mapped_type != fmtquill::detail::type::cstring_type &&
126 mapped_type != fmtquill::detail::type::string_type &&
127 mapped_type != fmtquill::detail::type::custom_type)))
129 emplace_arg(_dynamic_arg_list.push<stored_type>(static_cast<T&&>(arg)));
133 emplace_arg(static_cast<T&&>(arg));
136 if constexpr (std::is_same_v<bare_type, std::string_view> || std::is_same_v<bare_type, fmtquill::string_view> ||
137 (mapped_type == fmtquill::detail::type::cstring_type) ||
138 (mapped_type == fmtquill::detail::type::string_type) ||
139 (mapped_type == fmtquill::detail::type::custom_type) ||
140 (mapped_type == fmtquill::detail::type::char_type))
142 _has_string_related_type =
true;
151 _has_string_related_type =
false;
154 QUILL_NODISCARD
bool has_string_related_type()
const noexcept {
return _has_string_related_type; }
char char_type
The character type for the output.
Definition: base.h:2710
Definition: DynamicFormatArgStore.h:22
Setups a signal handler to handle fatal signals.
Definition: BackendManager.h:24