libdom
Loading...
Searching...
No Matches
walk.h File Reference

Go to the source code of this file.

Typedefs

typedef enum dom_walk_cmd(* dom_walk_cb) (enum dom_walk_stage stage, dom_node_type type, dom_node *node, void *pw)
 

Enumerations

enum  dom_walk_stage { DOM_WALK_STAGE_ENTER , DOM_WALK_STAGE_LEAVE }
 
enum  dom_walk_enable { DOM_WALK_ENABLE_ENTER = (1 << DOM_WALK_STAGE_ENTER) , DOM_WALK_ENABLE_LEAVE = (1 << DOM_WALK_STAGE_LEAVE) , DOM_WALK_ENABLE_ALL = DOM_WALK_ENABLE_ENTER | DOM_WALK_ENABLE_LEAVE }
 
enum  dom_walk_cmd { DOM_WALK_CMD_CONTINUE , DOM_WALK_CMD_ABORT , DOM_WALK_CMD_SKIP }
 

Functions

dom_exception libdom_treewalk (enum dom_walk_enable mask, dom_walk_cb cb, dom_node *root, void *pw)
 

Detailed Description

This is an API for walking a loaded DOM.

Typedef Documentation

◆ dom_walk_cb

typedef enum dom_walk_cmd(* dom_walk_cb) (enum dom_walk_stage stage, dom_node_type type, dom_node *node, void *pw)

DOM walking callback.

Client callback for DOM walk.

Parameters
[in]stageWhether the node is being entered or left.
[in]nodeThe node being walked. Client must take ref itself.
[in]typeThe node type.
[in]pwClient private data.
Returns
Tree walking client command.

Enumeration Type Documentation

◆ dom_walk_cmd

Enumerator
DOM_WALK_CMD_CONTINUE 

Continue the tree walk.

DOM_WALK_CMD_ABORT 

Early termination of the tree walk.

DOM_WALK_CMD_SKIP 

Skip children (only for DOM_WALK_ENABLE_ENTER).

◆ dom_walk_enable

Enumerator
DOM_WALK_ENABLE_ENTER 
DOM_WALK_ENABLE_LEAVE 
DOM_WALK_ENABLE_ALL 

◆ dom_walk_stage

Enumerator
DOM_WALK_STAGE_ENTER 
DOM_WALK_STAGE_LEAVE 

Function Documentation

◆ libdom_treewalk()

dom_exception libdom_treewalk ( enum dom_walk_enable mask,
dom_walk_cb cb,
dom_node * root,
void * pw )

Walk a DOM subtree.

Parameters
[in]maskMask of stages to enable callback for.
[in]cbThe client callback function.
[in]rootNode to start walk from.
[in]pwThe client's private data.
Returns
false for early termination of walk, true otherwise.