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

CSS Simple selector and its preceding selector combinator in full CSS Selector. More...

#include <Stylish/SimpleSelector.hpp>

Public Types

enum  Combinator { NONE, CHILD, DESCENDANT }
 Combinator defines the relation between two SimpleSelectors and how CSS selector is matched against a widget tree. More...
 
enum  Origin { ORIGIN_USER_AGENT = 0, ORIGIN_AUTHOR = 1, ORIGIN_USER = 2, ORIGIN_MASK = 7 }
 Three different origins for the selector. More...
 

Public Member Functions

void addClass (const QByteArray &klass)
 Sets type of the selector, matches Stylish::Styleable::cssClasses. More...
 
void addId (const QString &id)
 Sets id of the selector, matches Stylish::Styleable::cssId. More...
 
void addPseudoClass (const QByteArray &pseudo)
 Adds a new pseudo class to the SimpleSelector. More...
 
Combinator combinator () const
 Combinator to the previous simple selector.
 
const Radiant::ArraySet
< QByteArray > & 
cssClasses () const
 
const QString & cssId () const
 
const QByteArray & cssType () const
 
void detach ()
 Removes this link from a CSS selector chain.
 
bool isEmpty () const
 
SimpleSelectornext () const
 
bool operator!= (const SimpleSelector &o) const
 
bool operator== (const SimpleSelector &o) const
 Compares two SimpleSelectors, including their combinators but excluding the chains they might belong to. More...
 
Origin origin () const
 
std::vector< QByteArray > pseudoClasses () const
 Returns a list of pseudo classes this selector has. More...
 
void setCombinator (Combinator c)
 Sets the preceding combinator. More...
 
void setType (const QByteArray &type)
 Sets type of the selector, matches Stylish::Styleable::cssType. More...
 
 SimpleSelector (Origin origin, const QByteArray &type=QByteArray(), const QString &id="")
 Constructs a new selector. More...
 
const QByteArray & toString () const
 
void updateString ()
 

Friends

class Selector
 

Detailed Description

CSS Simple selector and its preceding selector combinator in full CSS Selector.

See Also
Selector
http://www.w3.org/TR/CSS21/selector.html#simple-selector

Member Enumeration Documentation

Combinator defines the relation between two SimpleSelectors and how CSS selector is matched against a widget tree.

See Also
http://www.w3.org/TR/CSS21/selector.html#pattern-matching
Enumerator
CHILD 

E or first simple selector in selector.

DESCENDANT 

E > F.

E F

Three different origins for the selector.

This is the source of the stylesheet that declared this selector.

See Also
http://www.w3.org/TR/CSS21/cascade.html#cascade
Enumerator
ORIGIN_USER_AGENT 

Stylesheets defined by Cornerstone (eg. "CSS/cornerstone.css")

ORIGIN_AUTHOR 

The default origin for most CSS files.

ORIGIN_USER 

Styles defined by the end user, currently unused.

ORIGIN_MASK 

In the calculated specificity, ORIGIN_MASK << 24 specifies the origin bits.

Constructor & Destructor Documentation

Stylish::SimpleSelector::SimpleSelector ( Origin  origin,
const QByteArray &  type = QByteArray(),
const QString &  id = "" 
)

Constructs a new selector.

Parameters
originselector origin
typetype field
idid

Member Function Documentation

void Stylish::SimpleSelector::addClass ( const QByteArray &  klass)

Sets type of the selector, matches Stylish::Styleable::cssClasses.

Parameters
klassnew class name
See Also
http://www.w3.org/TR/CSS21/selector.html#type-selectors
void Stylish::SimpleSelector::addId ( const QString &  id)

Sets id of the selector, matches Stylish::Styleable::cssId.

Parameters
idnew id
See Also
http://www.w3.org/TR/CSS21/selector.html#type-selectors
void Stylish::SimpleSelector::addPseudoClass ( const QByteArray &  pseudo)

Adds a new pseudo class to the SimpleSelector.

Parameters
pseudoname of the new pseudo class
const Radiant::ArraySet<QByteArray>& Stylish::SimpleSelector::cssClasses ( ) const
inline
Returns
Returns the lower case class field of the selector
const QString& Stylish::SimpleSelector::cssId ( ) const
inline
Returns
Returns the id field of the selector
const QByteArray& Stylish::SimpleSelector::cssType ( ) const
inline
Returns
Returns the type field of the selector
bool Stylish::SimpleSelector::isEmpty ( ) const
Returns
True if this is universal selector
See Also
http://www.w3.org/TR/CSS21/selector.html#universal-selector
SimpleSelector* Stylish::SimpleSelector::next ( ) const
inline
Returns
Next SimpleSelector link in a CSS selector chain, or null, if this SimpleSelector is the last link.
bool Stylish::SimpleSelector::operator!= ( const SimpleSelector o) const
inline
Parameters
oother selector
Returns
false if the selectors are identical
bool Stylish::SimpleSelector::operator== ( const SimpleSelector o) const

Compares two SimpleSelectors, including their combinators but excluding the chains they might belong to.

Parameters
oother selector
Returns
true if the selectors are identical
Origin Stylish::SimpleSelector::origin ( ) const
inline
Returns
Origin of the selector (origin of the stylesheet)
See Also
http://www.w3.org/TR/CSS21/cascade.html#cascade
std::vector<QByteArray> Stylish::SimpleSelector::pseudoClasses ( ) const
inline

Returns a list of pseudo classes this selector has.

See Also
http://www.w3.org/TR/CSS21/selector.html#pseudo-class-selectors
Returns
list of active pseudo classes
void Stylish::SimpleSelector::setCombinator ( Combinator  c)

Sets the preceding combinator.

See Also
http://www.w3.org/TR/CSS21/selector.html#pattern-matching
Parameters
cnew combinator
void Stylish::SimpleSelector::setType ( const QByteArray &  type)

Sets type of the selector, matches Stylish::Styleable::cssType.

Parameters
typenew type
See Also
http://www.w3.org/TR/CSS21/selector.html#type-selectors