Orcus
Public Member Functions | List of all members
orcus::css_handler Class Reference

#include <css_parser.hpp>

Public Member Functions

void at_rule_name (std::string_view name)
 
void simple_selector_type (std::string_view type)
 
void simple_selector_class (std::string_view cls)
 
void simple_selector_pseudo_element (orcus::css::pseudo_element_t pe)
 
void simple_selector_pseudo_class (orcus::css::pseudo_class_t pc)
 
void simple_selector_id (std::string_view id)
 
void end_simple_selector ()
 
void end_selector ()
 
void combinator (orcus::css::combinator_t combinator)
 
void property_name (std::string_view name)
 
void value (std::string_view value)
 
void rgb (uint8_t red, uint8_t green, uint8_t blue)
 
void rgba (uint8_t red, uint8_t green, uint8_t blue, double alpha)
 
void hsl (uint8_t hue, uint8_t sat, uint8_t light)
 
void hsla (uint8_t hue, uint8_t sat, uint8_t light, double alpha)
 
void url (std::string_view url)
 
void begin_parse ()
 
void end_parse ()
 
void begin_block ()
 
void end_block ()
 
void begin_property ()
 
void end_property ()
 

Detailed Description

Empty handler for CSS parser. Sub-class from it and implement necessary methods.

Member Function Documentation

◆ at_rule_name()

void orcus::css_handler::at_rule_name ( std::string_view  name)
inline

Called upon encountering an at-rule.

Parameters
namename of the at-rule.

◆ begin_block()

void orcus::css_handler::begin_block ( )
inline

Called at the beginning of each block. An opening brace '{' marks the beginning of a block.

◆ begin_parse()

void orcus::css_handler::begin_parse ( )
inline

Called when the parsing begins.

◆ begin_property()

void orcus::css_handler::begin_property ( )
inline

Called at the beginning of a single property expression. Each property expression may consist of

<name> : <value>, ..., <value>
void value(std::string_view value)
Definition: css_parser.hpp:187

terminated by either a ; or }.

◆ combinator()

void orcus::css_handler::combinator ( orcus::css::combinator_t  combinator)
inline

Calling upon encountering a combinator. A combinator is an operator that combines other selectors. Given the following CSS block:

div > p {
background-color: yellow;
}

the > is the combinator that combines the div and p selectors.

Parameters
combinatortype of combinator encountered.

◆ end_block()

void orcus::css_handler::end_block ( )
inline

Called at the end of each block. A closing brace '}' marks the end of a block.

◆ end_parse()

void orcus::css_handler::end_parse ( )
inline

Called when the parsing ends.

◆ end_property()

void orcus::css_handler::end_property ( )
inline

Called at the end of a single property expression.

◆ end_selector()

void orcus::css_handler::end_selector ( )
inline

Called at the end of a selector expression.

Todo:
find out the difference between a simple selector and a selector, and document it.

◆ end_simple_selector()

void orcus::css_handler::end_simple_selector ( )
inline

Called at the end of a simple selector expression.

Todo:
find out the difference between a simple selector and a selector, and document it.

◆ hsl()

void orcus::css_handler::hsl ( uint8_t  hue,
uint8_t  sat,
uint8_t  light 
)
inline

Called at each HSL color value of a property.

Parameters
huehue
satsaturation
lightlightness

◆ hsla()

void orcus::css_handler::hsla ( uint8_t  hue,
uint8_t  sat,
uint8_t  light,
double  alpha 
)
inline

Called at each HSL color value of a property with alpha transparency value.

Parameters
huehue
satsaturation
lightlightness
alphaalpha value

◆ property_name()

void orcus::css_handler::property_name ( std::string_view  name)
inline

Called at each property name.

Parameters
nameproperty name string.

◆ rgb()

void orcus::css_handler::rgb ( uint8_t  red,
uint8_t  green,
uint8_t  blue 
)
inline

Called at each RGB color value of a property.

Parameters
redvalue of red (0-255)
greenvalue of green (0-255)
bluevalue of blue (0-255)

◆ rgba()

void orcus::css_handler::rgba ( uint8_t  red,
uint8_t  green,
uint8_t  blue,
double  alpha 
)
inline

Called at each RGB color value of a property with alpha transparency value.

Parameters
redvalue of red (0-255)
greenvalue of green (0-255)
bluevalue of blue (0-255)
alphaalpha transparency value

◆ simple_selector_class()

void orcus::css_handler::simple_selector_class ( std::string_view  cls)
inline

Called upon encountering a simple selector class. A simple selector may consist of

<type>.<class>#<id>

and this function only passes the class part of the simple selector expression.

Parameters
clssimple selector class.

◆ simple_selector_id()

void orcus::css_handler::simple_selector_id ( std::string_view  id)
inline

Called upon encountering a simple selector id. A simple selector may consist of

<type>.<class>#<id>

and this function only passes the id part of the simle selector expression.

Parameters
idsimple selector id.

◆ simple_selector_pseudo_class()

void orcus::css_handler::simple_selector_pseudo_class ( orcus::css::pseudo_class_t  pc)
inline

Called upon encountering a pseudo class of a simple selector. For instance, given the following CSS block:

button:hover {
color: blue;
}

the hover part is the pseudo class of the selector named button.

Parameters
pcpseudo class of a simple selector.

◆ simple_selector_pseudo_element()

void orcus::css_handler::simple_selector_pseudo_element ( orcus::css::pseudo_element_t  pe)
inline

Called upon encountering a pseudo element of a simple selector. For instance, given the following CSS block:

p::first-line {
color: blue;
text-transform: uppercase;
}

the first-line part is the pseudo element of the selector named p.

Parameters
pepseudo element of a simple selector.

◆ simple_selector_type()

void orcus::css_handler::simple_selector_type ( std::string_view  type)
inline

Called upon encountering a simple selector type. A simple selector may consist of

<type>.<class>#<id>

and this function only passes the type part of the simple selector expression.

Parameters
typesimple selector type.

◆ url()

void orcus::css_handler::url ( std::string_view  url)
inline

Called at each URL value of a property.

Parameters
urlURL value string.

◆ value()

void orcus::css_handler::value ( std::string_view  value)
inline

Called at each ordinary property value string.

Parameters
valuevalue string.