12 #ifndef DOCWIRE_SERIALIZATION_DOCUMENT_ELEMENTS_H
13 #define DOCWIRE_SERIALIZATION_DOCUMENT_ELEMENTS_H
15 #include "attributes.h"
16 #include "document_elements.h"
17 #include "serialization_base.h"
18 #include "serialization_filesystem.h"
32 template <with_styling T>
33 struct serializer<T> {
34 value full(
const T& val)
const {
return object{{{
"styling",
full(val.styling)}}}; }
42 return object{{{
"text", text.text}}};
75 return object{{{
"css_text", style.css_text}}};
Provides a generic, concept-based serialization framework.
value decorate_with_typeid(const value &base_val, const std::string &typeid_str)
Helper to decorate a serialized value with a typeid string.
requires(std::is_arithmetic_v< T > &&!value_alternative< T >) struct serializer< T >
Specialization for arithmetic types (integers, floats).
std::variant< std::nullptr_t, bool, std::int64_t, std::uint64_t, double, std::string, array, object > value
A variant type representing any serialized value.
concept with_styling
Concept for types that have a styling member.
value full(const T &value)
Serializes a value of type T into a docwire::serialization::value.
Represents CSS-like styling information for document elements.
std::vector< std::string > classes
List of CSS classes.
std::string id
Unique identifier for the element.
std::string style
Inline style string.
std::optional< std::string > alt
Optional alternative text for the image.
Primary template for the serializer.