From 79bfe3a2a055ac3d33509de9e68faa85c069e1ba Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sat, 11 Feb 2012 21:24:47 +0000 Subject: Provide custom API to ease optimal binding to libcss svn path=/trunk/libdom/; revision=13440 --- include/dom/core/element.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'include') diff --git a/include/dom/core/element.h b/include/dom/core/element.h index c77335b..df093a4 100644 --- a/include/dom/core/element.h +++ b/include/dom/core/element.h @@ -87,6 +87,14 @@ typedef struct dom_element_vtable { dom_exception (*dom_element_set_id_attribute_node)( struct dom_element *element, struct dom_attr *id_attr, bool is_id); + + /* These two are for the benefit of bindings to libcss */ + dom_exception (*dom_element_get_classes)( + struct dom_element *element, + lwc_string ***classes, uint32_t *n_classes); + dom_exception (*dom_element_has_class)( + struct dom_element *element, + lwc_string *name, bool *match); } dom_element_vtable; static inline dom_exception dom_element_get_tag_name( @@ -323,4 +331,25 @@ static inline dom_exception dom_element_set_id_attribute_node( dom_element_set_id_attribute_node((dom_element *) (e), \ (struct dom_attr *) (a), (bool) (i)) +static inline dom_exception dom_element_get_classes( + struct dom_element *element, + lwc_string ***classes, uint32_t *n_classes) +{ + return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> + dom_element_get_classes(element, classes, n_classes); +} +#define dom_element_get_classes(e, c, n) \ + dom_element_get_classes((dom_element *) (e), \ + (lwc_string ***) (c), (uint32_t *) (n)) + +static inline dom_exception dom_element_has_class( + struct dom_element *element, lwc_string *name, bool *match) +{ + return ((dom_element_vtable *) ((dom_node *) element)->vtable)-> + dom_element_has_class(element, name, match); +} +#define dom_element_has_class(e, n, m) \ + dom_element_has_class((dom_element *) (e), \ + (lwc_string *) (n), (bool *) (m)) + #endif -- cgit v1.2.3