axl main logo
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules Pages
axlAttrCursor * axl_node_attr_cursor_new ( axlNode node)

Allows to get a cursor to iterate attributes found in the provided node in a linear and efficient way.

The axlAttrCursor could be used to iterate attributes inside a particular node in an efficient way because it stores current state (position), hiding all module details, providing access to attributes without knowing them. Then using the following functions you can modify the state (current position to get):

Finally, the following functions are provided to get the key and the value data associated to the current selected attribute, pointed by the current status of the cursor:

Here is an example:

1 axlPointer key;
2 axlPointer value;
3 axlAttrCursor * cursor;
5 // create the cursor
6 cursor = axl_node_attr_cursor_new (node);
8 // while there are more elements
9 while (axl_node_attr_cursor_has_item (cursor)) {
11  // get the value and key
12  key = axl_node_attr_cursor_get_key (cursor);
13  value = axl_node_attr_cursor_get_value (cursor);
15  // get the next
16  axl_node_attr_cursor_next (cursor);
18 }
20 // free the cursor
21 axl_node_attr_cursor_free (cursor);

Once created the axlAttrCursor you must release it and create a new one if you modify your axlNode attribute configuration adding more items.

nodeThe node that is requested to create the axlAttrCursor reference to iterate all attributes inside.
A newly created axlAttrCursor used to iterate attributes inside the node provided. Once finished you must call to axl_node_attr_cursor_free.

References axl_hash_cursor_new(), axl_new, and axl_return_val_if_fail.