AXEvent
ax_event_element_item.h File Reference

The AXEventElementItem and its associated functions. The functions in this module are not thread safe. More...

Go to the source code of this file.

Typedefs

typedef struct _AXEventElementItem AXEventElementItem
 The AXEventElementItem is a n opaque data type representing a node in a tree.
 

Functions

AXEventElementItemax_event_element_item_new (const gchar *name, const gchar *name_space)
 Creates a new node in the tree. More...
 
void ax_event_element_item_free (AXEventElementItem *node)
 Frees an AXEventElementItem. More...
 
gboolean ax_event_element_item_get_name (AXEventElementItem *node, gchar **name, GError **error)
 Get the name of an AXEventElementItem. More...
 
gboolean ax_event_element_item_get_name_space (AXEventElementItem *node, gchar **name_space, GError **error)
 Get the name space of the name of an AXEventElementItem. More...
 
gboolean ax_event_element_item_set_attributes (AXEventElementItem *node, GHashTable *attributes, GError **error)
 Adds attributes to an AXEventElementItem. If called more than once on the same AXEventElementItem, only the attributes provided in the last call are used. The attributes can be removed by providing NULL as attributes. More...
 
gboolean ax_event_element_item_get_attributes (AXEventElementItem *node, GHashTable **attributes, GError **error)
 Get the attributes of an AXEventElementItem. More...
 
gboolean ax_event_element_item_set_body (AXEventElementItem *node, const gchar *body, GError **error)
 Set the body of an AXEventElementItem. More...
 
gboolean ax_event_element_item_get_body (AXEventElementItem *node, gchar **body, GError **error)
 Get the body of an AXEventElementItem. More...
 
gboolean ax_event_element_item_add_child (AXEventElementItem *node, AXEventElementItem *child, GError **error)
 Add an child to an AXEventElementItem. More...
 
gboolean ax_event_element_item_get_first_child (AXEventElementItem *parent, AXEventElementItem **child, GError **error)
 Retrieve the first child of an AXEventElementItem. More...
 
gboolean ax_event_element_item_get_next_child (AXEventElementItem *child, AXEventElementItem **sibling, GError **error)
 Retrieve the sibling of a child. More...
 

Detailed Description

The AXEventElementItem and its associated functions. The functions in this module are not thread safe.

ElementItems

Most events require nothing more than a set of keys and primitive type values, but in some cases primitive types are not enough to communicate all the details of an event. Using an AXEventElementItem as a data value enables an application to pass any data, that can be represented by a tree, as a value.

Function Documentation

◆ ax_event_element_item_new()

AXEventElementItem* ax_event_element_item_new ( const gchar *  name,
const gchar *  name_space 
)

Creates a new node in the tree.

Parameters
nameThe name of the node
name_spaceThe name space the name of the node is part of.
Returns
A newly created AXEventElementItem if successful otherwise NULL.

◆ ax_event_element_item_free()

void ax_event_element_item_free ( AXEventElementItem node)

Frees an AXEventElementItem.

Parameters
nodeAn AXEventElementItem node.

◆ ax_event_element_item_get_name()

gboolean ax_event_element_item_get_name ( AXEventElementItem node,
gchar **  name,
GError **  error 
)

Get the name of an AXEventElementItem.

Parameters
nodeAn AXEventElementItem.
nameThe return location of the name. It's the responsibility of the caller to free the memory returned in this pointer.
errorThe return location for an error or NULL.
Returns
TRUE if the name was successfully retrieved, otherwise FALSE. If FALSE and error is not NULL, then error contains a detailed description of the error.

◆ ax_event_element_item_get_name_space()

gboolean ax_event_element_item_get_name_space ( AXEventElementItem node,
gchar **  name_space,
GError **  error 
)

Get the name space of the name of an AXEventElementItem.

Parameters
nodeAn AXEventElementItem.
name_spaceThe return location of the name space. It's the responsibility of the caller to free the memory returned through this pointer.
errorThe return location for an error or NULL.
Returns
TRUE if the name space is successfully retrieved, otherwise FALSE. If FALSE and error is not NULL, then error contains a detailed description of the error.

◆ ax_event_element_item_set_attributes()

gboolean ax_event_element_item_set_attributes ( AXEventElementItem node,
GHashTable *  attributes,
GError **  error 
)

Adds attributes to an AXEventElementItem. If called more than once on the same AXEventElementItem, only the attributes provided in the last call are used. The attributes can be removed by providing NULL as attributes.

Parameters
nodeAn AXEventElementItem.
attributesA GHashTable in which the keys and values are strings representing the names and values of the attributes. If NULL is provided, any previously set attributes are removed.
errorThe return location for an error or NULL.
Returns
TRUE if the attributes were successfully set, otherwise FALSE. If FALSE and error is not NULL, then error contains a detalied description of the error.

◆ ax_event_element_item_get_attributes()

gboolean ax_event_element_item_get_attributes ( AXEventElementItem node,
GHashTable **  attributes,
GError **  error 
)

Get the attributes of an AXEventElementItem.

Parameters
nodeAn AXEventElementItem.
attributesThe return location for the attributes. It's the responsibility of the caller to free the GHashTable by calling g_hash_table_destroy().
errorThe return location for an error or NULL.
Returns
TRUE if the attributes were successfully retrieved, otherwise FALSE. If FALSE and error is not NULL, then error contains a detailed description of the error.

◆ ax_event_element_item_set_body()

gboolean ax_event_element_item_set_body ( AXEventElementItem node,
const gchar *  body,
GError **  error 
)

Set the body of an AXEventElementItem.

Parameters
nodeAn AXEventElementItem.
bodyThe body or NULL to remove any previously set body.
errorThe return location for an error or NULL.
Returns
TRUE if the body was successfully set, otherwise FALSE. If FALSE and error is not NULL, then error contains a detailed description of of the error.

◆ ax_event_element_item_get_body()

gboolean ax_event_element_item_get_body ( AXEventElementItem node,
gchar **  body,
GError **  error 
)

Get the body of an AXEventElementItem.

Parameters
nodeAn AXEventElementItem.
bodyThe return location for the body. It's the responsibilty of the caller to free the memory returned through this pointer.
errorThe return location for an error or NULL.
Returns
TRUE if the body was successfully retrieved, otherwise FALSE. If FALSE and error is not NULL, then error contains a detailed description of the error.

◆ ax_event_element_item_add_child()

gboolean ax_event_element_item_add_child ( AXEventElementItem node,
AXEventElementItem child,
GError **  error 
)

Add an child to an AXEventElementItem.

Parameters
nodeThe parent AXEventElementItem.
childThe child of the parent.
errorThe return location for an error or NULL.
Returns
TRUE if the child as successfully added, otherwise FALSE. If FALSE and error is not NULL, then error contains a detailed description of the error.

◆ ax_event_element_item_get_first_child()

gboolean ax_event_element_item_get_first_child ( AXEventElementItem parent,
AXEventElementItem **  child,
GError **  error 
)

Retrieve the first child of an AXEventElementItem.

Parameters
parentAn AXEventElementItem.
childThe return location for the child AXEventElementItem. It's the responsibility of the caller to free the memory returned through this pointer.
errorThe return location for an error or NULL.
Returns
TRUE if successfull, otherwise FALSE. If FALSE and error is not NULL, then error contains a detailed description of the error.

◆ ax_event_element_item_get_next_child()

gboolean ax_event_element_item_get_next_child ( AXEventElementItem child,
AXEventElementItem **  sibling,
GError **  error 
)

Retrieve the sibling of a child.

Parameters
childAn AXEventElementItem.
siblingThe return location for the next sibling. If the last sibling has been reached, NULL is returned.
errorThe return location for an error or NULL.
Returns
TRUE if successfull, otherwise FALSE. If FALSE and error is not NULL, then error contains a detailed description of the error.