![]() |
![]() |
![]() |
CCSS Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
typedef ccss_grammar_t; ccss_grammar_t * ccss_grammar_create_css (void
); ccss_grammar_t * ccss_grammar_create_generic (void
); void ccss_grammar_destroy (ccss_grammar_t *self
); ccss_grammar_t * ccss_grammar_reference (ccss_grammar_t *self
); unsigned int ccss_grammar_get_reference_count (ccss_grammar_t const *self
); void ccss_grammar_add_properties (ccss_grammar_t *self
,ccss_property_class_t const *properties
); ccss_property_class_t const * ccss_grammar_lookup_property (ccss_grammar_t const *self
,char const *name
); void ccss_grammar_add_functions (ccss_grammar_t *self
,ccss_function_t const *functions
); ccss_function_t const * ccss_grammar_lookup_function (ccss_grammar_t const *self
,char const *name
); ccss_stylesheet_t * ccss_grammar_create_stylesheet (ccss_grammar_t *self
); ccss_stylesheet_t * ccss_grammar_create_stylesheet_from_buffer (ccss_grammar_t *self
,char const *buffer
,size_t size
,void *user_data
); ccss_stylesheet_t * ccss_grammar_create_stylesheet_from_file (ccss_grammar_t *self
,char const *css_file
,void *user_data
); char * ccss_grammar_invoke_function (ccss_grammar_t const *self
,char const *function_name
,CRTerm const *values
,void *user_data
);
typedef struct ccss_grammar_ ccss_grammar_t;
Represents a context for the creation of stylesheets of similar kind.
ccss_grammar_t * ccss_grammar_create_css (void
);
Create a new grammar instance that interprets suppported CSS rules.
Grammar objects provide a factory to create stylesheets of the same class.
Returns : |
a new ccss_grammar_t instance. |
ccss_grammar_t * ccss_grammar_create_generic (void
);
Create a new grammar instance.
Grammar objects provide a factory to create stylesheets of the same class.
Returns : |
a new ccss_grammar_t instance. |
void ccss_grammar_destroy (ccss_grammar_t *self
);
Decreases the reference count on self
by one. If the result is zero, then
self
and all associated resources are freed. See ccss_grammar_reference()
.
|
a ccss_grammar_t. |
ccss_grammar_t * ccss_grammar_reference (ccss_grammar_t *self
);
Increases the reference count on self
by one. This prevents self
from being
destroyed until a matching call to ccss_grammar_destroy()
is made.
The number of references to a ccss_grammar_t can be acquired using
ccss_grammar_get_reference_count()
.
|
a ccss_grammar_t. |
Returns : |
the referenced ccss_grammar_t. |
unsigned int ccss_grammar_get_reference_count (ccss_grammar_t const *self
);
|
a ccss_grammar_t. |
Returns : |
the current reference count of self .
If self is a nil object, 0 will be returned. |
void ccss_grammar_add_properties (ccss_grammar_t *self
,ccss_property_class_t const *properties
);
Register a set of custom CSS properties with the grammar.
|
a ccss_grammar_t. |
|
Null-terminated array of ccss_property_class_t to register. |
ccss_property_class_t const * ccss_grammar_lookup_property (ccss_grammar_t const *self
,char const *name
);
Look up a property handler by name.
|
a ccss_grammar_t. |
|
name of the property class to look up. |
Returns : |
the property handler or NULL if not found. |
void ccss_grammar_add_functions (ccss_grammar_t *self
,ccss_function_t const *functions
);
Register a set of custom css function handlers with the grammar.
|
a ccss_grammar_t. |
|
Null-terminated array of ccss_function_t to register. |
ccss_function_t const * ccss_grammar_lookup_function (ccss_grammar_t const *self
,char const *name
);
Look up a function handler by name.
|
a ccss_grammar_t. |
|
name of the function handler to look up. |
Returns : |
the property handler or NULL if not found. |
ccss_stylesheet_t * ccss_grammar_create_stylesheet (ccss_grammar_t *self
);
Create an empty stylesheet associated with grammar self
.
|
a ccss_grammar_t. |
Returns : |
an empty ccss_stylesheet_t. |
ccss_stylesheet_t * ccss_grammar_create_stylesheet_from_buffer (ccss_grammar_t *self
,char const *buffer
,size_t size
,void *user_data
);
Create a new stylesheet instance based on a CSS string.
|
a ccss_grammar_t. |
|
buffer to parse. |
|
size of the buffer. |
|
user-data passed to property- and function-handlers. |
Returns : |
a ccss_stylesheet_t representation of the CSS string. |
ccss_stylesheet_t * ccss_grammar_create_stylesheet_from_file (ccss_grammar_t *self
,char const *css_file
,void *user_data
);
Create a new stylesheet instance based on a CSS file.
|
a ccss_grammar_t. |
|
file to parse. |
|
user-data passed to property- and function-handlers. |
Returns : |
a ccss_stylesheet_t representation of the CSS file. |
char * ccss_grammar_invoke_function (ccss_grammar_t const *self
,char const *function_name
,CRTerm const *values
,void *user_data
);
Invoke a registerd function handler. This API is meant to be used by property implementations, like when parsing properties like `background-image: url(foo.png)'.
|
a ccss_grammar_t. |
|
name of the function to invoke, e.g. url . |
|
arguments passed to the function handler. |
|
user-data passed to the function handler. Overrides the user-data assigned in the function handler's definition. |
Returns : |
string value passed back by the ccss API consumer. |