GalagoValue

## GalagoValue GalagoValue — Generic data type container. |

## Synopsis

                GalagoValue;
    enum        GalagoType;
    GalagoValue* galago_value_new               (GalagoType type,
                                                 const void *data,
                                                 void *detail);
    GalagoValue* galago_value_new_object        (GType type,
                                                 const GObject *obj);
    GalagoValue* galago_value_new_list          (GalagoType type,
                                                 GList *list,
                                                 void *detail);
    GalagoValue* galago_value_new_array         (GalagoType type,
                                                 const void *array,
                                                 gsize size,
                                                 void *detail);
    void        galago_value_destroy            (GalagoValue *value);
    GalagoType  galago_value_get_type           (const GalagoValue *value);
    GalagoType  galago_value_get_subtype        (const GalagoValue *value);
    GType       galago_value_get_gtype          (const GalagoValue *value);
    void        galago_value_set_char           (GalagoValue *value,
                                                 char data);
    void        galago_value_set_uchar          (GalagoValue *value,
                                                 unsigned char data);
    void        galago_value_set_boolean        (GalagoValue *value,
                                                 gboolean data);
    void        galago_value_set_short          (GalagoValue *value,
                                                 short data);
    void        galago_value_set_ushort         (GalagoValue *value,
                                                 unsigned short data);
    void        galago_value_set_int            (GalagoValue *value,
                                                 int data);
    void        galago_value_set_uint           (GalagoValue *value,
                                                 unsigned int data);
    void        galago_value_set_long           (GalagoValue *value,
                                                 long data);
    void        galago_value_set_ulong          (GalagoValue *value,
                                                 unsigned long data);
    void        galago_value_set_string         (GalagoValue *value,
                                                 const char *data);
    void        galago_value_set_object         (GalagoValue *value,
                                                 void *data);
    void        galago_value_set_pointer        (GalagoValue *value,
                                                 void *data);
    void        galago_value_set_list           (GalagoValue *value,
                                                 GList *data);
    void        galago_value_set_array          (GalagoValue *value,
                                                 const void *data,
                                                 gsize size);
    char        galago_value_get_char           (const GalagoValue *value);
    unsigned char galago_value_get_uchar        (const GalagoValue *value);
    gboolean    galago_value_get_boolean        (const GalagoValue *value);
    short       galago_value_get_short          (const GalagoValue *value);
    unsigned short galago_value_get_ushort      (const GalagoValue *value);
    int         galago_value_get_int            (const GalagoValue *value);
    unsigned int galago_value_get_uint          (const GalagoValue *value);
    long        galago_value_get_long           (const GalagoValue *value);
    unsigned long galago_value_get_ulong        (const GalagoValue *value);
    const char* galago_value_get_string         (const GalagoValue *value);
    void*       galago_value_get_object         (const GalagoValue *value);
    void*       galago_value_get_pointer        (const GalagoValue *value);
    GList*      galago_value_get_list           (const GalagoValue *value);
    void        galago_value_get_array          (const GalagoValue *value,
                                                 const void **ret_array,
                                                 gsize *ret_size);

## Description

This is a generic data type container, similar in ways to GValue. It was originally written before libgalago was glib-based. It will go away in time, to be replaced with GValue. Currently, this is used only in the D-BUS utility functions.

## Details

### GalagoValue

    typedef struct _GalagoValue GalagoValue;

### enum GalagoType

    typedef enum
    {
    	GALAGO_VALUE_TYPE_UNKNOWN = 0,  /* Unknown type.            */
    	GALAGO_VALUE_TYPE_CHAR,         /* Character.               */
    	GALAGO_VALUE_TYPE_UCHAR,        /* Unsigned character.      */
    	GALAGO_VALUE_TYPE_BOOLEAN,      /* Boolean.                 */
    	GALAGO_VALUE_TYPE_SHORT,        /* Short integer.           */
    	GALAGO_VALUE_TYPE_USHORT,       /* Unsigned short integer.  */
    	GALAGO_VALUE_TYPE_INT,          /* Integer.                 */
    	GALAGO_VALUE_TYPE_UINT,         /* Unsigned integer.        */
    	GALAGO_VALUE_TYPE_LONG,         /* Long integer.            */
    	GALAGO_VALUE_TYPE_ULONG,        /* Unsigned long integer.   */
    	GALAGO_VALUE_TYPE_STRING,       /* String.                  */
    	GALAGO_VALUE_TYPE_OBJECT,       /* Object pointer.          */
    	GALAGO_VALUE_TYPE_POINTER,      /* Generic pointer.         */
    	GALAGO_VALUE_TYPE_LIST,         /* A list of values.        */
    	GALAGO_VALUE_TYPE_ARRAY         /* An array of values.      */

    } GalagoType;

`GALAGO_VALUE_TYPE_UNKNOWN` | Unknown type.
`GALAGO_VALUE_TYPE_CHAR` | Character.
`GALAGO_VALUE_TYPE_UCHAR` | Unsigned character.
`GALAGO_VALUE_TYPE_BOOLEAN` | Boolean
`GALAGO_VALUE_TYPE_SHORT` | Short integer.
`GALAGO_VALUE_TYPE_USHORT` | Unsigned short integer.
`GALAGO_VALUE_TYPE_INT` | Integer.
`GALAGO_VALUE_TYPE_UINT` | Unsigned integer.
`GALAGO_VALUE_TYPE_LONG` | Long integer.
`GALAGO_VALUE_TYPE_ULONG` | Unsigned long integer.
`GALAGO_VALUE_TYPE_STRING` | String.
`GALAGO_VALUE_TYPE_OBJECT` | Object pointer.
`GALAGO_VALUE_TYPE_POINTER` | Generic pointer.
`GALAGO_VALUE_TYPE_LIST` | A list of values.
`GALAGO_VALUE_TYPE_ARRAY` | An array of values.

### galago_value_new ()

    GalagoValue* galago_value_new               (GalagoType type,
                                                 const void *data,
                                                 void *detail);

Creates a new GalagoValue.

`type` : | The type.
`data` : | The optional data to set.
`detail` : | Extra detail, type-specific. Currently unused.
Returns : | The new value.

### galago_value_new_object ()

    GalagoValue* galago_value_new_object        (GType type,
                                                 const GObject *obj);

Creates a new, special GalagoValue that takes an object type and an optional object.

`type` : | The GType.
`obj` : | The object.
Returns : | The new value.

### galago_value_new_list ()

    GalagoValue* galago_value_new_list          (GalagoType type,
                                                 GList *list,
                                                 void *detail);

Creates a new, special GalagoValue that takes only a list of values of the specified type.

If `type` is `GALAGO_VALUE_TYPE_OBJECT`, `detail` must be the class type.

`type` : | The type of list values.
`list` : | The optional default list of values.
`detail` : | Extra detail, type-specific.
Returns : | The new value.

### galago_value_new_array ()

    GalagoValue* galago_value_new_array         (GalagoType type,
                                                 const void *array,
                                                 gsize size,
                                                 void *detail);

Creates a new, special GalagoValue that takes only an array of values of the specified type.

If `type` is `GALAGO_VALUE_TYPE_OBJECT`, `detail` must be the class type.

`type` : | The type of list values.
`array` : | The optional default array of values.
`size` : | The size of the array.
`detail` : | Extra detail, type-specific.
Returns : | The new value.

### galago_value_destroy ()

    void        galago_value_destroy            (GalagoValue *value);

Destroys a GalagoValue.

`value` : | The GalagoValue.

### galago_value_get_type ()

    GalagoType  galago_value_get_type           (const GalagoValue *value);

Returns a GalagoValue's type.

`value` : | The GalagoValue.
Returns : | The GalagoValue's type.

### galago_value_get_subtype ()

    GalagoType  galago_value_get_subtype        (const GalagoValue *value);

Returns a value's subtype. This is only usable for lists and arrays.

`value` : | The GalagoValue.
Returns : | The value's list type.

### galago_value_get_gtype ()

    GType       galago_value_get_gtype          (const GalagoValue *value);

Returns the contained object's GType, if the GalagoValue's type is `GALAGO_VALUE_TYPE_OBJECT`.

`value` : | The GalagoValue.
Returns : | The object's GType, or `NULL`.

### galago_value_set_char ()

    void        galago_value_set_char           (GalagoValue *value,
                                                 char data);

Sets the value's character data.

`value` : | The GalagoValue.
`data` : | The character data.

### galago_value_set_uchar ()

    void        galago_value_set_uchar          (GalagoValue *value,
                                                 unsigned char data);

Sets the value's unsigned char data.

`value` : | The GalagoValue.
`data` : | The unsigned char data.

### galago_value_set_boolean ()

    void        galago_value_set_boolean        (GalagoValue *value,
                                                 gboolean data);

Sets the value's boolean data.

`value` : | The GalagoValue.
`data` : | The boolean data.

### galago_value_set_short ()

    void        galago_value_set_short          (GalagoValue *value,
                                                 short data);

Sets the value's short integer data.

`value` : | The GalagoValue.
`Param2` : | The short integer data.

### galago_value_set_ushort ()

    void        galago_value_set_ushort         (GalagoValue *value,
                                                 unsigned short data);

Sets the value's unsigned short integer data.

`value` : | The GalagoValue.
`Param2` : | The unsigned short integer data.

### galago_value_set_int ()

    void        galago_value_set_int            (GalagoValue *value,
                                                 int data);

Sets the value's integer data.

`value` : | The GalagoValue.
`data` : | The integer data.

### galago_value_set_uint ()

    void        galago_value_set_uint           (GalagoValue *value,
                                                 unsigned int data);

Sets the value's unsigned integer data.

`value` : | The GalagoValue.
`data` : | The unsigned integer data.

### galago_value_set_long ()

    void        galago_value_set_long           (GalagoValue *value,
                                                 long data);

Sets the value's long integer data.

`value` : | The GalagoValue.
`Param2` : | The long integer data.

### galago_value_set_ulong ()

    void        galago_value_set_ulong          (GalagoValue *value,
                                                 unsigned long data);

Sets the value's unsigned long integer data.

`value` : | The GalagoValue.
`Param2` : | The unsigned long integer data.

### galago_value_set_string ()

    void        galago_value_set_string         (GalagoValue *value,
                                                 const char *data);

Sets the value's string data.

`value` : | The GalagoValue.
`data` : | The string data.

### galago_value_set_object ()

    void        galago_value_set_object         (GalagoValue *value,
                                                 void *data);

Sets the value's object data.

`value` : | The GalagoValue.
`data` : | The object data.

### galago_value_set_pointer ()

    void        galago_value_set_pointer        (GalagoValue *value,
                                                 void *data);

Sets the value's pointer data.

`value` : | The GalagoValue.
`data` : | The pointer data.

### galago_value_set_list ()

    void        galago_value_set_list           (GalagoValue *value,
                                                 GList *data);

Sets the value's list of values.

`value` : | The GalagoValue.
`data` : | The list of values.

### galago_value_set_array ()

    void        galago_value_set_array          (GalagoValue *value,
                                                 const void *data,
                                                 gsize size);

Sets the value's array of values.

`value` : | The GalagoValue.
`data` : | The array of values.
`size` : | The size of the array.

### galago_value_get_char ()

    char        galago_value_get_char           (const GalagoValue *value);

Returns the value's char data.

`value` : | The GalagoValue.
Returns : | The char data.

### galago_value_get_uchar ()

    unsigned char galago_value_get_uchar        (const GalagoValue *value);

Returns the value's unsigned character data.

`value` : | The GalagoValue.
Returns : | The unsigned char data.

### galago_value_get_boolean ()

    gboolean    galago_value_get_boolean        (const GalagoValue *value);

Returns the value's boolean data.

`value` : | The GalagoValue.
Returns : | The boolean data.

### galago_value_get_short ()

    short       galago_value_get_short          (const GalagoValue *value);

Returns the value's short integer data.

`value` : | The GalagoValue.
Returns : | The short integer data.

### galago_value_get_ushort ()

    unsigned short galago_value_get_ushort      (const GalagoValue *value);

Returns the value's unsigned short integer data.

`value` : | The GalagoValue.
Returns : | The unsigned short integer data.

### galago_value_get_int ()

    int         galago_value_get_int            (const GalagoValue *value);

Returns the value's integer data.

`value` : | The GalagoValue.
Returns : | The integer data.

### galago_value_get_uint ()

    unsigned int galago_value_get_uint          (const GalagoValue *value);

Returns the value's unsigned integer data.

`value` : | The GalagoValue.
Returns : | The unsigned integer data.

### galago_value_get_long ()

    long        galago_value_get_long           (const GalagoValue *value);

Returns the value's long integer data.

`value` : | The GalagoValue.
Returns : | The long integer data.

### galago_value_get_ulong ()

    unsigned long galago_value_get_ulong        (const GalagoValue *value);

Returns the value's unsigned long integer data.

`value` : | The GalagoValue.
Returns : | The unsigned long integer data.

### galago_value_get_string ()

    const char* galago_value_get_string         (const GalagoValue *value);

Returns the value's string data.

`value` : | The GalagoValue.
Returns : | The string data.

### galago_value_get_object ()

    void*       galago_value_get_object         (const GalagoValue *value);

Returns the value's object data.

`value` : | The GalagoValue.
Returns : | The object data.

### galago_value_get_pointer ()

    void*       galago_value_get_pointer        (const GalagoValue *value);

Returns the value's pointer data.

`value` : | The GalagoValue.
Returns : | The pointer data.

### galago_value_get_list ()

    GList*      galago_value_get_list           (const GalagoValue *value);

Returns the value's list of values.

`value` : | The GalagoValue.
Returns : | The list of values.

### galago_value_get_array ()

    void        galago_value_get_array          (const GalagoValue *value,
                                                 const void **ret_array,
                                                 gsize *ret_size);

Returns the value's array of values.

`value` : | The GalagoValue.
`ret_array` : | The returned array.
`ret_size` : | The returned size of the array.