slice-allocated GValues

slice-allocated GValues — GValue utility functions

Functions

Object Hierarchy


Includes

#include <telepathy-glib/telepathy-glib-dbus.h>

Description

These functions are a convenient way to slice-allocate GValues with various contents, as used in dbus-glib.

Functions

tp_g_value_slice_new ()

GValue *
tp_g_value_slice_new (GType type);

Slice-allocate an empty GValue. tp_g_value_slice_new_boolean() and similar functions are likely to be more convenient to use for the types supported.

Parameters

type

The type desired for the new GValue

 

Returns

a newly allocated, newly initialized GValue, to be freed with tp_g_value_slice_free() or g_slice_free().

Since 0.5.14


tp_g_value_slice_new_boolean ()

GValue *
tp_g_value_slice_new_boolean (gboolean b);

Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.

Parameters

b

a boolean value

 

Returns

a GValue of type G_TYPE_BOOLEAN with value b , to be freed with tp_g_value_slice_free() or g_slice_free()

Since 0.7.27


tp_g_value_slice_new_boxed ()

GValue *
tp_g_value_slice_new_boxed (GType type,
                            gconstpointer p);

Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.

Parameters

type

a boxed type

 

p

a pointer of type type , which will be copied

 

Returns

a GValue of type type whose value is a copy of p , to be freed with tp_g_value_slice_free() or g_slice_free()

Since 0.7.27


tp_g_value_slice_new_static_boxed ()

GValue *
tp_g_value_slice_new_static_boxed (GType type,
                                   gconstpointer p);

Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.

Parameters

type

a boxed type

 

p

a pointer of type type , which must remain valid forever

 

Returns

a GValue of type type whose value is p , to be freed with tp_g_value_slice_free() or g_slice_free()

Since 0.7.27


tp_g_value_slice_new_take_boxed ()

GValue *
tp_g_value_slice_new_take_boxed (GType type,
                                 gpointer p);

Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.

Parameters

type

a boxed type

 

p

a pointer of type type which will be freed with g_boxed_free() by the returned GValue (the caller must own it before calling this function, but no longer owns it after this function returns)

 

Returns

a GValue of type type whose value is p , to be freed with tp_g_value_slice_free() or g_slice_free()

Since 0.7.27


tp_g_value_slice_new_double ()

GValue *
tp_g_value_slice_new_double (double d);

Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.

Parameters

d

a number

 

Returns

a GValue of type G_TYPE_DOUBLE with value n , to be freed with tp_g_value_slice_free() or g_slice_free()

Since 0.7.27


tp_g_value_slice_new_int ()

GValue *
tp_g_value_slice_new_int (gint n);

Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.

Parameters

n

an integer

 

Returns

a GValue of type G_TYPE_INT with value n , to be freed with tp_g_value_slice_free() or g_slice_free()

Since 0.7.27


tp_g_value_slice_new_int64 ()

GValue *
tp_g_value_slice_new_int64 (gint64 n);

Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.

Parameters

n

a 64-bit integer

 

Returns

a GValue of type G_TYPE_INT64 with value n , to be freed with tp_g_value_slice_free() or g_slice_free()

Since 0.7.27


tp_g_value_slice_new_string ()

GValue *
tp_g_value_slice_new_string (const gchar *string);

Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.

Parameters

string

a string to be copied into the value

 

Returns

a GValue of type G_TYPE_STRING whose value is a copy of string , to be freed with tp_g_value_slice_free() or g_slice_free()

Since 0.7.27


tp_g_value_slice_new_static_string ()

GValue *
tp_g_value_slice_new_static_string (const gchar *string);

Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.

Parameters

string

a static string which must remain valid forever, to be pointed to by the value

 

Returns

a GValue of type G_TYPE_STRING whose value is string , to be freed with tp_g_value_slice_free() or g_slice_free()

Since 0.7.27


tp_g_value_slice_new_take_string ()

GValue *
tp_g_value_slice_new_take_string (gchar *string);

Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.

Parameters

string

a string which will be freed with g_free() by the returned GValue (the caller must own it before calling this function, but no longer owns it after this function returns)

 

Returns

a GValue of type G_TYPE_STRING whose value is string , to be freed with tp_g_value_slice_free() or g_slice_free()

Since 0.7.27


tp_g_value_slice_new_uint ()

GValue *
tp_g_value_slice_new_uint (guint n);

Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.

Parameters

n

an unsigned integer

 

Returns

a GValue of type G_TYPE_UINT with value n , to be freed with tp_g_value_slice_free() or g_slice_free()

Since 0.7.27


tp_g_value_slice_new_uint64 ()

GValue *
tp_g_value_slice_new_uint64 (guint64 n);

Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.

Parameters

n

a 64-bit unsigned integer

 

Returns

a GValue of type G_TYPE_UINT64 with value n , to be freed with tp_g_value_slice_free() or g_slice_free()

Since 0.7.27


tp_g_value_slice_new_byte ()

GValue *
tp_g_value_slice_new_byte (guchar n);

Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.

Parameters

n

an unsigned integer

 

Returns

a GValue of type G_TYPE_UCHAR with value n , to be freed with tp_g_value_slice_free() or g_slice_free()

Since 0.11.0


tp_g_value_slice_free ()

void
tp_g_value_slice_free (GValue *value);

Unset and free a slice-allocated GValue.

(GDestroyNotify) tp_g_value_slice_free can be used as a destructor for values in a GHashTable, for example.

Parameters

value

A GValue which was allocated with the g_slice API

 

tp_g_value_slice_dup ()

GValue *
tp_g_value_slice_dup (const GValue *value);

Parameters

value

A GValue

 

Returns

a newly allocated copy of value , to be freed with tp_g_value_slice_free() or g_slice_free().

Since 0.5.14


tp_g_value_slice_new_bytes ()

GValue *
tp_g_value_slice_new_bytes (guint length,
                            gconstpointer bytes);

Slice-allocate a GValue containing a byte-array, using tp_g_value_slice_new_boxed(). This function is convenient to use when constructing hash tables from string to GValue, for example.

Parameters

length

number of bytes to copy

 

bytes

location of an array of bytes to be copied (this may be NULL if and only if length is 0)

 

Returns

a GValue of type DBUS_TYPE_G_UCHAR_ARRAY whose value is a copy of length bytes from bytes , to be freed with tp_g_value_slice_free() or g_slice_free()

Since 0.7.27


tp_g_value_slice_new_take_bytes ()

GValue *
tp_g_value_slice_new_take_bytes (GArray *bytes);

Slice-allocate a GValue containing bytes , using tp_g_value_slice_new_boxed(). This function is convenient to use when constructing hash tables from string to GValue, for example.

Parameters

bytes

a non-NULL GArray of guchar, ownership of which will be taken by the GValue

 

Returns

a GValue of type DBUS_TYPE_G_UCHAR_ARRAY whose value is bytes , to be freed with tp_g_value_slice_free() or g_slice_free()

Since 0.7.27


tp_g_value_slice_new_object_path ()

GValue *
tp_g_value_slice_new_object_path (const gchar *path);

Slice-allocate a GValue containing an object path, using tp_g_value_slice_new_boxed(). This function is convenient to use when constructing hash tables from string to GValue, for example.

Parameters

path

a valid D-Bus object path which will be copied

 

Returns

a GValue of type DBUS_TYPE_G_OBJECT_PATH whose value is a copy of path , to be freed with tp_g_value_slice_free() or g_slice_free()

Since 0.7.27


tp_g_value_slice_new_static_object_path ()

GValue *
tp_g_value_slice_new_static_object_path
                               (const gchar *path);

Slice-allocate a GValue containing an object path, using tp_g_value_slice_new_static_boxed(). This function is convenient to use when constructing hash tables from string to GValue, for example.

Parameters

path

a valid D-Bus object path which must remain valid forever

 

Returns

a GValue of type DBUS_TYPE_G_OBJECT_PATH whose value is path , to be freed with tp_g_value_slice_free() or g_slice_free()

Since 0.7.27


tp_g_value_slice_new_take_object_path ()

GValue *
tp_g_value_slice_new_take_object_path (gchar *path);

Slice-allocate a GValue containing an object path, using tp_g_value_slice_new_take_boxed(). This function is convenient to use when constructing hash tables from string to GValue, for example.

Parameters

path

a valid D-Bus object path which will be freed with g_free() by the returned GValue (the caller must own it before calling this function, but no longer owns it after this function returns)

 

Returns

a GValue of type DBUS_TYPE_G_OBJECT_PATH whose value is path , to be freed with tp_g_value_slice_free() or g_slice_free()

Since 0.7.27

Types and Values