summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorBo Yang <struggleyb.nku@gmail.com>2009-03-24 12:07:19 +0000
committerBo Yang <struggleyb.nku@gmail.com>2009-03-24 12:07:19 +0000
commitdfb27379f6f0d85e5a107aa673783038eb12d29e (patch)
tree5ae4c5d2ae29ada4f2619960e9bc064180159f4c /src/core
parentf2747d64aed7059b8520401f7d3b04da91212ac1 (diff)
downloadlibdom-dfb27379f6f0d85e5a107aa673783038eb12d29e.tar.gz
libdom-dfb27379f6f0d85e5a107aa673783038eb12d29e.tar.bz2
Convert NodeList and ProcessingInstruction.
svn path=/trunk/dom/; revision=6830
Diffstat (limited to 'src/core')
-rw-r--r--src/core/node.c6
-rw-r--r--src/core/nodelist.c17
-rw-r--r--src/core/pi.c2
3 files changed, 13 insertions, 12 deletions
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 */
};
/**