Donner
C++20 SVG rendering library
Loading...
Searching...
No Matches
donner::css::QualifiedRule Struct Reference

A QualifiedRule has a list of component values and a block, this is the intermediate representation of a stylesheet rule. More...

#include "donner/css/Rule.h"

Collaboration diagram for donner::css::QualifiedRule:
[legend]

Public Member Functions

 QualifiedRule (std::vector< ComponentValue > &&prelude, SimpleBlock &&block)
 Constructor, takes ownership of the prelude and block.
 
 ~QualifiedRule ()=default
 Destructor.
 
 QualifiedRule (const QualifiedRule &other)=default
 Copy constructor.
 
QualifiedRuleoperator= (const QualifiedRule &other)=default
 Copy assignment operator.
 
 QualifiedRule (QualifiedRule &&other)=default
 Move constructor.
 
QualifiedRuleoperator= (QualifiedRule &&other)=default
 Move assignment operator.
 
bool operator== (const QualifiedRule &other) const =default
 Equality operator.
 

Public Attributes

std::vector< ComponentValueprelude
 A list of component values before the block definition.
 
SimpleBlock block
 Block with an opening associated token, such as '{', '[', or '(', and a list of tokens within the block.
 

Friends

std::ostream & operator<< (std::ostream &os, const QualifiedRule &qualifiedRule)
 Ostream output operator for the QualifiedRule, in a human-readable but verbose format, to be used for debugging and testing.
 

Detailed Description

A QualifiedRule has a list of component values and a block, this is the intermediate representation of a stylesheet rule.

For example, for a stylesheet rule:

a > b { color: red }

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const QualifiedRule & qualifiedRule )
friend

Ostream output operator for the QualifiedRule, in a human-readable but verbose format, to be used for debugging and testing.

For example:

a > b { color: red }
}
A QualifiedRule has a list of component values and a block, this is the intermediate representation o...
Definition Rule.h:69

Would be:

file=rule_parser_tests.cc
Token { Ident(a) offset: 0 }
Token { Whitespace(' ', len=1) offset: 1 }
Token { Delim(>) offset: 2 }
Token { Whitespace(' ', len=1) offset: 3 }
Token { Ident(b) offset: 4 }
Token { Whitespace(' ', len=1) offset: 5 }
{ SimpleBlock {
token='{'
Token { Whitespace(' ', len=1) offset: 7 }
Token { Ident(color) offset: 8 }
Token { Colon offset: 13 }
Token { Whitespace(' ', len=1) offset: 14 }
Token { Ident(red) offset: 15 }
Token { Whitespace(' ', len=1) offset: 18 }
} }
}
A CSS token, which are created as a first step when parsing a CSS string.
Definition Token.h:33

Member Data Documentation

◆ block

SimpleBlock donner::css::QualifiedRule::block

Block with an opening associated token, such as '{', '[', or '(', and a list of tokens within the block.

For stylesheet rules, this is the '{ color: red }' part of the rule.

◆ prelude

std::vector<ComponentValue> donner::css::QualifiedRule::prelude

A list of component values before the block definition.

For a > b { color: red }, a > b is the prelude, and it would be parsed into five token ComponentValue, ‘a, ’ ', >, b, ' '`.


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