Parsers for the SVG XML format, SVGParser, as well as individual parsers for SVG components, such as PathParser and TransformParser.
More...
|
| concept | ListParserItemCallback |
| | Concept requiring a type to be invocable with a std::string_view and return void.
|
|
| ParseResult< double > | ParseAngle (const css::ComponentValue &component, AngleParseOptions options=AngleParseOptions::None) |
| | Parse an angle value within a CSS property, such as '30deg' or '2rad'.
|
| ParseResult< bool > | ParseAnimationAttribute (EntityHandle handle, const xml::XMLQualifiedNameRef &name, std::string_view value) |
| | Parse one animation attribute into the element's internal animation state without modifying XML.
|
| bool | RefreshAnimationAttributes (Registry ®istry, std::span< const Entity > animations) |
| | Refresh internal animation state after authored attributes change, retaining runtime events.
|
| ParseResult< Lengthd > | ParseLengthPercentage (const css::ComponentValue &component, bool allowUserUnits) |
| | Parse a <length-percentage> value.
|
| ParseResult< Lengthd > | ParseLengthPercentage (std::span< const css::ComponentValue > components, bool allowUserUnits) |
| | Parse a <length-percentage> value.
|
| ParseResult< bool > | ParsePresentationAttribute (ElementType type, EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| | Parse a presentation attribute, which can contain a CSS value, for a specific ElementType.
|
| template<typename T, PropertyCascade kCascade, typename ParseCallbackFn> |
| std::optional< ParseDiagnostic > | Parse (const PropertyParseFnParams ¶ms, ParseCallbackFn callbackFn, Property< T, kCascade > *destination) |
| | Parse a property value into a Property.
|
| ParseResult< RcString > | ParsePathDataProperty (std::span< const css::ComponentValue > components) |
| | Parse a CSS path-data property using the renderer's string-or-none syntax.
|
| std::optional< RcString > | TryGetSingleIdent (std::span< const css::ComponentValue > components) |
| | If the components contain only a single ident, returns an RcString for that ident's contents.
|
| ParseResult< std::optional< Lengthd > > | ParseLengthPercentageOrAuto (std::span< const css::ComponentValue > components, bool allowUserUnits) |
| | Parse a <length-percentage>, which may optionally be set to "auto", in which case this returns std::nullopt.
|
| ParseResult< double > | ParseAlphaValue (std::span< const css::ComponentValue > components) |
| | Parse an <alpha-value>, defined by CSS Color: https://www.w3.org/TR/css-color/#typedef-alpha-value.
|
Parsers for the SVG XML format, SVGParser, as well as individual parsers for SVG components, such as PathParser and TransformParser.
◆ AngleParseOptions
Options for donner::svg::parser::ParseAngle, which controls whether bare zero is allowed.
| Enumerator |
|---|
| None | Angles require a dimension suffix, such as '30deg' or '2rad'.
|
| AllowBareZero | Allow '0' to be parsed as an angle.
|
| AllowNumbersInDegrees | Allow raw numbers to be parsed as an angle in degrees.
|
◆ PropertyParseBehavior
Set the parse behavior for numbers.
For properties set on the XML element, units can be omitted and will be considered as "user units", which are equivalent to pixels. For properties set on the CSS style attribute, units must be specified.
When set to PropertyParseBehavior::AllowUserUnits, the parser will accept numbers without units, such as 15.
| Enumerator |
|---|
| Default | Require units for numbers, such as 15px, with the exception of 0 which may be unitless.
|
| AllowUserUnits | Allow numbers without units, e.g. 15.
|
◆ Parse()
Parse a property value into a Property.
- Template Parameters
-
| T | The type of the property value. |
- Parameters
-
| params | Parameters for the property parse function. |
| callbackFn | Function to parse the property value. |
| destination | The property to set the value on. |
◆ ParseAlphaValue()
◆ ParseAngle()
Parse an angle value within a CSS property, such as '30deg' or '2rad'.
- Parameters
-
| component | The CSS component value to parse. |
| options | Options for parsing. |
- Returns
- The angle in radians, or a ParseDiagnostic if parsing failed.
◆ ParseAnimationAttribute()
Parse one animation attribute into the element's internal animation state without modifying XML.
This is an internal hook for the SVG attribute parser, not a document API.
- Parameters
-
| handle | Animation or mpath element. |
| name | Attribute name. |
| value | Attribute value. |
- Returns
- True for a recognized attribute, false for other attributes, or a diagnostic.
◆ ParseLengthPercentage() [1/2]
Parse a <length-percentage> value.
- Parameters
-
| component | A single component value. |
| allowUserUnits | Whether to allow unitless values, if this is a parse in the context of XML attributes. |
- Returns
- Return a Length or a parse error.
◆ ParseLengthPercentage() [2/2]
Parse a <length-percentage> value.
- Parameters
-
| components | Component values, which should already be trimmed. |
| allowUserUnits | Whether to allow unitless values, if this is a parse in the context of XML attributes. |
- Returns
- Return a Length or a parse error.
◆ ParseLengthPercentageOrAuto()
Parse a <length-percentage>, which may optionally be set to "auto", in which case this returns std::nullopt.
- Parameters
-
| components | Component values, which should already be trimmed. |
| allowUserUnits | Whether to allow unitless values, if this is a parse in the context of XML attributes. |
- Returns
- Return an optional, which is set to std::nullopt if the value is "auto", or a Length, or a parse error.
◆ ParsePathDataProperty()
Parse a CSS path-data property using the renderer's string-or-none syntax.
- Parameters
-
| components | Trimmed CSS component values. |
- Returns
- Path data, or a diagnostic for an unsupported value.
◆ ParsePresentationAttribute()
Parse a presentation attribute, which can contain a CSS value, for a specific ElementType.
- See also
- https://www.w3.org/TR/SVG2/styling.html#PresentationAttributes
- Parameters
-
| type | Type of element to parse presentation attributes for. |
| handle | Entity handle which determines which attributes are supported, and where to save the parsed value. |
| name | Name of the attribute. |
| params | Parameters for parsing the attribute, which includes the value to parse, specificity, and parser options. |
- Returns
- true if the element supports this attribute and it was parsed successfully, or a ParseDiagnostic if parsing failed.
◆ RefreshAnimationAttributes()
| bool donner::svg::parser::RefreshAnimationAttributes |
( |
Registry & | registry, |
|
|
std::span< const Entity > | animations ) |
Refresh internal animation state after authored attributes change, retaining runtime events.
This is an internal hook for the animation timeline, not a document API. Attribute hashes and parsing share a bounded per-call source envelope.
- Parameters
-
| registry | Document storage. |
| animations | Admitted animation elements. |
- Returns
- False when source admission fails.
◆ TryGetSingleIdent()
If the components contain only a single ident, returns an RcString for that ident's contents.
- Parameters
-
| components | Component values, which should already be trimmed. |
- Returns
- A string if the components contain a single ident, otherwise std::nullopt.