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
const& arg) :
value(arg)
41 std::unique_ptr<Node> _head;
44 template <
typename T,
typename Arg>
45 T
const& push(Arg
const& arg)
47 auto new_node = std::unique_ptr<TypedNode<T>>(
new TypedNode<T>(arg));
48 T&
value = new_node->value;
49 new_node->next = std::move(_head);
50 _head = std::move(new_node);
64 std::vector<fmtquill::basic_format_arg<fmtquill::format_context>> _data;
69 bool _has_string_related_type{
false};
72 void emplace_arg(T
const& arg)
74 _data.emplace_back(arg);
80 QUILL_NODISCARD
int size()
const {
return static_cast<int>(_data.size()); }
82 QUILL_NODISCARD fmtquill::basic_format_arg<fmtquill::format_context>
const* data()
const 102 constexpr
auto mapped_type = fmtquill::detail::mapped_type_constant<T, char_type>::value;
103 using stored_type = std::conditional_t<std::is_convertible_v<T, std::string>, std::string, T>;
105 if constexpr (!(std::is_same_v<std::remove_cv_t<std::remove_reference_t<T>>, std::string_view> ||
106 std::is_same_v<std::remove_cv_t<std::remove_reference_t<T>>, fmtquill::string_view> ||
107 (mapped_type != fmtquill::detail::type::cstring_type &&
108 mapped_type != fmtquill::detail::type::string_type &&
109 mapped_type != fmtquill::detail::type::custom_type)))
111 emplace_arg(_dynamic_arg_list.push<stored_type>(arg));
118 if constexpr (std::is_same_v<std::remove_cv_t<std::remove_reference_t<T>>, std::string_view> ||
119 std::is_same_v<std::remove_cv_t<std::remove_reference_t<T>>, fmtquill::string_view> ||
120 (mapped_type == fmtquill::detail::type::cstring_type) ||
121 (mapped_type == fmtquill::detail::type::string_type) ||
122 (mapped_type == fmtquill::detail::type::custom_type) ||
123 (mapped_type == fmtquill::detail::type::char_type))
125 _has_string_related_type =
true;
134 _has_string_related_type =
false;
137 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:2680
Definition: DynamicFormatArgStore.h:22
Setups a signal handler to handle fatal signals.
Definition: BackendManager.h:24