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

Implementation of the LengthParser. More...

Inheritance diagram for donner::base::parser::LengthParserImpl:
[legend]
Collaboration diagram for donner::base::parser::LengthParserImpl:
[legend]

Public Member Functions

 LengthParserImpl (std::string_view str, LengthParser::Options options)
 Construct a new LengthParser implementation object.
 
ParseResult< LengthParser::Resultparse ()
 Parse a length and return the result or error.
 
bool unitRequired (double number) const
 Check if a unit is required for the given number.
 
- Public Member Functions inherited from donner::base::parser::ParserBase
 ParserBase (std::string_view str)
 Create a new parser.
 

Additional Inherited Members

- Protected Member Functions inherited from donner::base::parser::ParserBase
std::string_view take (size_t count)
 Removes and returns count characters from the remaining string.
 
void skipWhitespace ()
 Remove whitespace characters, from the front of remaining_ if they exist, where whitespace is based on the result of isWhitespace().
 
void skipCommaWhitespace ()
 Remove whitespace characters and up to one ',' character from the front of remaining_ if they exist.
 
bool isWhitespace (char ch) const
 Returns if the character is whitespace, where whitespace is defined as being either U+000A LINE FEED, U+000D CARRIAGE RETURN, U+0009 CHARACTER TABULATION, or U+0020 SPACE.
 
FileOffset currentOffset (int index=0) const
 Return the location of the parser's cursor, in characters from the start of the screen.
 
size_t consumedChars () const
 Returns the number of characters consumed by the parser.
 
ParseResult< doublereadNumber ()
 Read a number, note that this does not skip whitespace.
 
std::optional< ParseErrorreadNumbers (std::span< double > resultStorage)
 Read resultStorage.size() numbers, separated by whitespace and an optional comma.
 
- Protected Attributes inherited from donner::base::parser::ParserBase
const std::string_view str_
 The original string.
 
std::string_view remaining_
 A slice of the remaining characters to parse within str_.
 

Detailed Description

Implementation of the LengthParser.

Constructor & Destructor Documentation

◆ LengthParserImpl()

donner::base::parser::LengthParserImpl::LengthParserImpl ( std::string_view str,
LengthParser::Options options )
inline

Construct a new LengthParser implementation object.

Parameters
strString to parse.
optionsParser options.

Member Function Documentation

◆ unitRequired()

bool donner::base::parser::LengthParserImpl::unitRequired ( double number) const
inline

Check if a unit is required for the given number.

Parameters
numberNumber to check.

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