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

Parse an SVG XML document. More...

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

Classes

struct  Options
 Options to modify the parsing behavior. More...
 

Static Public Member Functions

static ParseResult< SVGDocumentParseSVG (std::string_view source, std::vector< ParseError > *outWarnings=nullptr, Options options={}, std::unique_ptr< ResourceLoaderInterface > resourceLoader=nullptr) noexcept
 Parses an SVG XML document from a string (typically the contents of a .svg file).
 
static ParseResult< SVGDocumentParseXMLDocument (xml::XMLDocument &&xmlDocument, std::vector< ParseError > *outWarnings=nullptr, Options options={}, std::unique_ptr< ResourceLoaderInterface > resourceLoader=nullptr) noexcept
 Parses an SVG XML document from an XML document tree.
 

Detailed Description

Parse an SVG XML document.

Member Function Documentation

◆ ParseSVG()

ParseResult< SVGDocument > donner::svg::parser::SVGParser::ParseSVG ( std::string_view source,
std::vector< ParseError > * outWarnings = nullptr,
SVGParser::Options options = {},
std::unique_ptr< ResourceLoaderInterface > resourceLoader = nullptr )
staticnoexcept

Parses an SVG XML document from a string (typically the contents of a .svg file).

The input buffer does not need to be null-terminated, but if there are embedded null characters parsing will stop.

Parameters
sourceInput buffer containing the SVG XML document. Will not be modified.
[out]outWarningsIf non-null, append warnings encountered to this vector.
optionsOptions to modify the parsing behavior.
resourceLoaderResource loader to use for loading external resources.
Returns
Parsed SVGDocument, or an error if a fatal error is encountered.
Examples
svg_tree_interaction.cc.

◆ ParseXMLDocument()

ParseResult< SVGDocument > donner::svg::parser::SVGParser::ParseXMLDocument ( xml::XMLDocument && xmlDocument,
std::vector< ParseError > * outWarnings = nullptr,
SVGParser::Options options = {},
std::unique_ptr< ResourceLoaderInterface > resourceLoader = nullptr )
staticnoexcept

Parses an SVG XML document from an XML document tree.

Parameters
xmlDocumentXML document to parse.
[out]outWarningsIf non-null, append warnings encountered to this vector.
optionsOptions to modify the parsing behavior.
resourceLoaderResource loader to use for loading external resources.
Returns
Parsed SVGDocument, or an error if a fatal error is encountered.

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