Donner
C++20 SVG rendering library
Loading...
Searching...
No Matches
donner::svg::parser::Number2dParser Class Reference

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...

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

Classes

struct  Result
 Container for parse result, containing the parsed result and the number of characters that were consumed to parse it. More...
 

Static Public Member Functions

static ParseResult< ResultParse (std::string_view str)
 Parse an SVG filter <number-optional-number> value, which is used to specify either a single number or two numbers representing an X/Y pair for a filter operation.
 

Detailed Description

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.


Class Documentation

◆ donner::svg::parser::Number2dParser::Result

struct donner::svg::parser::Number2dParser::Result

Container for parse result, containing the parsed result and the number of characters that were consumed to parse it.

Class Members
size_t consumedChars = 0 The number of characters of the input string that were consumed to parse the number.
double numberX = 0.0 The first parsed number.
double numberY = 0.0 The second parsed number.

Member Function Documentation

◆ Parse()

ParseResult< Number2dParser::Result > donner::svg::parser::Number2dParser::Parse ( std::string_view str)
static

Parse an SVG filter <number-optional-number> value, which is used to specify either a single number or two numbers representing an X/Y pair for a filter operation.

See also
https://www.w3.org/TR/filter-effects/#typedef-number-optional-number

Each number is a <number-token>, which may either be an integer, floating point, or scientific notation.

  • <number-optional-number> = <number> <number>?
Parameters
strString to parse, not all characters may be consumed.
Returns
Result containing the number and the number of characters that were parsed.

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