|
|
Donner
C++20 SVG rendering library
|
Selectors which start with one colon, e.g. More...
#include "donner/css/selectors/PseudoClassSelector.h"
Classes | |
| struct | PseudoMatchResult |
| Result of matches, returns if the selector matched and if it can be treated as a "primary" matcher. More... | |
Public Member Functions | |
| PseudoClassSelector (const RcString &ident) | |
| Create a PseudoClassSelector with the given ident. | |
| ~PseudoClassSelector () noexcept | |
| Destructor. | |
| PseudoClassSelector (PseudoClassSelector &&) noexcept | |
| Move constructor. | |
| PseudoClassSelector & | operator= (PseudoClassSelector &&) noexcept |
| Move assignment operator. | |
| PseudoClassSelector (const PseudoClassSelector &other) | |
| Copy constructor. | |
| PseudoClassSelector & | operator= (const PseudoClassSelector &other) |
| Copy assignment operator. | |
| bool | isValid () const |
| Returns true if this selector is valid and supported by this implementation. | |
| template<ElementLike T> | |
| PseudoMatchResult | matches (const T &element, const SelectorMatchOptions< T > &options) const |
| Returns true if the provided element matches this selector. | |
| Specificity::ABC | computeSpecificity () const |
| Compute the pseudo-class's specificity, using the rules from https://www.w3.org/TR/2022/WD-selectors-4-20221111/#specificity-rules. | |
Public Attributes | |
| RcString | ident |
| The name of the pseudo-class. | |
| std::optional< std::vector< ComponentValue > > | argsIfFunction |
| The arguments of the pseudo-class, if it is a function. | |
| std::optional< AnbValue > | anbValueIfAnb |
| The An+B value of the pseudo-class, for An+B pseudo-classes such as :nth-child. | |
| std::unique_ptr< Selector > | selector |
| The selector of the pseudo-class, for pseudo-classes such as :is() and :not(), or :nth-child(An+B of S). | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const PseudoClassSelector &obj) |
| Ostream output operator for PseudoClassSelector, outputs a debug string e.g. PseudoClassSelector(after). | |
Selectors which start with one colon, e.g.
:nth-child(), are called pseudo-classes, and they represent additional state information not directly present in the document tree.
Each pseudo-class selector has a unique behavior.
Selectors supported:
Not yet implemented, see https://github.com/jwmcglynn/donner/issues/3:
Pseudo-classes are defined in the following specs:
|
explicit |
Create a PseudoClassSelector with the given ident.
| ident | The name of the pseudo-class. |
|
inline |
Returns true if this selector is valid and supported by this implementation.
| PseudoClassSelector::PseudoMatchResult donner::css::PseudoClassSelector::matches | ( | const T & | element, |
| const SelectorMatchOptions< T > & | options ) const |
Returns true if the provided element matches this selector.
| T | A type that fulfills the ElementLike concept, to enable traversing the tree to match the selector. |
| element | The element to check. |
| options | The options to use when matching |