All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Stylish::Selector Class Reference

CSS selector is a chain of SimpleSelectors separated by combinators. More...

#include <Stylish/Selector.hpp>

Public Member Functions

SimpleSelectorfront () const
 Returns first SimpleSelector in the Selector chain.
 
bool operator< (const Selector &s) const
 Sorts selectors, this is mostly for debugging and deserialization purposes. More...
 
bool operator== (const Selector &s) const
 
void prepend (SimpleSelector *ss, SimpleSelector::Combinator c=SimpleSelector::NONE)
 Inserts ss at the beginning of the selector chain. More...
 
size_t size () const
 

Static Public Member Functions

static Selector universalSelector (SimpleSelector::Origin origin=SimpleSelector::ORIGIN_USER)
 Creates a new universal selector. More...
 

Detailed Description

CSS selector is a chain of SimpleSelectors separated by combinators.

See Also
http://www.w3.org/TR/CSS21/selector.html

Member Function Documentation

bool Stylish::Selector::operator< ( const Selector s) const

Sorts selectors, this is mostly for debugging and deserialization purposes.

The sorting function optimizes for visual appearance, more specifically it tries to mimic the order one would use when writing a CSS file by hand.

Parameters
sother selector
Returns
true if this should precede s
bool Stylish::Selector::operator== ( const Selector s) const
Parameters
sother selector
Returns
true if selector are identical
void Stylish::Selector::prepend ( SimpleSelector ss,
SimpleSelector::Combinator  c = SimpleSelector::NONE 
)

Inserts ss at the beginning of the selector chain.

Parameters
ssnew selector to add to the chain
ccombinator between ss and the second selector in the chain
size_t Stylish::Selector::size ( ) const
inline
Returns
the number of SimpleSelectors in the Selector
static Selector Stylish::Selector::universalSelector ( SimpleSelector::Origin  origin = SimpleSelector::ORIGIN_USER)
static

Creates a new universal selector.

See Also
SimpleSelector::isEmpty()
Parameters
originthe origin of the new selector
Returns
universal selector