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

Parse an SVG viewBox attribute, such as "0 0 100 100". More...

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

Static Public Member Functions

static ParseResult< BoxdParse (std::string_view str)
 Parse an SVG viewBox attribute, such as 0 0 100 100.
 

Detailed Description

Parse an SVG viewBox attribute, such as "0 0 100 100".

See also
https://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute

Member Function Documentation

◆ Parse()

ParseResult< Boxd > donner::svg::parser::ViewboxParser::Parse ( std::string_view str)
static

Parse an SVG viewBox attribute, such as 0 0 100 100.

See also
https://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute

It parses a string containing the following values:

<min-x>,? <min-y>,? <width>,? <height>
A parser result, which may contain a result of type T, or an error, or both.
Definition ParseResult.h:17

Each parameter is a "<number>" type, as parsed by donner::base::parser::NumberParser. "<width>" and "<height>" must be positive, but the caller must ensure that they are non-zero; a value of zero should disable rendering of the element.

Parameters
strInput string, e.g. "0 0 100 100".
Returns
Parsed box, or an error.

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