![]() |
![]() |
![]() |
LibMateComponentUI API Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
MateComponentUINode; MateComponentUINode * matecomponent_ui_node_new (const char *name
); MateComponentUINode * matecomponent_ui_node_new_child (MateComponentUINode *parent
,const char *name
); MateComponentUINode * matecomponent_ui_node_copy (MateComponentUINode *node
,gboolean recursive
); void matecomponent_ui_node_free (MateComponentUINode *node
); void matecomponent_ui_node_set_data (MateComponentUINode *node
,gpointer data
); gpointer matecomponent_ui_node_get_data (MateComponentUINode *node
); void matecomponent_ui_node_set_attr (MateComponentUINode *node
,const char *name
,const char *value
); char * matecomponent_ui_node_get_attr (MateComponentUINode *node
,const char *name
); gboolean matecomponent_ui_node_has_attr (MateComponentUINode *node
,const char *name
); void matecomponent_ui_node_remove_attr (MateComponentUINode *node
,const char *name
); void matecomponent_ui_node_add_child (MateComponentUINode *parent
,MateComponentUINode *child
); void matecomponent_ui_node_insert_before (MateComponentUINode *after
,MateComponentUINode *new_before
); void matecomponent_ui_node_unlink (MateComponentUINode *node
); void matecomponent_ui_node_replace (MateComponentUINode *old_node
,MateComponentUINode *new_node
); void matecomponent_ui_node_set_content (MateComponentUINode *node
,const char *content
); char * matecomponent_ui_node_get_content (MateComponentUINode *node
); MateComponentUINode * matecomponent_ui_node_next (MateComponentUINode *node
); MateComponentUINode * matecomponent_ui_node_prev (MateComponentUINode *node
); MateComponentUINode * matecomponent_ui_node_children (MateComponentUINode *node
); MateComponentUINode * matecomponent_ui_node_parent (MateComponentUINode *node
); const char * matecomponent_ui_node_get_name (MateComponentUINode *node
); gboolean matecomponent_ui_node_has_name (MateComponentUINode *node
,const char *name
); gboolean matecomponent_ui_node_transparent (MateComponentUINode *node
); void matecomponent_ui_node_copy_attrs (const MateComponentUINode *src
,MateComponentUINode *dest
); void matecomponent_ui_node_free_string (char *str
); void matecomponent_ui_node_strip (MateComponentUINode **node
); char * matecomponent_ui_node_to_string (MateComponentUINode *node
,gboolean recurse
); MateComponentUINode * matecomponent_ui_node_from_string (const char *str
); MateComponentUINode * matecomponent_ui_node_from_file (const char *filename
);
The MateComponentUINode API is designed to make XML node manipulation simple, and to hide the underlying implementation of the XML tree. This is to allow the use of some more efficient internal representation than libxml's at some later date.
typedef struct _MateComponentUINode MateComponentUINode;
The MateComponentUINode structure is fully opaque to stop any code depending on libxml inadvertantly.
MateComponentUINode * matecomponent_ui_node_new (const char *name
);
Creates a new node with name name
|
The name for the node |
Returns : |
a new node pointer |
MateComponentUINode * matecomponent_ui_node_new_child (MateComponentUINode *parent
,const char *name
);
Create a new node as a child of parent
with name name
|
the parent |
|
the name of the new child |
Returns : |
pointer to the new child |
MateComponentUINode * matecomponent_ui_node_copy (MateComponentUINode *node
,gboolean recursive
);
Copy an XML node, if recursive
do a deep copy, otherwise just dup the node itself.
|
the node |
|
whether to dup children too. |
Returns : |
a copy of the noce |
void matecomponent_ui_node_free (MateComponentUINode *node
);
Frees the memory associated with the node
and unlink it from the tree
|
a node. |
void matecomponent_ui_node_set_data (MateComponentUINode *node
,gpointer data
);
Associates some user data with the node pointer
|
the node |
|
user data |
gpointer matecomponent_ui_node_get_data (MateComponentUINode *node
);
Gets user data associated with node
|
the node |
Returns : |
the user data, see matecomponent_ui_node_set_data |
void matecomponent_ui_node_set_attr (MateComponentUINode *node
,const char *name
,const char *value
);
Set the attribute of name
on node
to value
overriding any
previous values of that attr.
|
The node |
|
the name of the attr |
|
the value for the attr |
char * matecomponent_ui_node_get_attr (MateComponentUINode *node
,const char *name
);
Fetch the value of an attr of name name
from node
see also: matecomponent_ui_node_free_string
|
the node |
|
the name of the attr to get |
Returns : |
the attr text. |
gboolean matecomponent_ui_node_has_attr (MateComponentUINode *node
,const char *name
);
Determines whether the node
has an attribute of name name
|
the node |
|
the name of the attr to detect |
Returns : |
TRUE if the attr exists |
void matecomponent_ui_node_remove_attr (MateComponentUINode *node
,const char *name
);
remove any attribute with name name
from node
|
the node |
|
name of the attribute |
void matecomponent_ui_node_add_child (MateComponentUINode *parent
,MateComponentUINode *child
);
Add a child
node to the parent
node ( after the other children )
|
the parent |
|
the new child |
void matecomponent_ui_node_insert_before (MateComponentUINode *after
,MateComponentUINode *new_before
);
Insert a sibling
before prev_sibling
in a node list
|
the placeholder for insertion |
|
the node to insert |
void matecomponent_ui_node_unlink (MateComponentUINode *node
);
Unlink node
from its tree, ie. disassociate it with its parent
|
the node |
void matecomponent_ui_node_replace (MateComponentUINode *old_node
,MateComponentUINode *new_node
);
Replace old_node
with new_node
in the tree. old_node
is
left unlinked and floating with its children.
|
node to be replaced |
|
node to replace with |
void matecomponent_ui_node_set_content (MateComponentUINode *node
,const char *content
);
Set the textual content of node
to content
|
the node |
|
the new content |
char * matecomponent_ui_node_get_content (MateComponentUINode *node
);
see also: matecomponent_ui_node_free_string
|
the node |
Returns : |
the content of node
|
MateComponentUINode * matecomponent_ui_node_next (MateComponentUINode *node
);
|
the node |
Returns : |
the node after node in the list
|
MateComponentUINode * matecomponent_ui_node_prev (MateComponentUINode *node
);
|
the node |
Returns : |
the node after node in the list
|
MateComponentUINode * matecomponent_ui_node_children (MateComponentUINode *node
);
|
the node |
Returns : |
the first child of node
|
MateComponentUINode * matecomponent_ui_node_parent (MateComponentUINode *node
);
|
the node |
Returns : |
the parent node of node
|
const char * matecomponent_ui_node_get_name (MateComponentUINode *node
);
|
the node |
Returns : |
the name of node
|
gboolean matecomponent_ui_node_has_name (MateComponentUINode *node
,const char *name
);
|
the node |
|
a name the node might have |
Returns : |
TRUE if node has name == name
|
gboolean matecomponent_ui_node_transparent (MateComponentUINode *node
);
Determines whether node
is transparent. A node is
transparent if it has no content and either no attributes
or a single 'name' attribute.
|
the node |
Returns : |
TRUE if transparent |
void matecomponent_ui_node_copy_attrs (const MateComponentUINode *src
,MateComponentUINode *dest
);
This function copies all the attributes from src
to dest
effectively cloning the src
node as dest
|
the attr source node |
|
where to dump the attrs. |
void matecomponent_ui_node_free_string (char *str
);
Frees a string returned by any of the get routines.
|
the string to free. |
void matecomponent_ui_node_strip (MateComponentUINode **node
);
A compat function for legacy reasons.
|
a pointer to the node's pointer |
char * matecomponent_ui_node_to_string (MateComponentUINode *node
,gboolean recurse
);
Convert the node to its XML string representation.
|
the node tree |
|
whether to dump its children as well |
Returns : |
the string representation or NULL on error Use g_free to free. |
MateComponentUINode * matecomponent_ui_node_from_string (const char *str
);
Parses a string into an XML tree
|
|
Returns : |
the xml tree. |
MateComponentUINode * matecomponent_ui_node_from_file (const char *filename
);
Loads and parses the filename into an XML tree
|
|
Returns : |
the xml tree. |