Donner SVG 0.8.0-pre
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::css::parser::DeclarationListParser Class Reference

Parse a CSS declaration list, which can be either from an HTML/SVG style attribute, or from the list of component values from within a rule. More...

#include "donner/css/parser/DeclarationListParser.h"

Classes

struct  SecurityStats

Static Public Member Functions

static std::vector< DeclarationOrAtRuleParse (std::string_view str, SecurityStats *securityStats=nullptr)
 Parse a HTML/SVG style attribute, corresponding to a CSS <declaration-list>.
static std::vector< DeclarationParseOnlyDeclarations (std::string_view str, SecurityStats *securityStats=nullptr)
 Parse a HTML/SVG style attribute, corresponding to a CSS <declaration-list>, but only returns the list of declarations, skipping any at-rules when parsing.
static std::vector< DeclarationParseRuleDeclarations (std::span< ComponentValue > components, SecurityStats *securityStats=nullptr)
 Parse a list of component values, from a Rule definition, corresponding to a CSS <declaration-list>.

Static Public Attributes

static constexpr std::size_t kMaximumDeclarations = 4096
 Maximum declarations or at-rules retained from one declaration list.
static constexpr std::size_t kMaximumComponentValues = 64 * 1024
 Maximum component values parsed across one declaration list.

Detailed Description

Parse a CSS declaration list, which can be either from an HTML/SVG style attribute, or from the list of component values from within a rule.

For example, the following is a valid declaration list:

color: red; background-color: blue; font-size: 12px;

Class Documentation

◆ donner::css::parser::DeclarationListParser::SecurityStats

struct donner::css::parser::DeclarationListParser::SecurityStats
Class Members
size_t componentValues = 0
size_t declarations = 0
bool rejected = false

Member Function Documentation

◆ Parse()

std::vector< DeclarationOrAtRule > donner::css::parser::DeclarationListParser::Parse ( std::string_view str,
SecurityStats * securityStats = nullptr )
static

Parse a HTML/SVG style attribute, corresponding to a CSS <declaration-list>.

Parameters
strInput string.
Returns
Parsed declaration list.

◆ ParseOnlyDeclarations()

std::vector< Declaration > donner::css::parser::DeclarationListParser::ParseOnlyDeclarations ( std::string_view str,
SecurityStats * securityStats = nullptr )
static

Parse a HTML/SVG style attribute, corresponding to a CSS <declaration-list>, but only returns the list of declarations, skipping any at-rules when parsing.

Parameters
strInput string.
Returns
Parsed declaration list.

◆ ParseRuleDeclarations()

std::vector< Declaration > donner::css::parser::DeclarationListParser::ParseRuleDeclarations ( std::span< ComponentValue > components,
SecurityStats * securityStats = nullptr )
static

Parse a list of component values, from a Rule definition, corresponding to a CSS <declaration-list>.

Parameters
componentsList of component values.
Returns
Parsed declaration list.

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