Parse an SVG path "d"-string, see Path Data Syntax.
More...
#include "donner/svg/parser/PathParser.h"
|
| struct | Command |
| | One authored command, before coordinate or curve normalization. More...
|
| struct | CommandList |
| | Owning command syntax; implicit repetitions are expanded, including moveto's later lineto. More...
|
|
|
static constexpr std::size_t | kMaximumCommands = 128 * 1024 |
| | Maximum number of path commands accepted from one untrusted d attribute.
|
|
static constexpr std::size_t | kMaximumPoints = 256 * 1024 |
| | Maximum number of points retained while parsing one untrusted d attribute.
|
|
static constexpr std::size_t | kMaximumParameters = kMaximumPoints * 2 |
| | Maximum scalar parameters retained by ParseCommands.
|
Parse an SVG path "d"-string, see Path Data Syntax.
◆ donner::svg::parser::PathParser::Command
| struct donner::svg::parser::PathParser::Command |
One authored command, before coordinate or curve normalization.
| Class Members |
|
char |
letter = 0 |
SVG command letter; closepath is always uppercase Z. |
|
uint8_t |
parameterCount = 0 |
Number of parameters, at most seven. |
|
uint32_t |
parameterOffset = 0 |
First entry in CommandList::parameters. |
◆ donner::svg::parser::PathParser::CommandList
| struct donner::svg::parser::PathParser::CommandList |
Owning command syntax; implicit repetitions are expanded, including moveto's later lineto.
| Class Members |
|
vector< Command > |
commands |
Authored command kinds and parameter ranges. |
|
vector< double > |
parameters |
Parameters before relative-coordinate conversion. |
◆ Parse()
| ParseResult< Path > donner::svg::parser::PathParser::Parse |
( |
std::string_view | d | ) |
|
|
static |
Parse an SVG path "d"-string, see Path Data Syntax.
Note that this parser may return both an error and a partial path, since path parsing will return anything that it has parsed before it encountered the error. The caller should use both ParseResult::hasResult() and ParseResult::hasError() to determine what has been returned.
- Parameters
-
| d | String corresponding to the SVG <path d="..."> parameter. |
- Returns
- Parsed Path and/or an error.
◆ ParseCommands()
Parse authored command parameters with the same grammar as Parse, without expanding geometry.
The result retains relative commands, shorthand curves and arc parameters. Like Parse, it may contain a completed prefix and an error; incomplete commands are omitted.
- Parameters
-
- Returns
- Owned commands and/or an error, bounded by kMaximumCommands and kMaximumParameters.
The documentation for this class was generated from the following file: