|
cwist
Modern C web framework with libttak runtime
|
Named render functions that produce cwist_html_element_t trees. More...

Go to the source code of this file.
Functions | |
| cwist_html_component_t * | cwist_html_component_create (const char *name, cwist_html_component_render_fn render_fn) |
| Create a named component wrapping a render function. | |
| void | cwist_html_component_destroy (cwist_html_component_t *comp) |
| Destroy a component and free its name. | |
| const char * | cwist_html_component_name (const cwist_html_component_t *comp) |
| Get the component's name. | |
| cwist_html_element_t * | cwist_html_component_instantiate (cwist_html_component_t *comp, const void *props, cwist_html_element_t **children, size_t child_count) |
| Run the component's render function to produce an element tree. | |
Named render functions that produce cwist_html_element_t trees.
Definition in file component.c.
| cwist_html_component_t * cwist_html_component_create | ( | const char * | name, |
| cwist_html_component_render_fn | render_fn | ||
| ) |
Create a named component wrapping a render function.
Create a component.
| name | Non-empty component name; copied into the new component. |
| render_fn | Render function invoked by cwist_html_component_instantiate(). |
Definition at line 22 of file component.c.
References cwist_alloc(), cwist_free(), and cwist_strdup().
| void cwist_html_component_destroy | ( | cwist_html_component_t * | comp | ) |
Destroy a component and free its name.
Destroy a component. Elements it already produced are unaffected.
| comp | Component to destroy; NULL is accepted and does nothing. Must not be used after this call. |
Definition at line 44 of file component.c.
References cwist_free().
| cwist_html_element_t * cwist_html_component_instantiate | ( | cwist_html_component_t * | comp, |
| const void * | props, | ||
| cwist_html_element_t ** | children, | ||
| size_t | child_count | ||
| ) |
Run the component's render function to produce an element tree.
Render one instance of a component.
| comp | Component whose render function is invoked; may be NULL. |
| props | Opaque props forwarded to the render function. |
| children | Child elements forwarded to the render function. When comp is NULL they are destroyed here instead, since no render function takes ownership of them. |
| child_count | Number of entries in children. |
Definition at line 71 of file component.c.
References cwist_html_element_destroy().
Referenced by cwist_http_response_set_view().
| const char * cwist_html_component_name | ( | const cwist_html_component_t * | comp | ) |
Get the component's name.
Return the name the component was created with.
| comp | Component to query; may be NULL. |
comp is NULL. Definition at line 55 of file component.c.