From 6084a7057f746bfa953342270865f434bf98fef8 Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Tue, 24 Mar 2009 12:07:19 +0000 Subject: Convert NodeList and ProcessingInstruction. svn path=/trunk/dom/; revision=6830 --- src/core/node.c | 6 +++--- src/core/nodelist.c | 17 +++++++++-------- src/core/pi.c | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/core/node.c b/src/core/node.c index f40431e..23a0f80 100644 --- a/src/core/node.c +++ b/src/core/node.c @@ -98,6 +98,8 @@ void _dom_node_destroy(struct dom_node_internal *node) dom_node_ref(owner); } +/* This type dependent switch is not necessary from now. + But I still keep them for a while untill all the functions works well. switch (node->type) { case DOM_ELEMENT_NODE: dom_element_destroy(owner, (struct dom_element *) node); @@ -117,7 +119,6 @@ void _dom_node_destroy(struct dom_node_internal *node) (struct dom_entity_reference *) node); break; case DOM_ENTITY_NODE: - /** \todo entity node */ break; case DOM_PROCESSING_INSTRUCTION_NODE: dom_processing_instruction_destroy(owner, @@ -137,10 +138,9 @@ void _dom_node_destroy(struct dom_node_internal *node) (struct dom_document_fragment *) node); break; case DOM_NOTATION_NODE: - /** \todo notation node */ break; } - +*/ if (!null_owner_permitted) { /* Release the reference we claimed on the document. If this * is the last reference held on the document and the list diff --git a/src/core/nodelist.c b/src/core/nodelist.c index bcb634a..c19b2eb 100644 --- a/src/core/nodelist.c +++ b/src/core/nodelist.c @@ -21,7 +21,7 @@ struct dom_nodelist { struct dom_document *owner; /**< Owning document */ - struct dom_node *root; /**< Root of applicable subtree */ + struct dom_node_internal *root; /**< Root of applicable subtree */ enum { DOM_NODELIST_CHILDREN, DOM_NODELIST_BY_NAME, @@ -76,7 +76,7 @@ dom_exception dom_nodelist_create(struct dom_document *doc, if (l == NULL) return DOM_NO_MEM_ERR; - dom_node_ref((struct dom_node *) doc); + dom_node_ref(doc); l->owner = doc; dom_node_ref(root); @@ -125,7 +125,8 @@ void dom_nodelist_ref(struct dom_nodelist *list) void dom_nodelist_unref(struct dom_nodelist *list) { if (--list->refcnt == 0) { - struct dom_node *owner = (struct dom_node *) list->owner; + struct dom_node_internal *owner = + (struct dom_node_internal *) list->owner; switch (list->type) { case DOM_NODELIST_CHILDREN: @@ -165,7 +166,7 @@ void dom_nodelist_unref(struct dom_nodelist *list) dom_exception dom_nodelist_get_length(struct dom_nodelist *list, unsigned long *length) { - struct dom_node *cur = list->root->first_child; + struct dom_node_internal *cur = list->root->first_child; unsigned long len = 0; /* Traverse data structure */ @@ -205,7 +206,7 @@ dom_exception dom_nodelist_get_length(struct dom_nodelist *list, } else { /* No children or siblings. * Find first unvisited relation. */ - struct dom_node *parent = cur->parent; + struct dom_node_internal *parent = cur->parent; while (parent != list->root && cur == parent->last_child) { @@ -240,7 +241,7 @@ dom_exception dom_nodelist_get_length(struct dom_nodelist *list, dom_exception dom_nodelist_item(struct dom_nodelist *list, unsigned long index, struct dom_node **node) { - struct dom_node *cur = list->root->first_child; + struct dom_node_internal *cur = list->root->first_child; unsigned long count = 0; /* Traverse data structure */ @@ -285,7 +286,7 @@ dom_exception dom_nodelist_item(struct dom_nodelist *list, } else { /* No children or siblings. * Find first unvisited relation. */ - struct dom_node *parent = cur->parent; + struct dom_node_internal *parent = cur->parent; while (parent != list->root && cur == parent->last_child) { @@ -301,7 +302,7 @@ dom_exception dom_nodelist_item(struct dom_nodelist *list, if (cur != NULL) { dom_node_ref(cur); } - *node = cur; + *node = (struct dom_node *) cur; return DOM_NO_ERR; } diff --git a/src/core/pi.c b/src/core/pi.c index add2829..754b362 100644 --- a/src/core/pi.c +++ b/src/core/pi.c @@ -13,7 +13,7 @@ * A DOM processing instruction */ struct dom_processing_instruction { - struct dom_node base; /**< Base node */ + struct dom_node_internal base; /**< Base node */ }; /** -- cgit v1.2.3