diff options
author | Mike Blumenkrantz <michael.blumenkrantz@gmail.com> | 2011-07-04 03:47:03 +0000 |
---|---|---|
committer | Mike Blumenkrantz <michael.blumenkrantz@gmail.com> | 2011-07-04 03:47:03 +0000 |
commit | c6025ea2536c6ad3b2f4190d1b68d6d1173df1fe (patch) | |
tree | 70df93a661ead0d8c3689be5a7e6b3ef9ffa9a4a | |
parent | 7fcf0a7dc29f88d9d7b5e0ad6969db35ab631964 (diff) | |
download | eet-c6025ea2536c6ad3b2f4190d1b68d6d1173df1fe.tar.gz |
add a bunch of functions for manipulating eet_node structs
SVN revision: 60957
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | src/lib/Eet.h | 47 | ||||
-rw-r--r-- | src/lib/eet_node.c | 43 |
4 files changed, 97 insertions, 0 deletions
@@ -10,3 +10,4 @@ Raphael Kubo da Costa <kubo@profusion.mobi> Mathieu Taillefumier <mathieu.taillefumier@free.fr> Albin "Lutin" Tonnerre <albin.tonnerre@gmail.com> Adam Simpkins <adam@adamsimpkins.net> +Mike Blumenkrantz <mike@zentific.com> @@ -509,3 +509,9 @@ 2011-06-10 Cedric BAIL * Add EET_DATA_DESCRIPTOR_ADD_LIST_STRING helper to define List of char *. + +2011-07-04 Mike Blumenkrantz + + * Add functions to manipulate nodes: + eet_node_children_get, eet_node_next_get, eet_node_parent_get, + eet_node_type_get, eet_node_value_get, eet_node_name_get diff --git a/src/lib/Eet.h b/src/lib/Eet.h index 3f01904..06a27a9 100644 --- a/src/lib/Eet.h +++ b/src/lib/Eet.h @@ -3745,6 +3745,35 @@ eet_node_struct_child_new(const char *parent, Eet_Node *child); /** + * @brief Get a node's child nodes + * @param node The node + * @return The first child node which contains a pointer to the + * next child node and the parent. + * @since 1.5 + */ +EAPI Eet_Node * +eet_node_children_get(Eet_Node *node); + +/** + * @brief Get the next node in a list of nodes + * @param node The node + * @return A node which contains a pointer to the + * next child node and the parent. + * @since 1.5 + */ +EAPI Eet_Node * +eet_node_next_get(Eet_Node *node); + +/** + * @brief Get the parent node of a node + * @param node The node + * @return The parent node of @p node + * @since 1.5 + */ +EAPI Eet_Node * +eet_node_parent_get(Eet_Node *node); + +/** * TODO FIX ME * @ingroup Eet_Node_Group */ @@ -3783,6 +3812,24 @@ eet_node_dump(Eet_Node *n, void *dumpdata); /** + * @brief Return the type of a node + * @param node The node + * @return The node's type (EET_T_$TYPE) + * @since 1.5 + */ +EAPI int +eet_node_type_get(Eet_Node *node); + +/** + * @brief Return the node's data + * @param node The node + * @return The data contained in the node + * @since 1.5 + */ +EAPI Eet_Node_Data * +eet_node_value_get(Eet_Node *node); + +/** * TODO FIX ME * @ingroup Eet_Node_Group */ diff --git a/src/lib/eet_node.c b/src/lib/eet_node.c index 35d820a..771fe13 100644 --- a/src/lib/eet_node.c +++ b/src/lib/eet_node.c @@ -225,6 +225,27 @@ eet_node_struct_child_new(const char *parent, return n; } /* eet_node_struct_child_new */ +Eet_Node * +eet_node_children_get(Eet_Node *node) +{ + if (!node) return NULL; + return node->values; +} + +Eet_Node * +eet_node_next_get(Eet_Node *node) +{ + if (!node) return NULL; + return node->next; +} + +Eet_Node * +eet_node_parent_get(Eet_Node *node) +{ + if (!node) return NULL; + return node->parent; +} + void eet_node_list_append(Eet_Node *parent, const char *name, @@ -330,6 +351,28 @@ eet_node_hash_add(Eet_Node *parent, parent->values = nn; } /* eet_node_hash_add */ + +int +eet_node_type_get(Eet_Node *node) +{ + if (!node) return EET_T_UNKNOW; + return node->type; +} + +Eet_Node_Data * +eet_node_value_get(Eet_Node *node) +{ + if (!node) return NULL; + return &node->data; +} + +const char * +eet_node_name_get(Eet_Node *node) +{ + if (!node) return NULL; + return node->name; +} + void eet_node_del(Eet_Node *n) { |