mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 15:36:17 +01:00
Migrating docs.
* docs/reference/gobject/tmpl/objects.sgml: * gobject/gobject.c: * gobject/gobject.h: * gobject/gparam.h: Migrating docs. svn path=/trunk/; revision=7080
This commit is contained in:
parent
3f5419f6f1
commit
fedbbf5d74
@ -1,3 +1,11 @@
|
||||
2008-06-21 Stefan Kost <ensonic@users.sf.net>
|
||||
|
||||
* docs/reference/gobject/tmpl/objects.sgml:
|
||||
* gobject/gobject.c:
|
||||
* gobject/gobject.h:
|
||||
* gobject/gparam.h:
|
||||
Migrating docs.
|
||||
|
||||
2008-06-21 Stefan Kost <ensonic@users.sf.net>
|
||||
|
||||
* docs/reference/gobject/tmpl/gtypeplugin.sgml:
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -32,19 +32,101 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* --- type macros --- */
|
||||
/**
|
||||
* G_TYPE_IS_OBJECT:
|
||||
* @type: Type id to check
|
||||
*
|
||||
* Check if the passed in type id is a %G_TYPE_OBJECT or derived from it.
|
||||
*
|
||||
* Returns: %FALSE or %TRUE, indicating whether @type is a %G_TYPE_OBJECT.
|
||||
*/
|
||||
#define G_TYPE_IS_OBJECT(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_OBJECT)
|
||||
/**
|
||||
* G_OBJECT:
|
||||
* @object: Object which is subject to casting.
|
||||
*
|
||||
* Casts a #GObject or derived pointer into a (GObject*) pointer.
|
||||
* Depending on the current debugging level, this function may invoke
|
||||
* certain runtime checks to identify invalid casts.
|
||||
*/
|
||||
#define G_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_OBJECT, GObject))
|
||||
/**
|
||||
* G_OBJECT_CLASS:
|
||||
* @class: a valid #GObjectClass
|
||||
*
|
||||
* Casts a derived #GObjectClass structure into a #GObjectClass structure.
|
||||
*/
|
||||
#define G_OBJECT_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_OBJECT, GObjectClass))
|
||||
/**
|
||||
* G_IS_OBJECT:
|
||||
* @object: Instance to check for being a %G_TYPE_OBJECT.
|
||||
*
|
||||
* Checks whether a valid #GTypeInstance pointer is of type %G_TYPE_OBJECT.
|
||||
*/
|
||||
#define G_IS_OBJECT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_OBJECT))
|
||||
/**
|
||||
* G_IS_OBJECT_CLASS:
|
||||
* @class: a #GObjectClass
|
||||
*
|
||||
* Checks whether @class "is a" valid #GObjectClass structure of type
|
||||
* %G_TYPE_OBJECT or derived.
|
||||
*/
|
||||
#define G_IS_OBJECT_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_OBJECT))
|
||||
/**
|
||||
* G_OBJECT_GET_CLASS:
|
||||
* @object: a #GObject instance.
|
||||
*
|
||||
* Get the class structure associated to a #GObject instance.
|
||||
*
|
||||
* Returns: pointer to object class structure.
|
||||
*/
|
||||
#define G_OBJECT_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), G_TYPE_OBJECT, GObjectClass))
|
||||
/**
|
||||
* G_OBJECT_TYPE:
|
||||
* @object: Object to return the type id for.
|
||||
*
|
||||
* Get the type id of an object.
|
||||
*
|
||||
* Returns: Type id of @object.
|
||||
*/
|
||||
#define G_OBJECT_TYPE(object) (G_TYPE_FROM_INSTANCE (object))
|
||||
/**
|
||||
* G_OBJECT_TYPE_NAME:
|
||||
* @object: Object to return the type name for.
|
||||
*
|
||||
* Get the name of an object's type.
|
||||
*
|
||||
* Returns: Type name of @object. The string is owned by the type system and
|
||||
* should not be freed.
|
||||
*/
|
||||
#define G_OBJECT_TYPE_NAME(object) (g_type_name (G_OBJECT_TYPE (object)))
|
||||
/**
|
||||
* G_OBJECT_CLASS_TYPE:
|
||||
* @class: a valid #GObjectClass
|
||||
*
|
||||
* Get the type id of a class structure.
|
||||
*
|
||||
* Returns: Type id of @class.
|
||||
*/
|
||||
#define G_OBJECT_CLASS_TYPE(class) (G_TYPE_FROM_CLASS (class))
|
||||
/**
|
||||
* G_OBJECT_CLASS_NAME:
|
||||
* @class: a valid #GObjectClass
|
||||
*
|
||||
* Return the name of a class structure's type.
|
||||
*
|
||||
* Returns: Type name of @class. The string is owned by the type system and
|
||||
* should not be freed.
|
||||
*/
|
||||
#define G_OBJECT_CLASS_NAME(class) (g_type_name (G_OBJECT_CLASS_TYPE (class)))
|
||||
#define G_VALUE_HOLDS_OBJECT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_OBJECT))
|
||||
|
||||
/* --- type macros --- */
|
||||
/**
|
||||
* G_TYPE_INITIALLY_UNOWNED:
|
||||
*
|
||||
* The type for #GInitiallyUnowned.
|
||||
*/
|
||||
#define G_TYPE_INITIALLY_UNOWNED (g_initially_unowned_get_type())
|
||||
#define G_INITIALLY_UNOWNED(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_INITIALLY_UNOWNED, GInitiallyUnowned))
|
||||
#define G_INITIALLY_UNOWNED_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_INITIALLY_UNOWNED, GInitiallyUnownedClass))
|
||||
@ -60,17 +142,59 @@ typedef struct _GObjectClass GObjectClass;
|
||||
typedef struct _GObject GInitiallyUnowned;
|
||||
typedef struct _GObjectClass GInitiallyUnownedClass;
|
||||
typedef struct _GObjectConstructParam GObjectConstructParam;
|
||||
/**
|
||||
* GObjectGetPropertyFunc:
|
||||
* @object: a #GObject
|
||||
* @property_id: the numeric id under which the property was registered with
|
||||
* g_object_class_install_property().
|
||||
* @value: a #GValue to return the property value in
|
||||
* @pspec: the #GParamSpec describing the property
|
||||
*
|
||||
* The type of the @get_property function of #GObjectClass.
|
||||
*/
|
||||
typedef void (*GObjectGetPropertyFunc) (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
/**
|
||||
* GObjectSetPropertyFunc:
|
||||
* @object: a #GObject
|
||||
* @property_id: the numeric id under which the property was registered with
|
||||
* g_object_class_install_property().
|
||||
* @value: the new value for the property
|
||||
* @pspec: the #GParamSpec describing the property
|
||||
*
|
||||
* The type of the @set_property function of #GObjectClass.
|
||||
*/
|
||||
typedef void (*GObjectSetPropertyFunc) (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
/**
|
||||
* GObjectFinalizeFunc:
|
||||
* @object: the #GObject being finalized
|
||||
*
|
||||
* The type of the @finalize function of #GObjectClass.
|
||||
*/
|
||||
typedef void (*GObjectFinalizeFunc) (GObject *object);
|
||||
/**
|
||||
* GWeakNotify:
|
||||
* @data: data that was provided when the weak reference was established
|
||||
* @where_the_object_was: the object being finalized
|
||||
*
|
||||
* A #GWeakNotify function can be added to an object as a callback that gets
|
||||
* triggered when the object is finalized. Since the object is already being
|
||||
* finalized when the #GWeakNotify is called, there's not much you could do
|
||||
* with the object, apart from e.g. using its adress as hash-index or the like.
|
||||
*/
|
||||
typedef void (*GWeakNotify) (gpointer data,
|
||||
GObject *where_the_object_was);
|
||||
/**
|
||||
* GObject:
|
||||
*
|
||||
* All the fields in the <structname>GObject</structname> structure are private
|
||||
* to the #GObject implementation and should never be accessed directly.
|
||||
*/
|
||||
struct _GObject
|
||||
{
|
||||
GTypeInstance g_type_instance;
|
||||
@ -79,6 +203,68 @@ struct _GObject
|
||||
volatile guint ref_count;
|
||||
GData *qdata;
|
||||
};
|
||||
/**
|
||||
* GObjectClass:
|
||||
* @g_type_class: the parent class
|
||||
* @constructor: the @constructor function is called by g_object_new () to
|
||||
* complete the object initialization after all the construction properties are
|
||||
* set. The first thing a @constructor implementation must do is chain up to the
|
||||
* @constructor of the parent class. Overriding @constructor should be rarely
|
||||
* needed, e.g. to handle construct properties, or to implement singletons.
|
||||
* @set_property: the generic setter for all properties of this type. Should be
|
||||
* overridden for every type with properties. Implementations of @set_property
|
||||
* don't need to emit property change notification explicitly, this is handled
|
||||
* by the type system.
|
||||
* @get_property: the generic getter for all properties of this type. Should be
|
||||
* overridden for every type with properties.
|
||||
* @dispose: the @dispose function is supposed to drop all references to other
|
||||
* objects, but keep the instance otherwise intact, so that client method
|
||||
* invocations still work. It may be run multiple times (due to reference
|
||||
* loops). Before returning, @dispose should chain up to the @dispose method
|
||||
* of the parent class.
|
||||
* @finalize: instance finalization function, should finish the finalization of
|
||||
* the instance begun in @dispose and chain up to the @finalize method of the
|
||||
* parent class.
|
||||
* @dispatch_properties_changed: emits property change notification for a bunch
|
||||
* of properties. Overriding @dispatch_properties_changed should be rarely
|
||||
* needed.
|
||||
* @notify: the class closure for the notify signal
|
||||
* @constructed: the @constructed function is called by g_object_new() as the
|
||||
* final step of the object creation process. At the point of the call, all
|
||||
* construction properties have been set on the object. The purpose of this
|
||||
* call is to allow for object initialisation steps that can only be performed
|
||||
* after construction properties have been set. @constructed implementors
|
||||
* should chain up to the @constructed call of their parent class to allow it
|
||||
* to complete its initialisation.
|
||||
*
|
||||
* The class structure for the <structname>GObject</structname> type.
|
||||
*
|
||||
* <example>
|
||||
* <title>Implementing singletons using a constructor</title>
|
||||
* <programlisting>
|
||||
* static MySingleton *the_singleton = NULL;
|
||||
*
|
||||
* static GObject*
|
||||
* my_singleton_constructor (GType type,
|
||||
* guint n_construct_params,
|
||||
* GObjectConstructParam *construct_params)
|
||||
* {
|
||||
* GObject *object;
|
||||
*
|
||||
* if (!the_singleton)
|
||||
* {
|
||||
* object = G_OBJECT_CLASS (parent_class)->constructor (type,
|
||||
* n_construct_params,
|
||||
* construct_params);
|
||||
* the_singleton = MY_SINGLETON (object);
|
||||
* }
|
||||
* else
|
||||
* object = g_object_ref (G_OBJECT (the_singleton));
|
||||
*
|
||||
* return object;
|
||||
* }
|
||||
* </programlisting></example>
|
||||
*/
|
||||
struct _GObjectClass
|
||||
{
|
||||
GTypeClass g_type_class;
|
||||
@ -117,12 +303,34 @@ struct _GObjectClass
|
||||
/* padding */
|
||||
gpointer pdummy[7];
|
||||
};
|
||||
/**
|
||||
* GObjectConstructParam:
|
||||
* @pspec: the #GParamSpec of the construct parameter
|
||||
* @value: the value to set the parameter to
|
||||
*
|
||||
* The <structname>GObjectConstructParam</structname> struct is an auxiliary
|
||||
* structure used to hand #GParamSpec/#GValue pairs to the @constructor of
|
||||
* a #GObjectClass.
|
||||
*/
|
||||
struct _GObjectConstructParam
|
||||
{
|
||||
GParamSpec *pspec;
|
||||
GValue *value;
|
||||
};
|
||||
|
||||
/**
|
||||
* GInitiallyUnowned:
|
||||
*
|
||||
* All the fields in the <structname>GInitiallyUnowned</structname> structure
|
||||
* are private to the #GInitiallyUnowned implementation and should never be
|
||||
* accessed directly.
|
||||
*/
|
||||
/**
|
||||
* GInitiallyUnownedClass:
|
||||
*
|
||||
* The class structure for the <structname>GInitiallyUnowned</structname> type.
|
||||
*/
|
||||
|
||||
|
||||
/* --- prototypes --- */
|
||||
GType g_initially_unowned_get_type (void);
|
||||
@ -196,6 +404,18 @@ void g_object_add_weak_pointer (GObject *object,
|
||||
void g_object_remove_weak_pointer (GObject *object,
|
||||
gpointer *weak_pointer_location);
|
||||
|
||||
/**
|
||||
* GToggleNotify:
|
||||
* @data: Callback data passed to g_object_add_toggle_ref()
|
||||
* @object: The object on which g_object_add_toggle_ref() was called.
|
||||
* @is_last_ref: %TRUE if the toggle reference is now the
|
||||
* last reference to the object. %FALSE if the toggle
|
||||
* reference was the last reference and there are now other
|
||||
* references.
|
||||
*
|
||||
* A callback function used for notification when the state
|
||||
* of a toggle reference changes. See g_object_add_toggle_ref().
|
||||
*/
|
||||
typedef void (*GToggleNotify) (gpointer data,
|
||||
GObject *object,
|
||||
gboolean is_last_ref);
|
||||
@ -278,6 +498,15 @@ G_STMT_START { \
|
||||
g_type_name (G_PARAM_SPEC_TYPE (_pspec)), \
|
||||
G_OBJECT_TYPE_NAME (_object)); \
|
||||
} G_STMT_END
|
||||
/**
|
||||
* G_OBJECT_WARN_INVALID_PROPERTY_ID:
|
||||
* @object: the #GObject on which set_property() or get_property() was called
|
||||
* @property_id: the numeric id of the property
|
||||
* @pspec: the #GParamSpec of the property
|
||||
*
|
||||
* This macro should be used to emit a standard warning about unexpected
|
||||
* properties in set_property() and get_property() implementations.
|
||||
*/
|
||||
#define G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec) \
|
||||
G_OBJECT_WARN_INVALID_PSPEC ((object), "property", (property_id), (pspec))
|
||||
|
||||
|
@ -242,6 +242,14 @@ struct _GParamSpecClass
|
||||
/*< private >*/
|
||||
gpointer dummy[4];
|
||||
};
|
||||
/**
|
||||
* GParameter:
|
||||
* @name: the parameter name
|
||||
* @value: the parameter value
|
||||
*
|
||||
* The <structname>GParameter</structname> struct is an auxiliary structure used
|
||||
* to hand parameter name/value pairs to g_object_newv().
|
||||
*/
|
||||
struct _GParameter /* auxillary structure for _setv() variants */
|
||||
{
|
||||
const gchar *name;
|
||||
|
Loading…
Reference in New Issue
Block a user