Donner
C++20 SVG rendering library
Loading...
Searching...
No Matches
donner::svg::parser::XMLParser::InputBuffer Struct Reference

Convert a string into a mutable vector<char> that is suitable for use with Donner's XMLParser. More...

#include "donner/svg/xml/XMLParser.h"

Inheritance diagram for donner::svg::parser::XMLParser::InputBuffer:
[legend]
Collaboration diagram for donner::svg::parser::XMLParser::InputBuffer:
[legend]

Public Member Functions

 InputBuffer ()=default
 Default constructor, for use with loadFromStream.
 
 InputBuffer (std::string_view str)
 Construct an input buffer from a string.
 
void append (std::string_view str)
 Append a string to the input buffer.
 
void loadFromStream (std::istream &stream)
 Load the contents of an STL stream into the input buffer.
 

Detailed Description

Convert a string into a mutable vector<char> that is suitable for use with Donner's XMLParser.

Examples
svg_to_png.cc, and svg_tree_interaction.cc.

Constructor & Destructor Documentation

◆ InputBuffer()

donner::svg::parser::XMLParser::InputBuffer::InputBuffer ( std::string_view str)
inline

Construct an input buffer from a string.

Implicit so it enables passing a raw string into the XMLParser::ParseSVG function.

Example:

A parser result, which may contain a result of type T, or an error, or both.
Definition ParseResult.h:17
static ParseResult< SVGDocument > ParseSVG(InputBuffer &source, std::vector< ParseError > *outWarnings=nullptr, Options options={}, std::unique_ptr< ResourceLoaderInterface > resourceLoader=nullptr) noexcept
Parses an SVG XML document (typically the contents of a .svg file).
Definition XMLParser.cc:196
Convert a string into a mutable vector<char> that is suitable for use with Donner's XMLParser.
Definition XMLParser.h:56
Parameters
strString to read from.

Member Function Documentation

◆ append()

void donner::svg::parser::XMLParser::InputBuffer::append ( std::string_view str)
inline

Append a string to the input buffer.

Parameters
strString to append.

◆ loadFromStream()

void donner::svg::parser::XMLParser::InputBuffer::loadFromStream ( std::istream & stream)
inline

Load the contents of an STL stream into the input buffer.

Example:

svgSource.loadFromStream(std::ifstream("example.svg"));
Parameters
streamInput stream to read from.
Examples
svg_to_png.cc.

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