Variant Utils
Variant Utils module provides functions to operate Luna::Variant objects.
Functions
-
Variant diff(const Variant &before, const Variant &after)
Creates one delta variant that stores changes from
before
toafter
. -
void patch(Variant &before, const Variant &delta)
Applys the difference to the variant, so that it contains the same data as
after
when the diff object is created. -
void revert(Variant &after, const Variant &delta)
Reverts the difference made in
after
, so that it contains the same data asbefore
when the diff object is created. -
void add_diff_prefix(Variant &delta, Span< const Variant > prefix_nodes)
Adds prefix nodes to the delta object.
-
R< Variant > read_json(const c8 *src, usize src_size=USIZE_MAX)
Parses one JSON string.
-
R< Variant > read_json(IStream *stream)
Parses one JSON string.
-
String write_json(const Variant &v, bool indent=true)
Writes one variant object to JSON string.
-
RV write_json(IStream *stream, const Variant &v, bool indent=true)
Writes one variant object to JSON string.
-
Variant new_xml_element(const Name &name)
Creates one variant that represents one XML element.
-
Name get_xml_name(const Variant &xml_element)
Gets the name of one XML element.
-
void set_xml_name(Variant &xml_element, const Name &name)
Sets the name of one XML element.
-
const Variant & get_xml_attributes(const Variant &xml_element)
Gets attributes of one XML element.
-
Variant & get_xml_attributes(Variant &xml_element)
Gets attributes of one XML element.
-
const Variant & get_xml_content(const Variant &xml_element)
Gets content of one XML element.
-
Variant & get_xml_content(Variant &xml_element)
Gets content of one XML element.
-
Finds the first XML child element in the specified XML element with the specified name.
-
R< Variant > read_xml(const void *src, usize src_size=USIZE_MAX)
Parses one XML string.
-
R< Variant > read_xml(IStream *stream)
Parses one XML string.
-
String write_xml(const Variant &v, bool indent=true)
Writes one variant object to XML string.
-
RV write_xml(IStream *stream, const Variant &v, bool indent=true)
Writes one variant object to XML string.