Hubbub $Id$
Classes | Typedefs
tree.h File Reference
#include <hubbub/functypes.h>

Go to the source code of this file.

Classes

struct  hubbub_tree_handler
 Hubbub tree handler. More...
 

Typedefs

typedef hubbub_error(* hubbub_tree_create_comment) (void *ctx, const hubbub_string *data, void **result)
 Create a comment node. More...
 
typedef hubbub_error(* hubbub_tree_create_doctype) (void *ctx, const hubbub_doctype *doctype, void **result)
 Create a doctype node. More...
 
typedef hubbub_error(* hubbub_tree_create_element) (void *ctx, const hubbub_tag *tag, void **result)
 Create an element node. More...
 
typedef hubbub_error(* hubbub_tree_create_text) (void *ctx, const hubbub_string *data, void **result)
 Create a text node. More...
 
typedef hubbub_error(* hubbub_tree_ref_node) (void *ctx, void *node)
 Increase a node's reference count. More...
 
typedef hubbub_error(* hubbub_tree_unref_node) (void *ctx, void *node)
 Decrease a node's reference count. More...
 
typedef hubbub_error(* hubbub_tree_append_child) (void *ctx, void *parent, void *child, void **result)
 Append a node to the end of another's child list. More...
 
typedef hubbub_error(* hubbub_tree_insert_before) (void *ctx, void *parent, void *child, void *ref_child, void **result)
 Insert a node into another's child list. More...
 
typedef hubbub_error(* hubbub_tree_remove_child) (void *ctx, void *parent, void *child, void **result)
 Remove a node from another's child list. More...
 
typedef hubbub_error(* hubbub_tree_clone_node) (void *ctx, void *node, bool deep, void **result)
 Clone a node. More...
 
typedef hubbub_error(* hubbub_tree_reparent_children) (void *ctx, void *node, void *new_parent)
 Move all the children of one node to another. More...
 
typedef hubbub_error(* hubbub_tree_get_parent) (void *ctx, void *node, bool element_only, void **result)
 Retrieve the parent of a node. More...
 
typedef hubbub_error(* hubbub_tree_has_children) (void *ctx, void *node, bool *result)
 Determine if a node has children. More...
 
typedef hubbub_error(* hubbub_tree_form_associate) (void *ctx, void *form, void *node)
 Associate a node with a form. More...
 
typedef hubbub_error(* hubbub_tree_add_attributes) (void *ctx, void *node, const hubbub_attribute *attributes, uint32_t n_attributes)
 Add attributes to a node. More...
 
typedef hubbub_error(* hubbub_tree_set_quirks_mode) (void *ctx, hubbub_quirks_mode mode)
 Notification of the quirks mode of a document. More...
 
typedef hubbub_error(* hubbub_tree_encoding_change) (void *ctx, const char *encname)
 Notification that a potential encoding change is required. More...
 
typedef hubbub_error(* hubbub_tree_complete_script) (void *ctx, void *script)
 Complete script processing. More...
 
typedef struct hubbub_tree_handler hubbub_tree_handler
 Hubbub tree handler. More...
 

Typedef Documentation

◆ hubbub_tree_add_attributes

typedef hubbub_error(* hubbub_tree_add_attributes) (void *ctx, void *node, const hubbub_attribute *attributes, uint32_t n_attributes)

Add attributes to a node.

Parameters
ctxClient's context
nodeThe node to add to
attributesArray of attributes to add
n_attributesNumber of entries in array
Returns
HUBBUB_OK on success, appropriate error otherwise.

◆ hubbub_tree_append_child

typedef hubbub_error(* hubbub_tree_append_child) (void *ctx, void *parent, void *child, void **result)

Append a node to the end of another's child list.

Parameters
ctxClient's context
parentThe node to append to
childThe node to append
resultPointer to location to receive appended node
Returns
HUBBUB_OK on success, appropriate error otherwise.

Postcondition: if successful, result's reference count is increased by 1

Important: *result may not == child (e.g. if text nodes got coalesced)

◆ hubbub_tree_clone_node

typedef hubbub_error(* hubbub_tree_clone_node) (void *ctx, void *node, bool deep, void **result)

Clone a node.

Parameters
ctxClient's context
nodeThe node to clone
deepTrue to clone entire subtree, false to clone only the node
resultPointer to location to receive clone
Returns
HUBBUB_OK on success, appropriate error otherwise.

Postcondition: if successful, result's reference count must be 1.

◆ hubbub_tree_complete_script

typedef hubbub_error(* hubbub_tree_complete_script) (void *ctx, void *script)

Complete script processing.

Parameters
ctxClient's context
scriptThe script
Returns
HUBBUB_OK on success, appropriate error otherwise.

◆ hubbub_tree_create_comment

typedef hubbub_error(* hubbub_tree_create_comment) (void *ctx, const hubbub_string *data, void **result)

Create a comment node.

Parameters
ctxClient's context
dataString content of node
resultPointer to location to receive created node
Returns
HUBBUB_OK on success, appropriate error otherwise.

Postcondition: if successful, result's reference count must be 1.

◆ hubbub_tree_create_doctype

typedef hubbub_error(* hubbub_tree_create_doctype) (void *ctx, const hubbub_doctype *doctype, void **result)

Create a doctype node.

Parameters
ctxClient's context
doctypeData for doctype node (name, public id, system id)
resultPointer to location to receive created node
Returns
HUBBUB_OK on success, appropriate error otherwise.

Postcondition: if successful, result's reference count must be 1.

◆ hubbub_tree_create_element

typedef hubbub_error(* hubbub_tree_create_element) (void *ctx, const hubbub_tag *tag, void **result)

Create an element node.

Parameters
ctxClient's context
tagData for element node (namespace, name, attributes)
resultPointer to location to receive created node
Returns
HUBBUB_OK on success, appropriate error otherwise.

Postcondition: if successful, result's reference count must be 1.

◆ hubbub_tree_create_text

typedef hubbub_error(* hubbub_tree_create_text) (void *ctx, const hubbub_string *data, void **result)

Create a text node.

Parameters
ctxClient's context
dataString content of node
resultPointer to location to receive created node
Returns
HUBBUB_OK on success, appropriate error otherwise.

Postcondition: if successful, result's reference count must be 1.

◆ hubbub_tree_encoding_change

typedef hubbub_error(* hubbub_tree_encoding_change) (void *ctx, const char *encname)

Notification that a potential encoding change is required.

Parameters
ctxClient's context
charsetThe new charset for the source data
Returns
HUBBUB_OK to continue using the current input handler, HUBBUB_ENCODINGCHANGE to stop processing immediately and return control to the client, appropriate error otherwise.

◆ hubbub_tree_form_associate

typedef hubbub_error(* hubbub_tree_form_associate) (void *ctx, void *form, void *node)

Associate a node with a form.

Parameters
ctxClient's context
formThe form to associate with
nodeThe node to associate
Returns
HUBBUB_OK on success, appropriate error otherwise.

◆ hubbub_tree_get_parent

typedef hubbub_error(* hubbub_tree_get_parent) (void *ctx, void *node, bool element_only, void **result)

Retrieve the parent of a node.

Parameters
ctxClient context
nodeNode to retrieve the parent of
element_onlyTrue if the parent must be an element, false otherwise
resultPointer to location to receive parent node
Returns
HUBBUB_OK on success, appropriate error otherwise.

If there is a parent node, but it is not an element node and element_only is true, then act as if no parent existed.

Postcondition: if there is a parent, then result's reference count must be increased.

◆ hubbub_tree_handler

Hubbub tree handler.

◆ hubbub_tree_has_children

typedef hubbub_error(* hubbub_tree_has_children) (void *ctx, void *node, bool *result)

Determine if a node has children.

Parameters
ctxClient's context
nodeThe node to inspect
resultLocation to receive result
Returns
HUBBUB_OK on success, appropriate error otherwise.

◆ hubbub_tree_insert_before

typedef hubbub_error(* hubbub_tree_insert_before) (void *ctx, void *parent, void *child, void *ref_child, void **result)

Insert a node into another's child list.

Parameters
ctxClient's context
parentThe node to insert into
childThe node to insert
ref_childThe node to insert before
resultPointer to location to receive inserted node
Returns
HUBBUB_OK on success, appropriate error otherwise.

Postcondition: if successful, result's reference count is increased by 1

Important: *result may not == child (e.g. if text nodes got coalesced)

◆ hubbub_tree_ref_node

typedef hubbub_error(* hubbub_tree_ref_node) (void *ctx, void *node)

Increase a node's reference count.

Parameters
ctxClient's context
nodeNode to reference
Returns
HUBBUB_OK on success, appropriate error otherwise.

Postcondition: node's reference count is one larger than before

◆ hubbub_tree_remove_child

typedef hubbub_error(* hubbub_tree_remove_child) (void *ctx, void *parent, void *child, void **result)

Remove a node from another's child list.

Parameters
ctxClient context
parentThe node to remove from
childThe node to remove
resultPointer to location to receive removed node
Returns
HUBBUB_OK on success, appropriate error otherwise.

Postcondition: if successful, result's reference count is increased by 1

◆ hubbub_tree_reparent_children

typedef hubbub_error(* hubbub_tree_reparent_children) (void *ctx, void *node, void *new_parent)

Move all the children of one node to another.

Parameters
ctxClient's context
nodeThe initial parent node
new_parentThe new parent node
Returns
HUBBUB_OK on success, appropriate error otherwise.

◆ hubbub_tree_set_quirks_mode

typedef hubbub_error(* hubbub_tree_set_quirks_mode) (void *ctx, hubbub_quirks_mode mode)

Notification of the quirks mode of a document.

Parameters
ctxClient's context
modeThe quirks mode
Returns
HUBBUB_OK on success, appropriate error otherwise.

◆ hubbub_tree_unref_node

typedef hubbub_error(* hubbub_tree_unref_node) (void *ctx, void *node)

Decrease a node's reference count.

Parameters
ctxClient's context
nodeNode to reference
Returns
HUBBUB_OK on success, appropriate error otherwise.

Postcondition: If the node's reference count becomes zero, and it has no parent, and it is not the document node, then it is destroyed. Otherwise, the reference count is one less than before.