llconf
0.0.2
|
Data Structures | |
struct | cnfnode |
A node in a parsed configuration tree. More... | |
Functions | |
struct cnfnode * | create_cnfnode (const char *name) |
creates an empty node. More... | |
struct cnfnode * | clone_cnfnode (const struct cnfnode *cn) |
copies a node. More... | |
struct cnfnode * | clone_cnftree (const struct cnfnode *cn_root) |
copy a whole tree. More... | |
const char * | cnfnode_getval (const struct cnfnode *cn) |
gets the value of a node. More... | |
const char * | cnfnode_getname (const struct cnfnode *cn) |
gets the name of a node. More... | |
void | cnfnode_setval (struct cnfnode *cn, const char *value) |
sets the value of a node. More... | |
void | cnfnode_setname (struct cnfnode *cn, const char *name) |
sets the name of a node. More... | |
void | destroy_cnfnode (struct cnfnode *cn) |
frees a node structure. More... | |
void | destroy_cnftree (struct cnfnode *cn) |
frees a whole node tree. More... | |
void | append_node (struct cnfnode *cn_parent, struct cnfnode *cn) |
appends a node to the list of children. More... | |
void | insert_node_before (struct cnfnode *cn_before, struct cnfnode *cn) |
inserts a node to the list of children before another node. More... | |
void | unlink_node (struct cnfnode *cn) |
unlink a node from its list. More... | |
struct cnfnode * | find_node (struct cnfnode *cn_list, const char *name) |
search for a node. More... | |
int | compare_cnfnode (const struct cnfnode *cn1, const struct cnfnode *cn2) |
compare two nodes. More... | |
int | compare_cnftree (const struct cnfnode *cn_root1, const struct cnfnode *cn_root2) |
compare two trees. More... | |
int | compare_cnftree_children (const struct cnfnode *cn_root1, const struct cnfnode *cn_root2) |
compare two trees. More... | |
void | dump_nodes (struct cnfnode *cn_root, int level) |
appends a node to the list of children.
cn_parent | the parent node |
cn | pointer to the node to be appended |
copies a node.
a new node will be allocated, and the name and value of cn copied. The node will not be linked into the tree.
cn | the pointer to the node to be copied |
copy a whole tree.
recursively copies a whole tree by calling clone_cnfnode()
cn_root | pointer to the root of the tree. |
|
inline |
gets the name of a node.
cn | pointer to a node |
|
inline |
gets the value of a node.
cn | pointer to a node |
void cnfnode_setname | ( | struct cnfnode * | cn, |
const char * | name | ||
) |
sets the name of a node.
if the node already has a name, that name will be free'ed.
cn | pointer to a node |
name | pointer to the new name |
void cnfnode_setval | ( | struct cnfnode * | cn, |
const char * | value | ||
) |
sets the value of a node.
if the node already has a value, that value will be free'ed.
cn | pointer to a node |
value | pointer to the new value |
compare two nodes.
compares two nodes by name and then value. A NULL value is less than any string.
cn1 | first node |
cn2 | second node |
compare two trees.
Recursively compare two trees if they are the same, by comparing the names, values and subtrees. The return value is pretty much useless, except for the fact that it indicates if the trees match or not, because this function returns as soon as it finds some difference.
cn_root1 | the first tree |
cn_root2 | the second tree |
compare two trees.
Recursively compare two trees if they are the same, by comparing the names, values and subtrees, except the names and values of the two rot nodes. The return value is pretty much useless, except for the fact that it indicates if the trees match or not, because this function returns as soon as it finds some difference.
cn_root1 | the first tree |
cn_root2 | the second tree |
struct cnfnode* create_cnfnode | ( | const char * | name | ) |
creates an empty node.
a node will be allocated, and its name set. The allocated structure will be returned.
name | the name of the node |
void destroy_cnfnode | ( | struct cnfnode * | cn | ) |
frees a node structure.
the memory of the node structure will be freed. Any memory used by the name or value will be freed as well.
cn | pointer to a node |
void destroy_cnftree | ( | struct cnfnode * | cn_root | ) |
frees a whole node tree.
recursively frees memory of the tree pointed to by cn, by recursively calling destroy_cnfnode()
cn_root | pointer to the root of the tree. |
void dump_nodes | ( | struct cnfnode * | cn_root, |
int | level | ||
) |
search for a node.
searches in the list beginning with cn_list. This function does not search recursively in the children's lists.
cn_list | the first node to be searched |
name | the name to search for |
inserts a node to the list of children before another node.
cn_before | pointer to the node before which the node shall be inserted. |
cn | pointer to the node to be inserted |
void unlink_node | ( | struct cnfnode * | cn | ) |
unlink a node from its list.
removes a node from its list. The memory will not be freed, you have to call destroy_cnfnode() or destroy_cnftree() separately.
cn | pointer to the node to be unlinked. |