Donner SVG main
0.8.0 ยท 766e862a0.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::svg::parser::AttributeParser Class Reference

Parses XML attributes and sets applies them to SVGElements. More...

#include "donner/svg/parser/AttributeParser.h"

Static Public Member Functions

static std::optional< ParseDiagnostic > ParseAndSetAttribute (SVGParserContext &context, SVGElement &element, const xml::XMLQualifiedNameRef &name, std::string_view value) noexcept
 Parse an XML attribute and set it on the given element.
static std::optional< ParseDiagnostic > ApplyParsedAttribute (SVGElement &element, const xml::XMLQualifiedNameRef &name, std::string_view value, bool *consumedAsPresentationAttribute=nullptr)
 Apply an XML attribute read by the SVG parser without writing back to source.
static void RemoveParsedAttribute (SVGElement &element, const xml::XMLQualifiedNameRef &name)
 Remove an XML attribute from the SVG projection without writing back to source.
static components::TypedFilterAttributeEdit ReapplyTypedFilterAttributes (SVGParserContext &context, SVGElement &element, const xml::XMLQualifiedNameRef &editedName)
 After editedName was set on or removed from a filter element (see IsFilterElementFamily), parse that attribute's stored value again, or its absence, so its typed state matches a fresh parse of the element.

Detailed Description

Parses XML attributes and sets applies them to SVGElements.

Member Function Documentation

◆ ApplyParsedAttribute()

std::optional< ParseDiagnostic > donner::svg::parser::AttributeParser::ApplyParsedAttribute ( SVGElement & element,
const xml::XMLQualifiedNameRef & name,
std::string_view value,
bool * consumedAsPresentationAttribute = nullptr )
static

Apply an XML attribute read by the SVG parser without writing back to source.

Parameters
elementThe element to set the attribute on.
nameThe name of the attribute, as specified in the document's XML.
valueThe value of the attribute.
[out]consumedAsPresentationAttributeWhen non-null, set to true if the value was recognized and applied as a presentation attribute, and false if it was stored only as a generic XML attribute.

◆ ParseAndSetAttribute()

std::optional< ParseDiagnostic > donner::svg::parser::AttributeParser::ParseAndSetAttribute ( SVGParserContext & context,
SVGElement & element,
const xml::XMLQualifiedNameRef & name,
std::string_view value )
staticnoexcept

Parse an XML attribute and set it on the given element.

Parameters
contextThe parser context, used to store XML document metadata and store warnings.
elementThe element to set the attribute on.
nameThe name of the attribute, as specified in the document's XML.
valueThe value of the attribute.

◆ ReapplyTypedFilterAttributes()

components::TypedFilterAttributeEdit donner::svg::parser::AttributeParser::ReapplyTypedFilterAttributes ( SVGParserContext & context,
SVGElement & element,
const xml::XMLQualifiedNameRef & editedName )
static

After editedName was set on or removed from a filter element (see IsFilterElementFamily), parse that attribute's stored value again, or its absence, so its typed state matches a fresh parse of the element.

Other attributes' state, including values set through the typed setters, is not touched, and nothing happens when editedName is not one of the element's type-specific attributes.

Parameters
contextParser context; its warning sink receives the attribute's warnings.
elementThe edited element.
editedNameThe attribute that was set or removed.

◆ RemoveParsedAttribute()

void donner::svg::parser::AttributeParser::RemoveParsedAttribute ( SVGElement & element,
const xml::XMLQualifiedNameRef & name )
static

Remove an XML attribute from the SVG projection without writing back to source.

Parameters
elementThe element to remove the attribute from.
nameThe name of the attribute, as specified in the document's XML.

The documentation for this class was generated from the following file: