|
|
Donner
C++20 SVG rendering library
|
Parsers for the SVG XML format, SVGParser, as well as individual parsers for SVG components, such as PathParser and TransformParser. More...
Classes | |
| class | AttributeParser |
| Parses XML attributes and sets applies them to SVGElements. More... | |
| class | CssTransformParser |
| Parse a CSS "transform" property. More... | |
| struct | ParserOrigin |
| Contains the start location within a string where a subparser was invoked, used for remapping errors back to their original text. More... | |
| class | SVGParserContext |
| Stores the current state of SVGParser during parsing. More... | |
| class | ListParser |
| Parses a list of values conforming to the SVG comma-or-space list syntax. More... | |
| class | Number2dParser |
| Parser for floating point numbers in SVG or CSS, corresponding to the CSS3 <number-token> definition from https://www.w3.org/TR/css-syntax-3/#number-token-diagram. More... | |
| class | PathParser |
| Parse an SVG path "d"-string, see Path Data Syntax. More... | |
| class | PointsListParser |
| Parse a SVG "points" attribute, used to specify line paths for "<polyline>" and "<polygon>" elements. More... | |
| class | PreserveAspectRatioParserImpl |
| class | PreserveAspectRatioParser |
| Parser for SVG preserveAspectRatio attribute. More... | |
| class | SVGParserImpl |
| class | SVGParser |
| Parse an SVG XML document. More... | |
| class | TransformParser |
| Parse an SVG transform attribute, such as translate(100 100), using the SVG syntax which does not support units on numbers. More... | |
| class | ViewBoxParser |
| Parse an SVG viewBox attribute, such as "0 0 100 100". More... | |
| struct | UnparsedProperty |
| Represents an unparsed property, which is a CSS property that is element-specific and needs to be matched with the actual element before it can be parsed and applied. More... | |
| struct | PropertyParseFnParams |
| Parameters for a property parse function. More... | |
| class | NoOpResourceLoader |
| An no-op resource loader. More... | |
| struct | XMLQualifiedNameRef |
| Reference type for XMLQualifiedName, to pass the value to APIs without needing to allocate an RcString. More... | |
| class | XMLNode |
| Represents an XML element belonging to an XMLDocument. More... | |
| class | XMLParser |
| Parses an XML document from a string. More... | |
Concepts | |
| concept | ListParserItemCallback |
Concept requiring a type to be invocable with a std::string_view and return void. | |
Enumerations | |
| enum class | AngleParseOptions { None , AllowBareZero , AllowNumbersInDegrees } |
| Options for donner::svg::parser::ParseAngle, which controls whether bare zero is allowed. More... | |
| enum class | PropertyParseBehavior { Default , AllowUserUnits } |
| Set the parse behavior for numbers. More... | |
Functions | |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::SVG > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::Use > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::Image > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::Symbol > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::LinearGradient > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::Pattern > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::RadialGradient > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::Stop > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::Circle > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::Ellipse > (EntityHandle handle, std::string_view name, const parser::PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::Rect > (EntityHandle handle, std::string_view name, const parser::PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::Line > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::Path > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::Polygon > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::Polyline > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::Style > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::Text > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::TSpan > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| 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< 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. | |
| int | LLVMFuzzerTestOneInput (const uint8_t *data, size_t size) |
| Fuzzer entry point, see https://llvm.org/docs/LibFuzzer.html. | |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::Defs > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::G > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::Unknown > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::Filter > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::FeGaussianBlur > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::ClipPath > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::Marker > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| template<> | |
| ParseResult< bool > | ParsePresentationAttribute< ElementType::Mask > (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| template<ElementType Type> | |
| ParseResult< bool > | ParsePresentationAttribute (EntityHandle handle, std::string_view name, const PropertyParseFnParams ¶ms) |
| Parse a presentation attribute,which can contain a CSS value, for a specific ElementType. | |
| ParseResult< bool > | ParseSpecialAttributes (PropertyParseFnParams ¶ms, std::string_view name, std::optional< ElementType > type=std::nullopt, EntityHandle handle=EntityHandle()) |
| Parse special property attributes, currently used for transform. | |
| 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. | |
| template<typename T, PropertyCascade kCascade, typename ParseCallbackFn> | |
| std::optional< ParseError > | Parse (const PropertyParseFnParams ¶ms, ParseCallbackFn callbackFn, Property< T, kCascade > *destination) |
| Parse a property value into a Property. | |
Parsers for the SVG XML format, SVGParser, as well as individual parsers for SVG components, such as PathParser and TransformParser.
| struct donner::svg::parser::UnparsedProperty |
Represents an unparsed property, which is a CSS property that is element-specific and needs to be matched with the actual element before it can be parsed and applied.
For example, the transform property.
| Class Members | ||
|---|---|---|
| Declaration | declaration | CSS declaration, e.g. "transform: translate(10px, 20px);". Contains the name and list of css::ComponentValue for the value. |
| Specificity | specificity | Specificity of the declaration. |
|
strong |
Options for donner::svg::parser::ParseAngle, which controls whether bare zero is allowed.
|
strong |
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 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. |
| std::optional< ParseError > donner::svg::parser::Parse | ( | const PropertyParseFnParams & | params, |
| ParseCallbackFn | callbackFn, | ||
| Property< T, kCascade > * | destination ) |
Parse a property value into a Property.
| T | The type of the property value. |
| params | Parameters for the property parse function. |
| callbackFn | Function to parse the property value. |
| destination | The property to set the value on. |
| ParseResult< double > donner::svg::parser::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.
Where if a number is specified, it's represented with 1.0 being 100%.
| components |
| ParseResult< double > donner::svg::parser::ParseAngle | ( | const css::ComponentValue & | component, |
| AngleParseOptions | options = AngleParseOptions::None ) |
Parse an angle value within a CSS property, such as '30deg' or '2rad'.
| component | The CSS component value to parse. |
| options | Options for parsing. |
| ParseResult< Lengthd > donner::svg::parser::ParseLengthPercentage | ( | const css::ComponentValue & | component, |
| bool | allowUserUnits ) |
Parse a <length-percentage> value.
| component | A single component value. |
| allowUserUnits | Whether to allow unitless values, if this is a parse in the context of XML attributes. |
| ParseResult< Lengthd > donner::svg::parser::ParseLengthPercentage | ( | std::span< const css::ComponentValue > | components, |
| bool | allowUserUnits ) |
Parse a <length-percentage> value.
| 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. |
| ParseResult< std::optional< Lengthd > > donner::svg::parser::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.
| 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. |
| ParseResult< bool > donner::svg::parser::ParsePresentationAttribute | ( | EntityHandle | handle, |
| std::string_view | name, | ||
| const PropertyParseFnParams & | params ) |
Parse a presentation attribute,which can contain a CSS value, for a specific ElementType.
| 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. |
| ParseResult< bool > donner::svg::parser::ParseSpecialAttributes | ( | PropertyParseFnParams & | params, |
| std::string_view | name, | ||
| std::optional< ElementType > | type = std::nullopt, | ||
| EntityHandle | handle = EntityHandle() ) |
Parse special property attributes, currently used for transform.
| params | Parameters for the property parse function. |
| name | Name of the attribute to parse. |
| type | Type of the element, if known. |
| handle | Entity handle of the element, if known. |
| std::optional< RcString > donner::svg::parser::TryGetSingleIdent | ( | std::span< const css::ComponentValue > | components | ) |
If the components contain only a single ident, returns an RcString for that ident's contents.
| components | Component values, which should already be trimmed. |