ccss_stylesheet_t

ccss_stylesheet_t

Synopsis

typedef             ccss_stylesheet_t;
ccss_stylesheet_t*  ccss_stylesheet_new_from_buffer     (char const *buffer,
                                                         size_t size);
ccss_stylesheet_t*  ccss_stylesheet_new_from_file       (char const *css_file);
void                ccss_stylesheet_free                (ccss_stylesheet_t *self);
ccss_selector_group_tconst * ccss_stylesheet_query_type (ccss_stylesheet_t const *self,
                                                         char const *type_name);
bool                ccss_stylesheet_query_collect       (ccss_stylesheet_t const *self,
                                                         ccss_node_t const *node,
                                                         ccss_selector_group_t *result_group,
                                                         bool as_base);
bool                ccss_stylesheet_query_apply         (ccss_stylesheet_t const *self,
                                                         ccss_node_t const *node,
                                                         ccss_style_t *style);
void                ccss_stylesheet_dump                (ccss_stylesheet_t const *self);
typedef             ccss_stylesheet_iter_t;
void                ccss_stylesheet_iter_init           (ccss_stylesheet_iter_t *self,
                                                         ccss_stylesheet_t const *stylesheet);
bool                ccss_stylesheet_iter_next           (ccss_stylesheet_iter_t *self,
                                                         char const **type_name,
                                                         ccss_selector_group_t const **group);

Description

Details

ccss_stylesheet_t

typedef struct ccss_stylesheet_ ccss_stylesheet_t;

Represents a parsed instance of a stylesheet.


ccss_stylesheet_new_from_buffer ()

ccss_stylesheet_t*  ccss_stylesheet_new_from_buffer     (char const *buffer,
                                                         size_t size);

Create a new stylesheet instance based on a CSS string.

buffer :

buffer to parse.

size :

size of the buffer.

Returns :

a ccss_stylesheet_t representation of the CSS string.

ccss_stylesheet_new_from_file ()

ccss_stylesheet_t*  ccss_stylesheet_new_from_file       (char const *css_file);

Create a new stylesheet instance based on a CSS file.

css_file :

file to parse.

Returns :

a ccss_stylesheet_t representation of the CSS file.

ccss_stylesheet_free ()

void                ccss_stylesheet_free                (ccss_stylesheet_t *self);

Free the stylesheet and all associated resources.

self :

a ccss_stylesheet_t.

ccss_stylesheet_query_type ()

ccss_selector_group_tconst * ccss_stylesheet_query_type (ccss_stylesheet_t const *self,
                                                         char const *type_name);

Query the stylesheet for styling information regarding a type.

self :

a ccss_stylesheet_t.

type_name :

the type to query for, e.g. `h1'.

Returns :

a ccss_selector_group_t containing the requested information of NULL.

ccss_stylesheet_query_collect ()

bool                ccss_stylesheet_query_collect       (ccss_stylesheet_t const *self,
                                                         ccss_node_t const *node,
                                                         ccss_selector_group_t *result_group,
                                                         bool as_base);

Query the stylesheet for styling information regarding a document node and collect the results.

self :

a ccss_stylesheet_t.

node :

a ccss_node_t implementation that is used by libccss to retrieve information about the underlying document.

result_group :

a ccss_selector_group_t that accumulates the results of the query.

as_base :

whether the results should be accumulates with lowered priority, e.g. when querying for base style information.

Returns :

TRUE if styling information has been found.

ccss_stylesheet_query_apply ()

bool                ccss_stylesheet_query_apply         (ccss_stylesheet_t const *self,
                                                         ccss_node_t const *node,
                                                         ccss_style_t *style);

Query the stylesheet for styling information regarding a document node and apply the results to a ccss_style_t object.

self :

a ccss_stylesheet_t.

node :

a ccss_node_t implementation that is used by libccss to retrieve information about the underlying document.

style :

a ccss_style_t that the results of the query are applied to.

Returns :

TRUE if styling information has been found.

ccss_stylesheet_dump ()

void                ccss_stylesheet_dump                (ccss_stylesheet_t const *self);

Print informations about the internal state of this object.

self :

a ccss_stylesheet_t.

ccss_stylesheet_iter_t

typedef GHashTableIter ccss_stylesheet_iter_t;

Stack-allocatable iterator for walking a stylesheet.


ccss_stylesheet_iter_init ()

void                ccss_stylesheet_iter_init           (ccss_stylesheet_iter_t *self,
                                                         ccss_stylesheet_t const *stylesheet);

Modifying the underlying stylesheet invalidates the iterator.

self :

a ccss_stylesheet_iter_t.

stylesheet :

the stylesheet to iterate.

ccss_stylesheet_iter_next ()

bool                ccss_stylesheet_iter_next           (ccss_stylesheet_iter_t *self,
                                                         char const **type_name,
                                                         ccss_selector_group_t const **group);

self :

a ccss_stylesheet_iter_t.

type_name :

type the selector group regards, e.g. DIV in HTML.

group :

the ccss_selector_group_t containing rules for type_name.

Returns :

FALSE when the last element is reached.