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);
83 std::vector<fmtquill::basic_format_arg<fmtquill::format_context>> _data;
88 bool _has_string_related_type{
false};
91 void emplace_arg(T&& arg)
93 _data.emplace_back(static_cast<T&&>(arg));
99 QUILL_NODISCARD
int size()
const {
return static_cast<int>(_data.size()); }
101 QUILL_NODISCARD fmtquill::basic_format_arg<fmtquill::format_context>
const* data()
const 117 template <
typename T>
121 using bare_type = std::remove_cv_t<std::remove_reference_t<T>>;
122 constexpr
auto mapped_type = fmtquill::detail::mapped_type_constant<bare_type, char_type>::value;
124 std::conditional_t<std::is_convertible_v<bare_type, std::string>, std::string, bare_type>;
126 if constexpr (!(std::is_same_v<bare_type, std::string_view> || std::is_same_v<bare_type, fmtquill::string_view> ||
127 (mapped_type != fmtquill::detail::type::cstring_type &&
128 mapped_type != fmtquill::detail::type::string_type &&
129 mapped_type != fmtquill::detail::type::custom_type)))
131 emplace_arg(_dynamic_arg_list.push<stored_type>(static_cast<T&&>(arg)));
135 emplace_arg(static_cast<T&&>(arg));
138 if constexpr (std::is_same_v<bare_type, std::string_view> || std::is_same_v<bare_type, fmtquill::string_view> ||
139 (mapped_type == fmtquill::detail::type::cstring_type) ||
140 (mapped_type == fmtquill::detail::type::string_type) ||
141 (mapped_type == fmtquill::detail::type::custom_type) ||
142 (mapped_type == fmtquill::detail::type::char_type))
144 _has_string_related_type =
true;
153 _has_string_related_type =
false;
156 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:2712
Definition: DynamicFormatArgStore.h:22
Setups a signal handler to handle fatal signals.
Definition: BackendManager.h:28