css_handler
Defined in header: <orcus/css_parser.hpp>
-
class css_handler
Empty handler for CSS parser. Sub-class from it and implement necessary methods.
Public Functions
-
inline void at_rule_name(std::string_view name)
Called upon encountering an at-rule.
- Parameters:
name – name of the at-rule.
-
inline void simple_selector_type(std::string_view type)
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:
type – simple selector type.
-
inline void simple_selector_class(std::string_view cls)
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:
cls – simple selector class.
-
inline void simple_selector_pseudo_element(orcus::css::pseudo_element_t pe)
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-linepart is the pseudo element of the selector namedp.- Parameters:
pe – pseudo element of a simple selector.
-
inline void simple_selector_pseudo_class(orcus::css::pseudo_class_t pc)
Called upon encountering a pseudo class of a simple selector. For instance, given the following CSS block:
button:hover { color: blue; }
the
hoverpart is the pseudo class of the selector namedbutton.- Parameters:
pc – pseudo class of a simple selector.
-
inline void simple_selector_id(std::string_view id)
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:
id – simple selector id.
-
inline void end_simple_selector()
Called at the end of a simple selector expression.
- Todo:
find out the difference between a simple selector and a selector, and document it.
-
inline void end_selector()
Called at the end of a selector expression.
- Todo:
find out the difference between a simple selector and a selector, and document it.
-
inline void combinator(orcus::css::combinator_t combinator)
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 thedivandpselectors.- Parameters:
combinator – type of combinator encountered.
-
inline void property_name(std::string_view name)
Called at each property name.
- Parameters:
name – property name string.
-
inline void value(std::string_view value)
Called at each ordinary property value string.
- Parameters:
value – value string.
-
inline void rgb(uint8_t red, uint8_t green, uint8_t blue)
Called at each RGB color value of a property.
- Parameters:
red – value of red (0-255)
green – value of green (0-255)
blue – value of blue (0-255)
-
inline void rgba(uint8_t red, uint8_t green, uint8_t blue, double alpha)
Called at each RGB color value of a property with alpha transparency value.
- Parameters:
red – value of red (0-255)
green – value of green (0-255)
blue – value of blue (0-255)
alpha – alpha transparency value
-
inline void hsl(uint8_t hue, uint8_t sat, uint8_t light)
Called at each HSL color value of a property.
- Parameters:
hue – hue
sat – saturation
light – lightness
-
inline void hsla(uint8_t hue, uint8_t sat, uint8_t light, double alpha)
Called at each HSL color value of a property with alpha transparency value.
- Parameters:
hue – hue
sat – saturation
light – lightness
alpha – alpha value
-
inline void url(std::string_view url)
Called at each URL value of a property.
- Parameters:
url – URL value string.
-
inline void begin_parse()
Called when the parsing begins.
-
inline void end_parse()
Called when the parsing ends.
-
inline void begin_block()
Called at the beginning of each block. An opening brace ‘{’ marks the beginning of a block.
-
inline void end_block()
Called at the end of each block. A closing brace ‘}’ marks the end of a block.
-
inline void begin_property()
Called at the beginning of a single property expression. Each property expression may consist of
<name> : <value>, ..., <value>
terminated by either a
;or}.
-
inline void end_property()
Called at the end of a single property expression.
-
inline void at_rule_name(std::string_view name)