diff options
author | Bo Yang <struggleyb.nku@gmail.com> | 2009-03-19 12:24:41 +0000 |
---|---|---|
committer | Bo Yang <struggleyb.nku@gmail.com> | 2009-03-19 12:24:41 +0000 |
commit | 2d2b525d83419bffbd7dc32c5a046f6eb4d2943a (patch) | |
tree | 7bdb22df848030e364ef345550c06c980ae6bfed /include/dom/core | |
parent | f05c3c710a443641aab66cb46a4333cdc2683d03 (diff) | |
download | libdom-2d2b525d83419bffbd7dc32c5a046f6eb4d2943a.tar.gz libdom-2d2b525d83419bffbd7dc32c5a046f6eb4d2943a.tar.bz2 |
Convert DocumentType to use vtable structure.
svn path=/trunk/dom/; revision=6804
Diffstat (limited to 'include/dom/core')
-rw-r--r-- | include/dom/core/document_type.h | 97 |
1 files changed, 84 insertions, 13 deletions
diff --git a/include/dom/core/document_type.h b/include/dom/core/document_type.h index 66b6407..3a0eb5e 100644 --- a/include/dom/core/document_type.h +++ b/include/dom/core/document_type.h @@ -10,27 +10,98 @@ #define dom_core_document_type_h_ #include <dom/core/exceptions.h> +#include <dom/core/node.h> -struct dom_document_type; struct dom_namednodemap; struct dom_string; -dom_exception dom_document_type_get_name(struct dom_document_type *doc_type, - struct dom_string **result); -dom_exception dom_document_type_get_entities( +typedef struct dom_document_type dom_document_type; +/* The Dom DocumentType vtable */ +typedef struct dom_document_type_vtable { + struct dom_node_vtable base; + + dom_exception (*dom_document_type_get_name)( + struct dom_document_type *doc_type, + struct dom_string **result); + dom_exception (*dom_document_type_get_entities)( + struct dom_document_type *doc_type, + struct dom_namednodemap **result); + dom_exception (*dom_document_type_get_notations)( + struct dom_document_type *doc_type, + struct dom_namednodemap **result); + dom_exception (*dom_document_type_get_public_id)( + struct dom_document_type *doc_type, + struct dom_string **result); + dom_exception (*dom_document_type_get_system_id)( + struct dom_document_type *doc_type, + struct dom_string **result); + dom_exception (*dom_document_type_get_internal_subset)( + struct dom_document_type *doc_type, + struct dom_string **result); +} dom_document_type_vtable; + +static inline dom_exception dom_document_type_get_name( + struct dom_document_type *doc_type, struct dom_string **result) +{ + return ((dom_document_type_vtable *) ((dom_node *) (doc_type))->vtable) + ->dom_document_type_get_name(doc_type, result); +} +#define dom_document_type_get_name(dt, r) dom_document_type_get_name( \ + (dom_document_type *) (dt), (struct dom_string **) (r)) + +static inline dom_exception dom_document_type_get_entities( struct dom_document_type *doc_type, - struct dom_namednodemap **result); -dom_exception dom_document_type_get_notations( + struct dom_namednodemap **result) +{ + return ((dom_document_type_vtable *) ((dom_node *) (doc_type))->vtable) + ->dom_document_type_get_entities(doc_type, result); +} +#define dom_document_type_get_entities(dt, r) dom_document_type_get_entities( \ + (dom_document_type *) (dt), (struct dom_string **) (r)) + +static inline dom_exception dom_document_type_get_notations( struct dom_document_type *doc_type, - struct dom_namednodemap **result); -dom_exception dom_document_type_get_public_id( + struct dom_namednodemap **result) +{ + return ((dom_document_type_vtable *) ((dom_node *) (doc_type))->vtable) + ->dom_document_type_get_notations(doc_type, result); +} +#define dom_document_type_get_notations(dt, r) dom_document_type_get_notations(\ + (dom_document_type *) (dt), (struct dom_string **) (r)) + +static inline dom_exception dom_document_type_get_public_id( struct dom_document_type *doc_type, - struct dom_string **result); -dom_exception dom_document_type_get_system_id( + struct dom_string **result) +{ + return ((dom_document_type_vtable *) ((dom_node *) (doc_type))->vtable) + ->dom_document_type_get_public_id(doc_type, result); +} +#define dom_document_type_get_public_id(dt, r) \ + dom_document_type_get_public_id((dom_document_type *) (dt), \ + (struct dom_string **) (r)) + +static inline dom_exception dom_document_type_get_system_id( struct dom_document_type *doc_type, - struct dom_string **result); -dom_exception dom_document_type_get_internal_subset( + struct dom_string **result) +{ + return ((dom_document_type_vtable *) ((dom_node *) (doc_type))->vtable) + ->dom_document_type_get_system_id(doc_type, result); +} +#define dom_document_type_get_system_id(dt, r) \ + dom_document_type_get_system_id((dom_document_type *) (dt), \ + (struct dom_string **) (r)) + +static inline dom_exception dom_document_type_get_internal_subset( struct dom_document_type *doc_type, - struct dom_string **result); + struct dom_string **result) +{ + return ((dom_document_type_vtable *) ((dom_node *) (doc_type))->vtable) + ->dom_document_type_get_internal_subset(doc_type, + result); +} +#define dom_document_type_get_internal_subset(dt, r) \ + dom_document_type_get_internal_subset( \ + (dom_document_type *) (dt), (struct dom_string **) (r)) + #endif |