9#include "../markdown.hpp"
10#include "../microfmt.hpp"
11#include "../reloco.hpp"
12#include <reloco/type_id.hpp>
25 microfmt::string_view key{};
26 value_ptr<const void> val_ptr{};
33 if (print_fn !=
nullptr && val_ptr) {
34 print_fn(val_ptr.get(), out);
64 constexpr metadata_map(
void *ctx RELOCO_LIFETIMEBOUND RELOCO_LIFETIME_CAPTURE_BY_THIS,
66 : m_ctx(ctx), m_next_fn(next_fn) {}
74 if (m_next_fn !=
nullptr && m_ctx) {
75 return m_next_fn(m_ctx.get(), out);
81 value_ptr<void> m_ctx{};
82 metadata_next_fn_t m_next_fn{
nullptr};
93template <>
struct formatter<
microfmt::metadata_map> {
94 constexpr void parse(format_parse_context &)
noexcept {}
102 while (map.get_next(entry)) {
107 entry.format_value(out);
127 string_view
title =
"Metadata Properties") noexcept {
Definition markdown.hpp:431
table_writer & row(const Cells &...cells) &noexcept
Definition markdown.hpp:437
Definition markdown.hpp:43
writer & h3(microfmt::string_view title) &noexcept
Definition markdown.hpp:99
Output sink that writes formatted characters into a fixed-size contiguous memory buffer.
Definition microfmt.hpp:60
RELOCO_REINITIALIZES constexpr void reset() noexcept
Resets the write offset back to the beginning of the buffer.
Definition microfmt.hpp:135
sink as_sink() noexcept RELOCO_LIFETIMEBOUND
Creates a type-erased sink adapter pointing to this instance.
Definition microfmt.hpp:93
constexpr microfmt::string_view view() const noexcept RELOCO_LIFETIMEBOUND
Returns a string view over the characters written so far.
Definition microfmt.hpp:112
#define MICROFMT_API_CLASS
Definition compat.hpp:181
Definition metadata_map.hpp:116
void write_metadata_table(writer &w, metadata_map map, span< char > scratch_buf, string_view title="Metadata Properties") noexcept
Streams any type-erased metadata_map view into a Markdown table.
Definition metadata_map.hpp:126
reloco::sink sink
Type-erased, zero-allocation output sink.
Definition microfmt.hpp:46
RELOCO_CONSTEXPR20 void format_to(const sink &out, microfmt::string_view fmt, const Args &...args) noexcept
Definition microfmt.hpp:1766
RELOCO_CONSTEXPR20 buffer_sink< N > format(microfmt::string_view fmt, const Args &...args) noexcept
Definition microfmt.hpp:1786
void(*)(const void *val_ptr, const sink &out) noexcept property_print_fn_t
Function pointer signature for type-erased property value formatting.
Definition metadata_map.hpp:19
bool(*)(void *ctx, property_entry &out) noexcept metadata_next_fn_t
Function pointer signature for fetching the next property entry.
Definition metadata_map.hpp:48
Definition markdown.hpp:26
Type-erased property entry synthesized during generation.
Definition metadata_map.hpp:24
void format_value(const sink &out) const noexcept
Formats the underlying property value using its type-erased thunk.
Definition metadata_map.hpp:32
microfmt::string_view key
Definition metadata_map.hpp:25