removed old code, g_object_get is the prefered method to get object properties

Original commit message from CVS:
removed old code, g_object_get is the prefered method to get object
properties
This commit is contained in:
Wim Taymans 2003-02-08 02:26:15 +00:00
parent 4315091bcb
commit f85c54a3b8
2 changed files with 0 additions and 209 deletions

View file

@ -30,176 +30,6 @@
#include "gstextratypes.h"
#define ZERO(mem) memset(&mem, 0, sizeof(mem))
/**
* gst_util_get_int_arg:
* @object: the object to query
* @argname: the name of the argument
*
* Retrieves a property of an object as an integer.
*
* Returns: the property of the object
*/
gint
gst_util_get_int_arg (GObject * object, const gchar * argname)
{
GValue value;
ZERO (value);
g_value_init (&value, G_TYPE_INT);
g_object_get_property (G_OBJECT (object), argname, &value);
return g_value_get_int (&value);
}
/**
* gst_util_get_bool_arg:
* @object: the object to query
* @argname: the name of the argument
*
* Retrieves a property of an object as a boolean.
*
* Returns: the property of the object
*/
gint
gst_util_get_bool_arg (GObject * object, const gchar * argname)
{
GValue value;
ZERO (value);
g_value_init (&value, G_TYPE_BOOLEAN);
g_object_get_property (G_OBJECT (object), argname, &value);
return g_value_get_boolean (&value);
}
/**
* gst_util_get_long_arg:
* @object: the object to query
* @argname: the name of the argument
*
* Retrieves a property of an object as a long.
*
* Returns: the property of the object
*/
glong
gst_util_get_long_arg (GObject * object, const gchar * argname)
{
GValue value;
ZERO (value);
g_value_init (&value, G_TYPE_LONG);
g_object_get_property (G_OBJECT (object), argname, &value);
return g_value_get_long (&value);
}
/**
* gst_util_get_int64_arg:
* @object: the object to query
* @argname: the name of the argument
*
* Retrieves a property of an object as an int64.
*
* Returns: the property of the object
*/
gint64
gst_util_get_int64_arg (GObject *object, const gchar *argname)
{
GValue value;
ZERO (value);
g_value_init (&value, G_TYPE_INT64);
g_object_get_property (G_OBJECT (object), argname, &value);
return g_value_get_int64 (&value);
}
/**
* gst_util_get_float_arg:
* @object: the object to query
* @argname: the name of the argument
*
* Retrieves a property of an object as a float.
*
* Returns: the property of the object
*/
gfloat
gst_util_get_float_arg (GObject * object, const gchar * argname)
{
GValue value;
ZERO (value);
g_value_init (&value, G_TYPE_FLOAT);
g_object_get_property (G_OBJECT (object), argname, &value);
return g_value_get_float (&value);
}
/**
* gst_util_get_double_arg:
* @object: the object to query
* @argname: the name of the argument
*
* Retrieves a property of an object as a double.
*
* Returns: the property of the object
*/
gdouble
gst_util_get_double_arg (GObject * object, const gchar * argname)
{
GValue value;
ZERO (value);
g_value_init (&value, G_TYPE_DOUBLE);
g_object_get_property (G_OBJECT (object), argname, &value);
return g_value_get_double (&value);
}
/**
* gst_util_get_string_arg:
* @object: the object to query
* @argname: the name of the argument
*
* Retrieves a property of an object as a string.
*
* Returns: the property of the object
*/
const gchar *
gst_util_get_string_arg (GObject * object, const gchar * argname)
{
GValue value;
ZERO (value);
g_value_init (&value, G_TYPE_STRING);
g_object_get_property (G_OBJECT (object), argname, &value);
return g_value_get_string (&value); /* memleak? */
}
/**
* gst_util_get_pointer_arg:
* @object: the object to query
* @argname: the name of the argument
*
* Retrieves a property of an object as a pointer.
*
* Returns: the property of the object
*/
gpointer
gst_util_get_pointer_arg (GObject * object, const gchar * argname)
{
GValue value;
ZERO (value);
g_value_init (&value, G_TYPE_POINTER);
g_object_get_property (G_OBJECT (object), argname, &value);
return g_value_get_pointer (&value);
}
/**
* gst_util_dump_mem:
* @mem: a pointer to the memory to dump
@ -640,31 +470,3 @@ gst_print_element_args (GString * buf, gint indent, GstElement * element)
g_free (specs);
}
/**
* gst_util_has_arg:
* @object: an object
* @argname: a property it might have
* @arg_type: the type of the argument it should have
*
* Determines whether this @object has a property of name
* @argname and of type @arg_type
*
* Return value: TRUE if it has the prop, else FALSE
**/
gboolean
gst_util_has_arg (GObject *object, const gchar *argname, GType arg_type)
{
GParamSpec *pspec;
pspec = g_object_class_find_property (
G_OBJECT_GET_CLASS (object), argname);
if (!pspec)
return FALSE;
if (pspec->value_type != arg_type)
return FALSE;
return TRUE;
}

View file

@ -29,22 +29,11 @@
G_BEGIN_DECLS
gboolean gst_util_has_arg (GObject *object, const gchar *argname,
GType arg_type);
gint gst_util_get_int_arg (GObject *object, const gchar *argname);
gboolean gst_util_get_bool_arg (GObject *object, const gchar *argname);
glong gst_util_get_long_arg (GObject *object, const gchar *argname);
gint64 gst_util_get_int64_arg (GObject *object, const gchar *argname);
gfloat gst_util_get_float_arg (GObject *object, const gchar *argname);
gdouble gst_util_get_double_arg (GObject *object, const gchar *argname);
const gchar* gst_util_get_string_arg (GObject *object, const gchar *argname);
gpointer gst_util_get_pointer_arg (GObject *object, const gchar *argname);
void gst_util_set_value_from_string (GValue *value, const gchar *value_str);
void gst_util_set_object_arg (GObject *object, const gchar *name, const gchar *value);
void gst_util_dump_mem (guchar *mem, guint size);
void gst_print_pad_caps (GString *buf, gint indent, GstPad *pad);
void gst_print_element_args (GString *buf, gint indent, GstElement *element);