psychic-ui 0.0.0
Loading...
Searching...
No Matches
psychic_ui::StyleSelector Class Reference

Public Member Functions

bool matches (const Div *component) const
bool direct () const
int depth () const
const std::string & tag () const
const std::string & id () const
const std::vector< std::string > & classes () const
const std::unordered_set< Pseudo > & pseudo () const
const StyleSelector * next () const
int weight () const

Static Public Member Functions

static std::unique_ptr< StyleSelector > fromSelector (const std::string &selector)

Protected Member Functions

bool matches (const Div *component, bool expand) const

Protected Attributes

bool _direct {false}
int _depth {0}
std::string _tag {}
std::string _id {}
std::vector< std::string > _classes {}
std::unordered_set< Pseudo > _pseudo {}
std::unique_ptr< StyleSelector > _next {nullptr}

Member Function Documentation

◆ matches()

bool psychic_ui::StyleSelector::matches ( const Div * component,
bool expand ) const
protected

Internal match method This method allows expanding the search to the parent, it is hidden as we don't want the end user calling it directly as the first level of matching must not expand since we optimized by retrieving the parent's computed style instead of walking back up the hierarchy for every possible style declaration. We assume that the parent is current.

Parameters
component
expandbool - Expand the search to the parent
Returns

◆ weight()

int psychic_ui::StyleSelector::weight ( ) const

Computes the selector's weight This is used when trying to figure out selectors priority

Returns
int

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