Donner SVG 0.8.0-pre
SVG editor and embeddable C⁠+⁠+⁠20 engine.
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, ParseWarningSink &warningSink, Options options={}, SVGDocument::Settings settings={}) noexcept
 Parses an SVG XML document from a string (typically the contents of a .svg file).
static ParseResult< SVGDocumentParseXMLDocument (xml::XMLDocument &&xmlDocument, ParseWarningSink &warningSink, Options options={}, SVGDocument::Settings settings={}) noexcept
 Parses an SVG XML document from an XML document tree.

Static Public Attributes

static constexpr size_t kDefaultMaximumInputSize = 16 * 1024 * 1024
 Default maximum number of source or expanded SVG bytes accepted from untrusted input.
static constexpr size_t kDefaultMaximumParsedPayloadSize = 64 * 1024 * 1024
 Default retained dynamic payload envelope for one untrusted SVG document.
static constexpr size_t kDefaultMaximumContentProjectionChunks = 4096
 Default maximum direct text/CDATA chunks projected into one SVG element.
static constexpr size_t kDefaultMaximumTreeNodes = 8 * 1024
 Default maximum XML tree nodes visited while converting a document into SVG components.
static constexpr size_t kDefaultMaximumTreeDepth = 256
 Default maximum SVG element depth visited during XML-to-SVG conversion.

Detailed Description

Parse an SVG XML document.

Member Function Documentation

◆ ParseSVG()

ParseResult< SVGDocument > donner::svg::parser::SVGParser::ParseSVG ( std::string_view source,
ParseWarningSink & warningSink,
Options options = {},
SVGDocument::Settings settings = {} )
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.
warningSinkSink to collect warnings encountered during parsing.
optionsOptions to modify the parsing behavior.
settingsDocument settings, including the resource loader and processing mode.
Returns
Parsed SVGDocument, or an error if a fatal error is encountered.
Examples
geode_embed.cc, svg_filter_interaction.cc, svg_text_interaction.cc, svg_to_png.cc, and svg_tree_interaction.cc.

◆ ParseXMLDocument()

ParseResult< SVGDocument > donner::svg::parser::SVGParser::ParseXMLDocument ( xml::XMLDocument && xmlDocument,
ParseWarningSink & warningSink,
Options options = {},
SVGDocument::Settings settings = {} )
staticnoexcept

Parses an SVG XML document from an XML document tree.

Parameters
xmlDocumentXML document to parse.
warningSinkSink to collect warnings encountered during parsing.
optionsOptions to modify the parsing behavior.
settingsDocument settings, including the resource loader and processing mode.
Returns
Parsed SVGDocument, or an error if a fatal error is encountered.

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