?????????? ????????? - ??????????????? - /home/agenciai/public_html/cd38d8/glib-2.0.zip
???????
PK w�[`[�� include/glibconfig.hnu �[��� /* glibconfig.h * * This is a generated file. Please modify 'glibconfig.h.in' */ #ifndef __GLIBCONFIG_H__ #define __GLIBCONFIG_H__ #include <glib/gmacros.h> #include <limits.h> #include <float.h> #define GLIB_HAVE_ALLOCA_H /* Specifies that GLib's g_print*() functions wrap the * system printf functions. This is useful to know, for example, * when using glibc's register_printf_function(). */ #define GLIB_USING_SYSTEM_PRINTF /* #undef GLIB_STATIC_COMPILATION */ /* #undef GOBJECT_STATIC_COMPILATION */ G_BEGIN_DECLS #define G_MINFLOAT FLT_MIN #define G_MAXFLOAT FLT_MAX #define G_MINDOUBLE DBL_MIN #define G_MAXDOUBLE DBL_MAX #define G_MINSHORT SHRT_MIN #define G_MAXSHORT SHRT_MAX #define G_MAXUSHORT USHRT_MAX #define G_MININT INT_MIN #define G_MAXINT INT_MAX #define G_MAXUINT UINT_MAX #define G_MINLONG LONG_MIN #define G_MAXLONG LONG_MAX #define G_MAXULONG ULONG_MAX typedef signed char gint8; typedef unsigned char guint8; typedef signed short gint16; typedef unsigned short guint16; #define G_GINT16_MODIFIER "h" #define G_GINT16_FORMAT "hi" #define G_GUINT16_FORMAT "hu" typedef signed int gint32; typedef unsigned int guint32; #define G_GINT32_MODIFIER "" #define G_GINT32_FORMAT "i" #define G_GUINT32_FORMAT "u" #define G_HAVE_GINT64 1 /* deprecated, always true */ typedef signed long gint64; typedef unsigned long guint64; #define G_GINT64_CONSTANT(val) (val##L) #define G_GUINT64_CONSTANT(val) (val##UL) #define G_GINT64_MODIFIER "l" #define G_GINT64_FORMAT "li" #define G_GUINT64_FORMAT "lu" #define GLIB_SIZEOF_VOID_P 8 #define GLIB_SIZEOF_LONG 8 #define GLIB_SIZEOF_SIZE_T 8 #define GLIB_SIZEOF_SSIZE_T 8 typedef signed long gssize; typedef unsigned long gsize; #define G_GSIZE_MODIFIER "l" #define G_GSSIZE_MODIFIER "l" #define G_GSIZE_FORMAT "lu" #define G_GSSIZE_FORMAT "li" #define G_MAXSIZE G_MAXULONG #define G_MINSSIZE G_MINLONG #define G_MAXSSIZE G_MAXLONG typedef gint64 goffset; #define G_MINOFFSET G_MININT64 #define G_MAXOFFSET G_MAXINT64 #define G_GOFFSET_MODIFIER G_GINT64_MODIFIER #define G_GOFFSET_FORMAT G_GINT64_FORMAT #define G_GOFFSET_CONSTANT(val) G_GINT64_CONSTANT(val) #define G_POLLFD_FORMAT "%d" #define GPOINTER_TO_INT(p) ((gint) (glong) (p)) #define GPOINTER_TO_UINT(p) ((guint) (gulong) (p)) #define GINT_TO_POINTER(i) ((gpointer) (glong) (i)) #define GUINT_TO_POINTER(u) ((gpointer) (gulong) (u)) typedef signed long gintptr; typedef unsigned long guintptr; #define G_GINTPTR_MODIFIER "l" #define G_GINTPTR_FORMAT "li" #define G_GUINTPTR_FORMAT "lu" #define GLIB_MAJOR_VERSION 2 #define GLIB_MINOR_VERSION 68 #define GLIB_MICRO_VERSION 4 #define G_OS_UNIX #define G_VA_COPY va_copy #define G_VA_COPY_AS_ARRAY 1 #ifndef __cplusplus # define G_HAVE_ISO_VARARGS 1 #endif #ifdef __cplusplus # define G_HAVE_ISO_VARARGS 1 #endif /* gcc-2.95.x supports both gnu style and ISO varargs, but if -ansi * is passed ISO vararg support is turned off, and there is no work * around to turn it on, so we unconditionally turn it off. */ #if __GNUC__ == 2 && __GNUC_MINOR__ == 95 # undef G_HAVE_ISO_VARARGS #endif #define G_HAVE_GROWING_STACK 0 #define G_HAVE_GNUC_VISIBILITY 1 #ifndef _MSC_VER # define G_HAVE_GNUC_VARARGS 1 #endif #if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590) #define G_GNUC_INTERNAL __attribute__((visibility("hidden"))) #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) #define G_GNUC_INTERNAL __hidden #elif defined (__GNUC__) && defined (G_HAVE_GNUC_VISIBILITY) #define G_GNUC_INTERNAL __attribute__((visibility("hidden"))) #else #define G_GNUC_INTERNAL #endif #define G_THREADS_ENABLED #define G_THREADS_IMPL_POSIX #define G_ATOMIC_LOCK_FREE #define GINT16_TO_LE(val) ((gint16) (val)) #define GUINT16_TO_LE(val) ((guint16) (val)) #define GINT16_TO_BE(val) ((gint16) GUINT16_SWAP_LE_BE (val)) #define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val)) #define GINT32_TO_LE(val) ((gint32) (val)) #define GUINT32_TO_LE(val) ((guint32) (val)) #define GINT32_TO_BE(val) ((gint32) GUINT32_SWAP_LE_BE (val)) #define GUINT32_TO_BE(val) (GUINT32_SWAP_LE_BE (val)) #define GINT64_TO_LE(val) ((gint64) (val)) #define GUINT64_TO_LE(val) ((guint64) (val)) #define GINT64_TO_BE(val) ((gint64) GUINT64_SWAP_LE_BE (val)) #define GUINT64_TO_BE(val) (GUINT64_SWAP_LE_BE (val)) #define GLONG_TO_LE(val) ((glong) GINT64_TO_LE (val)) #define GULONG_TO_LE(val) ((gulong) GUINT64_TO_LE (val)) #define GLONG_TO_BE(val) ((glong) GINT64_TO_BE (val)) #define GULONG_TO_BE(val) ((gulong) GUINT64_TO_BE (val)) #define GINT_TO_LE(val) ((gint) GINT32_TO_LE (val)) #define GUINT_TO_LE(val) ((guint) GUINT32_TO_LE (val)) #define GINT_TO_BE(val) ((gint) GINT32_TO_BE (val)) #define GUINT_TO_BE(val) ((guint) GUINT32_TO_BE (val)) #define GSIZE_TO_LE(val) ((gsize) GUINT64_TO_LE (val)) #define GSSIZE_TO_LE(val) ((gssize) GINT64_TO_LE (val)) #define GSIZE_TO_BE(val) ((gsize) GUINT64_TO_BE (val)) #define GSSIZE_TO_BE(val) ((gssize) GINT64_TO_BE (val)) #define G_BYTE_ORDER G_LITTLE_ENDIAN #define GLIB_SYSDEF_POLLIN =1 #define GLIB_SYSDEF_POLLOUT =4 #define GLIB_SYSDEF_POLLPRI =2 #define GLIB_SYSDEF_POLLHUP =16 #define GLIB_SYSDEF_POLLERR =8 #define GLIB_SYSDEF_POLLNVAL =32 #define G_MODULE_SUFFIX "so" typedef int GPid; #define G_PID_FORMAT "i" #define GLIB_SYSDEF_AF_UNIX 1 #define GLIB_SYSDEF_AF_INET 2 #define GLIB_SYSDEF_AF_INET6 10 #define GLIB_SYSDEF_MSG_OOB 1 #define GLIB_SYSDEF_MSG_PEEK 2 #define GLIB_SYSDEF_MSG_DONTROUTE 4 #define G_DIR_SEPARATOR '/' #define G_DIR_SEPARATOR_S "/" #define G_SEARCHPATH_SEPARATOR ':' #define G_SEARCHPATH_SEPARATOR_S ":" G_END_DECLS #endif /* __GLIBCONFIG_H__ */ PK rZ�[|Mp+� � gmodule.hnu �[��� /* GMODULE - GLIB wrapper code for dynamic module loading * Copyright (C) 1998 Tim Janik * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* * Modified by the GLib Team and others 1997-2000. See the AUTHORS * file for a list of people on the GLib Team. See the ChangeLog * files for a list of changes. These files are distributed with * GLib at ftp://ftp.gtk.org/pub/gtk/. */ #ifndef __GMODULE_H__ #define __GMODULE_H__ #include <glib.h> G_BEGIN_DECLS /* exporting and importing functions, this is special cased * to feature Windows dll stubs. */ #define G_MODULE_IMPORT extern #ifdef G_PLATFORM_WIN32 # define G_MODULE_EXPORT __declspec(dllexport) #elif __GNUC__ >= 4 # define G_MODULE_EXPORT __attribute__((visibility("default"))) #else /* !G_PLATFORM_WIN32 && __GNUC__ < 4 */ # define G_MODULE_EXPORT #endif /* !G_PLATFORM_WIN32 */ /** * GModuleFlags: * @G_MODULE_BIND_LAZY: specifies that symbols are only resolved when * needed. The default action is to bind all symbols when the module * is loaded. * @G_MODULE_BIND_LOCAL: specifies that symbols in the module should * not be added to the global name space. The default action on most * platforms is to place symbols in the module in the global name space, * which may cause conflicts with existing symbols. * @G_MODULE_BIND_MASK: mask for all flags. * * Flags passed to g_module_open(). * Note that these flags are not supported on all platforms. */ typedef enum { G_MODULE_BIND_LAZY = 1 << 0, G_MODULE_BIND_LOCAL = 1 << 1, G_MODULE_BIND_MASK = 0x03 } GModuleFlags; typedef struct _GModule GModule; typedef const gchar* (*GModuleCheckInit) (GModule *module); typedef void (*GModuleUnload) (GModule *module); /* return TRUE if dynamic module loading is supported */ GLIB_AVAILABLE_IN_ALL gboolean g_module_supported (void) G_GNUC_CONST; /* open a module 'file_name' and return handle, which is NULL on error */ GLIB_AVAILABLE_IN_ALL GModule* g_module_open (const gchar *file_name, GModuleFlags flags); /* close a previously opened module, returns TRUE on success */ GLIB_AVAILABLE_IN_ALL gboolean g_module_close (GModule *module); /* make a module resident so g_module_close on it will be ignored */ GLIB_AVAILABLE_IN_ALL void g_module_make_resident (GModule *module); /* query the last module error as a string */ GLIB_AVAILABLE_IN_ALL const gchar * g_module_error (void); /* retrieve a symbol pointer from 'module', returns TRUE on success */ GLIB_AVAILABLE_IN_ALL gboolean g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol); /* retrieve the file name from an existing module */ GLIB_AVAILABLE_IN_ALL const gchar * g_module_name (GModule *module); /* Build the actual file name containing a module. 'directory' is the * directory where the module file is supposed to be, or NULL or empty * in which case it should either be in the current directory or, on * some operating systems, in some standard place, for instance on the * PATH. Hence, to be absolutely sure to get the correct module, * always pass in a directory. The file name consists of the directory, * if supplied, and 'module_name' suitably decorated according to * the operating system's conventions (for instance lib*.so or *.dll). * * No checks are made that the file exists, or is of correct type. */ GLIB_AVAILABLE_IN_ALL gchar* g_module_build_path (const gchar *directory, const gchar *module_name); G_END_DECLS #endif /* __GMODULE_H__ */ PK rZ�[�. O O glib.hnu �[��� /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* * Modified by the GLib Team and others 1997-2000. See the AUTHORS * file for a list of people on the GLib Team. See the ChangeLog * files for a list of changes. These files are distributed with * GLib at ftp://ftp.gtk.org/pub/gtk/. */ #ifndef __G_LIB_H__ #define __G_LIB_H__ #define __GLIB_H_INSIDE__ #include <glib/galloca.h> #include <glib/garray.h> #include <glib/gasyncqueue.h> #include <glib/gatomic.h> #include <glib/gbacktrace.h> #include <glib/gbase64.h> #include <glib/gbitlock.h> #include <glib/gbookmarkfile.h> #include <glib/gbytes.h> #include <glib/gcharset.h> #include <glib/gchecksum.h> #include <glib/gconvert.h> #include <glib/gdataset.h> #include <glib/gdate.h> #include <glib/gdatetime.h> #include <glib/gdir.h> #include <glib/genviron.h> #include <glib/gerror.h> #include <glib/gfileutils.h> #include <glib/ggettext.h> #include <glib/ghash.h> #include <glib/ghmac.h> #include <glib/ghook.h> #include <glib/ghostutils.h> #include <glib/giochannel.h> #include <glib/gkeyfile.h> #include <glib/glist.h> #include <glib/gmacros.h> #include <glib/gmain.h> #include <glib/gmappedfile.h> #include <glib/gmarkup.h> #include <glib/gmem.h> #include <glib/gmessages.h> #include <glib/gnode.h> #include <glib/goption.h> #include <glib/gpattern.h> #include <glib/gpoll.h> #include <glib/gprimes.h> #include <glib/gqsort.h> #include <glib/gquark.h> #include <glib/gqueue.h> #include <glib/grand.h> #include <glib/grcbox.h> #include <glib/grefcount.h> #include <glib/grefstring.h> #include <glib/gregex.h> #include <glib/gscanner.h> #include <glib/gsequence.h> #include <glib/gshell.h> #include <glib/gslice.h> #include <glib/gslist.h> #include <glib/gspawn.h> #include <glib/gstrfuncs.h> #include <glib/gstringchunk.h> #include <glib/gstring.h> #include <glib/gstrvbuilder.h> #include <glib/gtestutils.h> #include <glib/gthread.h> #include <glib/gthreadpool.h> #include <glib/gtimer.h> #include <glib/gtimezone.h> #include <glib/gtrashstack.h> #include <glib/gtree.h> #include <glib/gtypes.h> #include <glib/gunicode.h> #include <glib/guri.h> #include <glib/gutils.h> #include <glib/guuid.h> #include <glib/gvariant.h> #include <glib/gvarianttype.h> #include <glib/gversion.h> #include <glib/gversionmacros.h> #ifdef G_PLATFORM_WIN32 #include <glib/gwin32.h> #endif #include <glib/deprecated/gallocator.h> #include <glib/deprecated/gcache.h> #include <glib/deprecated/gcompletion.h> #include <glib/deprecated/gmain.h> #include <glib/deprecated/grel.h> #include <glib/deprecated/gthread.h> #include <glib/glib-autocleanups.h> #undef __GLIB_H_INSIDE__ #endif /* __G_LIB_H__ */ PK rZ�[1tg�� � gobject/gsourceclosure.hnu �[��� /* GObject - GLib Type, Object, Parameter and Signal Library * Copyright (C) 2001 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __G_SOURCECLOSURE_H__ #define __G_SOURCECLOSURE_H__ #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) #error "Only <glib-object.h> can be included directly." #endif #include <gobject/gclosure.h> #include <gobject/glib-types.h> G_BEGIN_DECLS GLIB_AVAILABLE_IN_ALL void g_source_set_closure (GSource *source, GClosure *closure); GLIB_AVAILABLE_IN_ALL void g_source_set_dummy_callback (GSource *source); G_END_DECLS #endif /* __G_SOURCECLOSURE_H__ */ PK rZ�[��Z� Z� gobject/gobject.hnu �[��� /* GObject - GLib Type, Object, Parameter and Signal Library * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __G_OBJECT_H__ #define __G_OBJECT_H__ #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) #error "Only <glib-object.h> can be included directly." #endif #include <gobject/gtype.h> #include <gobject/gvalue.h> #include <gobject/gparam.h> #include <gobject/gclosure.h> #include <gobject/gsignal.h> #include <gobject/gboxed.h> #if defined(glib_typeof_2_68) && GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68 /* for glib_typeof */ #include <type_traits> #endif 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. */ #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_42 #define G_IS_OBJECT(object) (G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE ((object), G_TYPE_OBJECT)) #else #define G_IS_OBJECT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_OBJECT)) #endif /** * 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))) /** * G_VALUE_HOLDS_OBJECT: * @value: a valid #GValue structure * * Checks whether the given #GValue can hold values derived from type %G_TYPE_OBJECT. * * Returns: %TRUE on success. */ #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()) /** * G_INITIALLY_UNOWNED: * @object: Object which is subject to casting. * * Casts a #GInitiallyUnowned or derived pointer into a (GInitiallyUnowned*) * pointer. Depending on the current debugging level, this function may invoke * certain runtime checks to identify invalid casts. */ #define G_INITIALLY_UNOWNED(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_INITIALLY_UNOWNED, GInitiallyUnowned)) /** * G_INITIALLY_UNOWNED_CLASS: * @class: a valid #GInitiallyUnownedClass * * Casts a derived #GInitiallyUnownedClass structure into a * #GInitiallyUnownedClass structure. */ #define G_INITIALLY_UNOWNED_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_INITIALLY_UNOWNED, GInitiallyUnownedClass)) /** * G_IS_INITIALLY_UNOWNED: * @object: Instance to check for being a %G_TYPE_INITIALLY_UNOWNED. * * Checks whether a valid #GTypeInstance pointer is of type %G_TYPE_INITIALLY_UNOWNED. */ #define G_IS_INITIALLY_UNOWNED(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_INITIALLY_UNOWNED)) /** * G_IS_INITIALLY_UNOWNED_CLASS: * @class: a #GInitiallyUnownedClass * * Checks whether @class "is a" valid #GInitiallyUnownedClass structure of type * %G_TYPE_INITIALLY_UNOWNED or derived. */ #define G_IS_INITIALLY_UNOWNED_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_INITIALLY_UNOWNED)) /** * G_INITIALLY_UNOWNED_GET_CLASS: * @object: a #GInitiallyUnowned instance. * * Get the class structure associated to a #GInitiallyUnowned instance. * * Returns: pointer to object class structure. */ #define G_INITIALLY_UNOWNED_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), G_TYPE_INITIALLY_UNOWNED, GInitiallyUnownedClass)) /* GInitiallyUnowned ia a GObject with initially floating reference count */ /* --- typedefs & structures --- */ typedef struct _GObject GObject; 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 disposed * * 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 * disposed when the #GWeakNotify is called, there's not much you could do * with the object, apart from e.g. using its address as hash-index or the like. */ typedef void (*GWeakNotify) (gpointer data, GObject *where_the_object_was); /** * GObject: * * All the fields in the GObject structure are private * to the #GObject implementation and should never be accessed directly. */ struct _GObject { GTypeInstance g_type_instance; /*< private >*/ guint ref_count; /* (atomic) */ 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. If implementations of * @set_property don't emit property change notification explicitly, this will * be done implicitly by the type system. However, if the notify signal is * emitted explicitly, the type system will not emit it a second time. * @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 GObject type. * * |[<!-- language="C" --> * // Example of implementing a singleton using a constructor. * 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; * } * ]| */ struct _GObjectClass { GTypeClass g_type_class; /*< private >*/ GSList *construct_properties; /*< public >*/ /* seldom overridden */ GObject* (*constructor) (GType type, guint n_construct_properties, GObjectConstructParam *construct_properties); /* overridable methods */ void (*set_property) (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); void (*get_property) (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); void (*dispose) (GObject *object); void (*finalize) (GObject *object); /* seldom overridden */ void (*dispatch_properties_changed) (GObject *object, guint n_pspecs, GParamSpec **pspecs); /* signals */ void (*notify) (GObject *object, GParamSpec *pspec); /* called when done constructing */ void (*constructed) (GObject *object); /*< private >*/ gsize flags; /* padding */ gpointer pdummy[6]; }; /** * GObjectConstructParam: * @pspec: the #GParamSpec of the construct parameter * @value: the value to set the parameter to * * The GObjectConstructParam 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 GInitiallyUnowned structure * are private to the #GInitiallyUnowned implementation and should never be * accessed directly. */ /** * GInitiallyUnownedClass: * * The class structure for the GInitiallyUnowned type. */ /* --- prototypes --- */ GLIB_AVAILABLE_IN_ALL GType g_initially_unowned_get_type (void); GLIB_AVAILABLE_IN_ALL void g_object_class_install_property (GObjectClass *oclass, guint property_id, GParamSpec *pspec); GLIB_AVAILABLE_IN_ALL GParamSpec* g_object_class_find_property (GObjectClass *oclass, const gchar *property_name); GLIB_AVAILABLE_IN_ALL GParamSpec**g_object_class_list_properties (GObjectClass *oclass, guint *n_properties); GLIB_AVAILABLE_IN_ALL void g_object_class_override_property (GObjectClass *oclass, guint property_id, const gchar *name); GLIB_AVAILABLE_IN_ALL void g_object_class_install_properties (GObjectClass *oclass, guint n_pspecs, GParamSpec **pspecs); GLIB_AVAILABLE_IN_ALL void g_object_interface_install_property (gpointer g_iface, GParamSpec *pspec); GLIB_AVAILABLE_IN_ALL GParamSpec* g_object_interface_find_property (gpointer g_iface, const gchar *property_name); GLIB_AVAILABLE_IN_ALL GParamSpec**g_object_interface_list_properties (gpointer g_iface, guint *n_properties_p); GLIB_AVAILABLE_IN_ALL GType g_object_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL gpointer g_object_new (GType object_type, const gchar *first_property_name, ...); GLIB_AVAILABLE_IN_2_54 GObject* g_object_new_with_properties (GType object_type, guint n_properties, const char *names[], const GValue values[]); G_GNUC_BEGIN_IGNORE_DEPRECATIONS GLIB_DEPRECATED_IN_2_54_FOR(g_object_new_with_properties) gpointer g_object_newv (GType object_type, guint n_parameters, GParameter *parameters); G_GNUC_END_IGNORE_DEPRECATIONS GLIB_AVAILABLE_IN_ALL GObject* g_object_new_valist (GType object_type, const gchar *first_property_name, va_list var_args); GLIB_AVAILABLE_IN_ALL void g_object_set (gpointer object, const gchar *first_property_name, ...) G_GNUC_NULL_TERMINATED; GLIB_AVAILABLE_IN_ALL void g_object_get (gpointer object, const gchar *first_property_name, ...) G_GNUC_NULL_TERMINATED; GLIB_AVAILABLE_IN_ALL gpointer g_object_connect (gpointer object, const gchar *signal_spec, ...) G_GNUC_NULL_TERMINATED; GLIB_AVAILABLE_IN_ALL void g_object_disconnect (gpointer object, const gchar *signal_spec, ...) G_GNUC_NULL_TERMINATED; GLIB_AVAILABLE_IN_2_54 void g_object_setv (GObject *object, guint n_properties, const gchar *names[], const GValue values[]); GLIB_AVAILABLE_IN_ALL void g_object_set_valist (GObject *object, const gchar *first_property_name, va_list var_args); GLIB_AVAILABLE_IN_2_54 void g_object_getv (GObject *object, guint n_properties, const gchar *names[], GValue values[]); GLIB_AVAILABLE_IN_ALL void g_object_get_valist (GObject *object, const gchar *first_property_name, va_list var_args); GLIB_AVAILABLE_IN_ALL void g_object_set_property (GObject *object, const gchar *property_name, const GValue *value); GLIB_AVAILABLE_IN_ALL void g_object_get_property (GObject *object, const gchar *property_name, GValue *value); GLIB_AVAILABLE_IN_ALL void g_object_freeze_notify (GObject *object); GLIB_AVAILABLE_IN_ALL void g_object_notify (GObject *object, const gchar *property_name); GLIB_AVAILABLE_IN_ALL void g_object_notify_by_pspec (GObject *object, GParamSpec *pspec); GLIB_AVAILABLE_IN_ALL void g_object_thaw_notify (GObject *object); GLIB_AVAILABLE_IN_ALL gboolean g_object_is_floating (gpointer object); GLIB_AVAILABLE_IN_ALL gpointer g_object_ref_sink (gpointer object); GLIB_AVAILABLE_IN_ALL gpointer g_object_ref (gpointer object); GLIB_AVAILABLE_IN_ALL void g_object_unref (gpointer object); GLIB_AVAILABLE_IN_ALL void g_object_weak_ref (GObject *object, GWeakNotify notify, gpointer data); GLIB_AVAILABLE_IN_ALL void g_object_weak_unref (GObject *object, GWeakNotify notify, gpointer data); GLIB_AVAILABLE_IN_ALL void g_object_add_weak_pointer (GObject *object, gpointer *weak_pointer_location); GLIB_AVAILABLE_IN_ALL void g_object_remove_weak_pointer (GObject *object, gpointer *weak_pointer_location); #if defined(glib_typeof) && GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_56 && (!defined(glib_typeof_2_68) || GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68) /* Make reference APIs type safe with macros */ #define g_object_ref(Obj) ((glib_typeof (Obj)) (g_object_ref) (Obj)) #define g_object_ref_sink(Obj) ((glib_typeof (Obj)) (g_object_ref_sink) (Obj)) #endif /** * 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); GLIB_AVAILABLE_IN_ALL void g_object_add_toggle_ref (GObject *object, GToggleNotify notify, gpointer data); GLIB_AVAILABLE_IN_ALL void g_object_remove_toggle_ref (GObject *object, GToggleNotify notify, gpointer data); GLIB_AVAILABLE_IN_ALL gpointer g_object_get_qdata (GObject *object, GQuark quark); GLIB_AVAILABLE_IN_ALL void g_object_set_qdata (GObject *object, GQuark quark, gpointer data); GLIB_AVAILABLE_IN_ALL void g_object_set_qdata_full (GObject *object, GQuark quark, gpointer data, GDestroyNotify destroy); GLIB_AVAILABLE_IN_ALL gpointer g_object_steal_qdata (GObject *object, GQuark quark); GLIB_AVAILABLE_IN_2_34 gpointer g_object_dup_qdata (GObject *object, GQuark quark, GDuplicateFunc dup_func, gpointer user_data); GLIB_AVAILABLE_IN_2_34 gboolean g_object_replace_qdata (GObject *object, GQuark quark, gpointer oldval, gpointer newval, GDestroyNotify destroy, GDestroyNotify *old_destroy); GLIB_AVAILABLE_IN_ALL gpointer g_object_get_data (GObject *object, const gchar *key); GLIB_AVAILABLE_IN_ALL void g_object_set_data (GObject *object, const gchar *key, gpointer data); GLIB_AVAILABLE_IN_ALL void g_object_set_data_full (GObject *object, const gchar *key, gpointer data, GDestroyNotify destroy); GLIB_AVAILABLE_IN_ALL gpointer g_object_steal_data (GObject *object, const gchar *key); GLIB_AVAILABLE_IN_2_34 gpointer g_object_dup_data (GObject *object, const gchar *key, GDuplicateFunc dup_func, gpointer user_data); GLIB_AVAILABLE_IN_2_34 gboolean g_object_replace_data (GObject *object, const gchar *key, gpointer oldval, gpointer newval, GDestroyNotify destroy, GDestroyNotify *old_destroy); GLIB_AVAILABLE_IN_ALL void g_object_watch_closure (GObject *object, GClosure *closure); GLIB_AVAILABLE_IN_ALL GClosure* g_cclosure_new_object (GCallback callback_func, GObject *object); GLIB_AVAILABLE_IN_ALL GClosure* g_cclosure_new_object_swap (GCallback callback_func, GObject *object); GLIB_AVAILABLE_IN_ALL GClosure* g_closure_new_object (guint sizeof_closure, GObject *object); GLIB_AVAILABLE_IN_ALL void g_value_set_object (GValue *value, gpointer v_object); GLIB_AVAILABLE_IN_ALL gpointer g_value_get_object (const GValue *value); GLIB_AVAILABLE_IN_ALL gpointer g_value_dup_object (const GValue *value); GLIB_AVAILABLE_IN_ALL gulong g_signal_connect_object (gpointer instance, const gchar *detailed_signal, GCallback c_handler, gpointer gobject, GConnectFlags connect_flags); /*< protected >*/ GLIB_AVAILABLE_IN_ALL void g_object_force_floating (GObject *object); GLIB_AVAILABLE_IN_ALL void g_object_run_dispose (GObject *object); GLIB_AVAILABLE_IN_ALL void g_value_take_object (GValue *value, gpointer v_object); GLIB_DEPRECATED_FOR(g_value_take_object) void g_value_set_object_take_ownership (GValue *value, gpointer v_object); GLIB_DEPRECATED gsize g_object_compat_control (gsize what, gpointer data); /* --- implementation macros --- */ #define G_OBJECT_WARN_INVALID_PSPEC(object, pname, property_id, pspec) \ G_STMT_START { \ GObject *_glib__object = (GObject*) (object); \ GParamSpec *_glib__pspec = (GParamSpec*) (pspec); \ guint _glib__property_id = (property_id); \ g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'", \ __FILE__, __LINE__, \ (pname), \ _glib__property_id, \ _glib__pspec->name, \ g_type_name (G_PARAM_SPEC_TYPE (_glib__pspec)), \ G_OBJECT_TYPE_NAME (_glib__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)) GLIB_AVAILABLE_IN_ALL void g_clear_object (GObject **object_ptr); #define g_clear_object(object_ptr) g_clear_pointer ((object_ptr), g_object_unref) /** * g_set_object: (skip) * @object_ptr: (inout) (not optional) (nullable): a pointer to a #GObject reference * @new_object: (nullable) (transfer none): a pointer to the new #GObject to * assign to @object_ptr, or %NULL to clear the pointer * * Updates a #GObject pointer to refer to @new_object. It increments the * reference count of @new_object (if non-%NULL), decrements the reference * count of the current value of @object_ptr (if non-%NULL), and assigns * @new_object to @object_ptr. The assignment is not atomic. * * @object_ptr must not be %NULL, but can point to a %NULL value. * * A macro is also included that allows this function to be used without * pointer casts. The function itself is static inline, so its address may vary * between compilation units. * * One convenient usage of this function is in implementing property setters: * |[ * void * foo_set_bar (Foo *foo, * Bar *new_bar) * { * g_return_if_fail (IS_FOO (foo)); * g_return_if_fail (new_bar == NULL || IS_BAR (new_bar)); * * if (g_set_object (&foo->bar, new_bar)) * g_object_notify (foo, "bar"); * } * ]| * * Returns: %TRUE if the value of @object_ptr changed, %FALSE otherwise * * Since: 2.44 */ static inline gboolean (g_set_object) (GObject **object_ptr, GObject *new_object) { GObject *old_object = *object_ptr; /* rely on g_object_[un]ref() to check the pointers are actually GObjects; * elide a (object_ptr != NULL) check because most of the time we will be * operating on struct members with a constant offset, so a NULL check would * not catch bugs */ if (old_object == new_object) return FALSE; if (new_object != NULL) g_object_ref (new_object); *object_ptr = new_object; if (old_object != NULL) g_object_unref (old_object); return TRUE; } /* We need GCC for __extension__, which we need to sort out strict aliasing of @object_ptr */ #if defined(__GNUC__) #define g_set_object(object_ptr, new_object) \ (G_GNUC_EXTENSION ({ \ G_STATIC_ASSERT (sizeof *(object_ptr) == sizeof (new_object)); \ /* Only one access, please; work around type aliasing */ \ union { char *in; GObject **out; } _object_ptr; \ _object_ptr.in = (char *) (object_ptr); \ /* Check types match */ \ (void) (0 ? *(object_ptr) = (new_object), FALSE : FALSE); \ (g_set_object) (_object_ptr.out, (GObject *) new_object); \ })) \ GLIB_AVAILABLE_MACRO_IN_2_44 #else /* if !defined(__GNUC__) */ #define g_set_object(object_ptr, new_object) \ (/* Check types match. */ \ 0 ? *(object_ptr) = (new_object), FALSE : \ (g_set_object) ((GObject **) (object_ptr), (GObject *) (new_object)) \ ) #endif /* !defined(__GNUC__) */ /** * g_assert_finalize_object: (skip) * @object: (transfer full) (type GObject.Object): an object * * Assert that @object is non-%NULL, then release one reference to it with * g_object_unref() and assert that it has been finalized (i.e. that there * are no more references). * * If assertions are disabled via `G_DISABLE_ASSERT`, * this macro just calls g_object_unref() without any further checks. * * This macro should only be used in regression tests. * * Since: 2.62 */ static inline void (g_assert_finalize_object) (GObject *object) { gpointer weak_pointer = object; g_assert_true (G_IS_OBJECT (weak_pointer)); g_object_add_weak_pointer (object, &weak_pointer); g_object_unref (weak_pointer); g_assert_null (weak_pointer); } #ifdef G_DISABLE_ASSERT #define g_assert_finalize_object(object) g_object_unref (object) #else #define g_assert_finalize_object(object) (g_assert_finalize_object ((GObject *) object)) #endif /** * g_clear_weak_pointer: (skip) * @weak_pointer_location: The memory address of a pointer * * Clears a weak reference to a #GObject. * * @weak_pointer_location must not be %NULL. * * If the weak reference is %NULL then this function does nothing. * Otherwise, the weak reference to the object is removed for that location * and the pointer is set to %NULL. * * A macro is also included that allows this function to be used without * pointer casts. The function itself is static inline, so its address may vary * between compilation units. * * Since: 2.56 */ static inline void (g_clear_weak_pointer) (gpointer *weak_pointer_location) { GObject *object = (GObject *) *weak_pointer_location; if (object != NULL) { g_object_remove_weak_pointer (object, weak_pointer_location); *weak_pointer_location = NULL; } } #define g_clear_weak_pointer(weak_pointer_location) \ (/* Check types match. */ \ (g_clear_weak_pointer) ((gpointer *) (weak_pointer_location)) \ ) /** * g_set_weak_pointer: (skip) * @weak_pointer_location: the memory address of a pointer * @new_object: (nullable) (transfer none): a pointer to the new #GObject to * assign to it, or %NULL to clear the pointer * * Updates a pointer to weakly refer to @new_object. It assigns @new_object * to @weak_pointer_location and ensures that @weak_pointer_location will * automatically be set to %NULL if @new_object gets destroyed. The assignment * is not atomic. The weak reference is not thread-safe, see * g_object_add_weak_pointer() for details. * * @weak_pointer_location must not be %NULL. * * A macro is also included that allows this function to be used without * pointer casts. The function itself is static inline, so its address may vary * between compilation units. * * One convenient usage of this function is in implementing property setters: * |[ * void * foo_set_bar (Foo *foo, * Bar *new_bar) * { * g_return_if_fail (IS_FOO (foo)); * g_return_if_fail (new_bar == NULL || IS_BAR (new_bar)); * * if (g_set_weak_pointer (&foo->bar, new_bar)) * g_object_notify (foo, "bar"); * } * ]| * * Returns: %TRUE if the value of @weak_pointer_location changed, %FALSE otherwise * * Since: 2.56 */ static inline gboolean (g_set_weak_pointer) (gpointer *weak_pointer_location, GObject *new_object) { GObject *old_object = (GObject *) *weak_pointer_location; /* elide a (weak_pointer_location != NULL) check because most of the time we * will be operating on struct members with a constant offset, so a NULL * check would not catch bugs */ if (old_object == new_object) return FALSE; if (old_object != NULL) g_object_remove_weak_pointer (old_object, weak_pointer_location); *weak_pointer_location = new_object; if (new_object != NULL) g_object_add_weak_pointer (new_object, weak_pointer_location); return TRUE; } #define g_set_weak_pointer(weak_pointer_location, new_object) \ (/* Check types match. */ \ 0 ? *(weak_pointer_location) = (new_object), FALSE : \ (g_set_weak_pointer) ((gpointer *) (weak_pointer_location), (GObject *) (new_object)) \ ) typedef struct { /*<private>*/ union { gpointer p; } priv; } GWeakRef; GLIB_AVAILABLE_IN_ALL void g_weak_ref_init (GWeakRef *weak_ref, gpointer object); GLIB_AVAILABLE_IN_ALL void g_weak_ref_clear (GWeakRef *weak_ref); GLIB_AVAILABLE_IN_ALL gpointer g_weak_ref_get (GWeakRef *weak_ref); GLIB_AVAILABLE_IN_ALL void g_weak_ref_set (GWeakRef *weak_ref, gpointer object); G_END_DECLS #endif /* __G_OBJECT_H__ */ PK rZ�[�� ( ( gobject/gvaluetypes.hnu �[��� /* GObject - GLib Type, Object, Parameter and Signal Library * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. * * gvaluetypes.h: GLib default values */ #ifndef __G_VALUETYPES_H__ #define __G_VALUETYPES_H__ #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) #error "Only <glib-object.h> can be included directly." #endif #include <gobject/gvalue.h> G_BEGIN_DECLS /* --- type macros --- */ /** * G_VALUE_HOLDS_CHAR: * @value: a valid #GValue structure * * Checks whether the given #GValue can hold values of type %G_TYPE_CHAR. * * Returns: %TRUE on success. */ #define G_VALUE_HOLDS_CHAR(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_CHAR)) /** * G_VALUE_HOLDS_UCHAR: * @value: a valid #GValue structure * * Checks whether the given #GValue can hold values of type %G_TYPE_UCHAR. * * Returns: %TRUE on success. */ #define G_VALUE_HOLDS_UCHAR(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_UCHAR)) /** * G_VALUE_HOLDS_BOOLEAN: * @value: a valid #GValue structure * * Checks whether the given #GValue can hold values of type %G_TYPE_BOOLEAN. * * Returns: %TRUE on success. */ #define G_VALUE_HOLDS_BOOLEAN(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_BOOLEAN)) /** * G_VALUE_HOLDS_INT: * @value: a valid #GValue structure * * Checks whether the given #GValue can hold values of type %G_TYPE_INT. * * Returns: %TRUE on success. */ #define G_VALUE_HOLDS_INT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_INT)) /** * G_VALUE_HOLDS_UINT: * @value: a valid #GValue structure * * Checks whether the given #GValue can hold values of type %G_TYPE_UINT. * * Returns: %TRUE on success. */ #define G_VALUE_HOLDS_UINT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_UINT)) /** * G_VALUE_HOLDS_LONG: * @value: a valid #GValue structure * * Checks whether the given #GValue can hold values of type %G_TYPE_LONG. * * Returns: %TRUE on success. */ #define G_VALUE_HOLDS_LONG(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_LONG)) /** * G_VALUE_HOLDS_ULONG: * @value: a valid #GValue structure * * Checks whether the given #GValue can hold values of type %G_TYPE_ULONG. * * Returns: %TRUE on success. */ #define G_VALUE_HOLDS_ULONG(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_ULONG)) /** * G_VALUE_HOLDS_INT64: * @value: a valid #GValue structure * * Checks whether the given #GValue can hold values of type %G_TYPE_INT64. * * Returns: %TRUE on success. */ #define G_VALUE_HOLDS_INT64(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_INT64)) /** * G_VALUE_HOLDS_UINT64: * @value: a valid #GValue structure * * Checks whether the given #GValue can hold values of type %G_TYPE_UINT64. * * Returns: %TRUE on success. */ #define G_VALUE_HOLDS_UINT64(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_UINT64)) /** * G_VALUE_HOLDS_FLOAT: * @value: a valid #GValue structure * * Checks whether the given #GValue can hold values of type %G_TYPE_FLOAT. * * Returns: %TRUE on success. */ #define G_VALUE_HOLDS_FLOAT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_FLOAT)) /** * G_VALUE_HOLDS_DOUBLE: * @value: a valid #GValue structure * * Checks whether the given #GValue can hold values of type %G_TYPE_DOUBLE. * * Returns: %TRUE on success. */ #define G_VALUE_HOLDS_DOUBLE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_DOUBLE)) /** * G_VALUE_HOLDS_STRING: * @value: a valid #GValue structure * * Checks whether the given #GValue can hold values of type %G_TYPE_STRING. * * Returns: %TRUE on success. */ #define G_VALUE_HOLDS_STRING(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_STRING)) /** * G_VALUE_IS_INTERNED_STRING: * @value: a valid #GValue structure * * Checks whether @value contains a string which is canonical. * * Returns: %TRUE if the value contains a string in its canonical * representation, as returned by g_intern_string(). See also * g_value_set_interned_string(). * * Since: 2.66 */ #define G_VALUE_IS_INTERNED_STRING(value) (G_VALUE_HOLDS_STRING (value) && ((value)->data[1].v_uint & G_VALUE_INTERNED_STRING)) GLIB_AVAILABLE_MACRO_IN_2_66 /** * G_VALUE_HOLDS_POINTER: * @value: a valid #GValue structure * * Checks whether the given #GValue can hold values of type %G_TYPE_POINTER. * * Returns: %TRUE on success. */ #define G_VALUE_HOLDS_POINTER(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_POINTER)) /** * G_TYPE_GTYPE: * * The type for #GType. */ #define G_TYPE_GTYPE (g_gtype_get_type()) /** * G_VALUE_HOLDS_GTYPE: * @value: a valid #GValue structure * * Checks whether the given #GValue can hold values of type %G_TYPE_GTYPE. * * Since: 2.12 * Returns: %TRUE on success. */ #define G_VALUE_HOLDS_GTYPE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_GTYPE)) /** * G_VALUE_HOLDS_VARIANT: * @value: a valid #GValue structure * * Checks whether the given #GValue can hold values of type %G_TYPE_VARIANT. * * Returns: %TRUE on success. * * Since: 2.26 */ #define G_VALUE_HOLDS_VARIANT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_VARIANT)) /* --- prototypes --- */ GLIB_DEPRECATED_IN_2_32_FOR(g_value_set_schar) void g_value_set_char (GValue *value, gchar v_char); GLIB_DEPRECATED_IN_2_32_FOR(g_value_get_schar) gchar g_value_get_char (const GValue *value); GLIB_AVAILABLE_IN_ALL void g_value_set_schar (GValue *value, gint8 v_char); GLIB_AVAILABLE_IN_ALL gint8 g_value_get_schar (const GValue *value); GLIB_AVAILABLE_IN_ALL void g_value_set_uchar (GValue *value, guchar v_uchar); GLIB_AVAILABLE_IN_ALL guchar g_value_get_uchar (const GValue *value); GLIB_AVAILABLE_IN_ALL void g_value_set_boolean (GValue *value, gboolean v_boolean); GLIB_AVAILABLE_IN_ALL gboolean g_value_get_boolean (const GValue *value); GLIB_AVAILABLE_IN_ALL void g_value_set_int (GValue *value, gint v_int); GLIB_AVAILABLE_IN_ALL gint g_value_get_int (const GValue *value); GLIB_AVAILABLE_IN_ALL void g_value_set_uint (GValue *value, guint v_uint); GLIB_AVAILABLE_IN_ALL guint g_value_get_uint (const GValue *value); GLIB_AVAILABLE_IN_ALL void g_value_set_long (GValue *value, glong v_long); GLIB_AVAILABLE_IN_ALL glong g_value_get_long (const GValue *value); GLIB_AVAILABLE_IN_ALL void g_value_set_ulong (GValue *value, gulong v_ulong); GLIB_AVAILABLE_IN_ALL gulong g_value_get_ulong (const GValue *value); GLIB_AVAILABLE_IN_ALL void g_value_set_int64 (GValue *value, gint64 v_int64); GLIB_AVAILABLE_IN_ALL gint64 g_value_get_int64 (const GValue *value); GLIB_AVAILABLE_IN_ALL void g_value_set_uint64 (GValue *value, guint64 v_uint64); GLIB_AVAILABLE_IN_ALL guint64 g_value_get_uint64 (const GValue *value); GLIB_AVAILABLE_IN_ALL void g_value_set_float (GValue *value, gfloat v_float); GLIB_AVAILABLE_IN_ALL gfloat g_value_get_float (const GValue *value); GLIB_AVAILABLE_IN_ALL void g_value_set_double (GValue *value, gdouble v_double); GLIB_AVAILABLE_IN_ALL gdouble g_value_get_double (const GValue *value); GLIB_AVAILABLE_IN_ALL void g_value_set_string (GValue *value, const gchar *v_string); GLIB_AVAILABLE_IN_ALL void g_value_set_static_string (GValue *value, const gchar *v_string); GLIB_AVAILABLE_IN_2_66 void g_value_set_interned_string (GValue *value, const gchar *v_string); GLIB_AVAILABLE_IN_ALL const gchar * g_value_get_string (const GValue *value); GLIB_AVAILABLE_IN_ALL gchar* g_value_dup_string (const GValue *value); GLIB_AVAILABLE_IN_ALL void g_value_set_pointer (GValue *value, gpointer v_pointer); GLIB_AVAILABLE_IN_ALL gpointer g_value_get_pointer (const GValue *value); GLIB_AVAILABLE_IN_ALL GType g_gtype_get_type (void); GLIB_AVAILABLE_IN_ALL void g_value_set_gtype (GValue *value, GType v_gtype); GLIB_AVAILABLE_IN_ALL GType g_value_get_gtype (const GValue *value); GLIB_AVAILABLE_IN_ALL void g_value_set_variant (GValue *value, GVariant *variant); GLIB_AVAILABLE_IN_ALL void g_value_take_variant (GValue *value, GVariant *variant); GLIB_AVAILABLE_IN_ALL GVariant* g_value_get_variant (const GValue *value); GLIB_AVAILABLE_IN_ALL GVariant* g_value_dup_variant (const GValue *value); /* Convenience for registering new pointer types */ GLIB_AVAILABLE_IN_ALL GType g_pointer_type_register_static (const gchar *name); /* debugging aid, describe value contents as string */ GLIB_AVAILABLE_IN_ALL gchar* g_strdup_value_contents (const GValue *value); GLIB_AVAILABLE_IN_ALL void g_value_take_string (GValue *value, gchar *v_string); GLIB_DEPRECATED_FOR(g_value_take_string) void g_value_set_string_take_ownership (GValue *value, gchar *v_string); /* humpf, need a C representable type name for G_TYPE_STRING */ /** * gchararray: * * A C representable type name for #G_TYPE_STRING. */ typedef gchar* gchararray; G_END_DECLS #endif /* __G_VALUETYPES_H__ */ PK rZ�[��f f gobject/gobject-autocleanups.hnu �[��� /* * Copyright © 2015 Canonical Limited * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. * * Author: Ryan Lortie <desrt@desrt.ca> */ #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) #error "Only <glib-object.h> can be included directly." #endif G_DEFINE_AUTOPTR_CLEANUP_FUNC(GClosure, g_closure_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GEnumClass, g_type_class_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFlagsClass, g_type_class_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GObject, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInitiallyUnowned, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GParamSpec, g_param_spec_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTypeClass, g_type_class_unref) G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GValue, g_value_unset) PK rZ�[Z=x9+ + gobject/gclosure.hnu �[��� /* GObject - GLib Type, Object, Parameter and Signal Library * Copyright (C) 2000-2001 Red Hat, Inc. * Copyright (C) 2005 Imendio AB * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __G_CLOSURE_H__ #define __G_CLOSURE_H__ #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) #error "Only <glib-object.h> can be included directly." #endif #include <gobject/gtype.h> G_BEGIN_DECLS /* --- defines --- */ /** * G_CLOSURE_NEEDS_MARSHAL: * @closure: a #GClosure * * Check if the closure still needs a marshaller. See g_closure_set_marshal(). * * Returns: %TRUE if a #GClosureMarshal marshaller has not yet been set on * @closure. */ #define G_CLOSURE_NEEDS_MARSHAL(closure) (((GClosure*) (closure))->marshal == NULL) /** * G_CLOSURE_N_NOTIFIERS: * @cl: a #GClosure * * Get the total number of notifiers connected with the closure @cl. * The count includes the meta marshaller, the finalize and invalidate notifiers * and the marshal guards. Note that each guard counts as two notifiers. * See g_closure_set_meta_marshal(), g_closure_add_finalize_notifier(), * g_closure_add_invalidate_notifier() and g_closure_add_marshal_guards(). * * Returns: number of notifiers */ #define G_CLOSURE_N_NOTIFIERS(cl) (((cl)->n_guards << 1L) + \ (cl)->n_fnotifiers + (cl)->n_inotifiers) /** * G_CCLOSURE_SWAP_DATA: * @cclosure: a #GCClosure * * Checks whether the user data of the #GCClosure should be passed as the * first parameter to the callback. See g_cclosure_new_swap(). * * Returns: %TRUE if data has to be swapped. */ #define G_CCLOSURE_SWAP_DATA(cclosure) (((GClosure*) (cclosure))->derivative_flag) /** * G_CALLBACK: * @f: a function pointer. * * Cast a function pointer to a #GCallback. */ #define G_CALLBACK(f) ((GCallback) (f)) /* -- typedefs --- */ typedef struct _GClosure GClosure; typedef struct _GClosureNotifyData GClosureNotifyData; /** * GCallback: * * The type used for callback functions in structure definitions and function * signatures. This doesn't mean that all callback functions must take no * parameters and return void. The required signature of a callback function * is determined by the context in which is used (e.g. the signal to which it * is connected). Use G_CALLBACK() to cast the callback function to a #GCallback. */ typedef void (*GCallback) (void); /** * GClosureNotify: * @data: data specified when registering the notification callback * @closure: the #GClosure on which the notification is emitted * * The type used for the various notification callbacks which can be registered * on closures. */ typedef void (*GClosureNotify) (gpointer data, GClosure *closure); /** * GClosureMarshal: * @closure: the #GClosure to which the marshaller belongs * @return_value: (nullable): a #GValue to store the return * value. May be %NULL if the callback of @closure doesn't return a * value. * @n_param_values: the length of the @param_values array * @param_values: (array length=n_param_values): an array of * #GValues holding the arguments on which to invoke the * callback of @closure * @invocation_hint: (nullable): the invocation hint given as the * last argument to g_closure_invoke() * @marshal_data: (nullable): additional data specified when * registering the marshaller, see g_closure_set_marshal() and * g_closure_set_meta_marshal() * * The type used for marshaller functions. */ typedef void (*GClosureMarshal) (GClosure *closure, GValue *return_value, guint n_param_values, const GValue *param_values, gpointer invocation_hint, gpointer marshal_data); /** * GVaClosureMarshal: * @closure: the #GClosure to which the marshaller belongs * @return_value: (nullable): a #GValue to store the return * value. May be %NULL if the callback of @closure doesn't return a * value. * @instance: (type GObject.TypeInstance): the instance on which the closure is * invoked. * @args: va_list of arguments to be passed to the closure. * @marshal_data: (nullable): additional data specified when * registering the marshaller, see g_closure_set_marshal() and * g_closure_set_meta_marshal() * @n_params: the length of the @param_types array * @param_types: (array length=n_params): the #GType of each argument from * @args. * * This is the signature of va_list marshaller functions, an optional * marshaller that can be used in some situations to avoid * marshalling the signal argument into GValues. */ typedef void (* GVaClosureMarshal) (GClosure *closure, GValue *return_value, gpointer instance, va_list args, gpointer marshal_data, int n_params, GType *param_types); /** * GCClosure: * @closure: the #GClosure * @callback: the callback function * * A #GCClosure is a specialization of #GClosure for C function callbacks. */ typedef struct _GCClosure GCClosure; /* --- structures --- */ struct _GClosureNotifyData { gpointer data; GClosureNotify notify; }; /** * GClosure: * @in_marshal: Indicates whether the closure is currently being invoked with * g_closure_invoke() * @is_invalid: Indicates whether the closure has been invalidated by * g_closure_invalidate() * * A #GClosure represents a callback supplied by the programmer. */ struct _GClosure { /*< private >*/ guint ref_count : 15; /* (atomic) */ /* meta_marshal is not used anymore but must be zero for historical reasons as it was exposed in the G_CLOSURE_N_NOTIFIERS macro */ guint meta_marshal_nouse : 1; /* (atomic) */ guint n_guards : 1; /* (atomic) */ guint n_fnotifiers : 2; /* finalization notifiers (atomic) */ guint n_inotifiers : 8; /* invalidation notifiers (atomic) */ guint in_inotify : 1; /* (atomic) */ guint floating : 1; /* (atomic) */ /*< protected >*/ guint derivative_flag : 1; /* (atomic) */ /*< public >*/ guint in_marshal : 1; /* (atomic) */ guint is_invalid : 1; /* (atomic) */ /*< private >*/ void (*marshal) (GClosure *closure, GValue /*out*/ *return_value, guint n_param_values, const GValue *param_values, gpointer invocation_hint, gpointer marshal_data); /*< protected >*/ gpointer data; /*< private >*/ GClosureNotifyData *notifiers; /* invariants/constraints: * - ->marshal and ->data are _invalid_ as soon as ->is_invalid==TRUE * - invocation of all inotifiers occurs prior to fnotifiers * - order of inotifiers is random * inotifiers may _not_ free/invalidate parameter values (e.g. ->data) * - order of fnotifiers is random * - each notifier may only be removed before or during its invocation * - reference counting may only happen prior to fnotify invocation * (in that sense, fnotifiers are really finalization handlers) */ }; /* closure for C function calls, callback() is the user function */ struct _GCClosure { GClosure closure; gpointer callback; }; /* --- prototypes --- */ GLIB_AVAILABLE_IN_ALL GClosure* g_cclosure_new (GCallback callback_func, gpointer user_data, GClosureNotify destroy_data); GLIB_AVAILABLE_IN_ALL GClosure* g_cclosure_new_swap (GCallback callback_func, gpointer user_data, GClosureNotify destroy_data); GLIB_AVAILABLE_IN_ALL GClosure* g_signal_type_cclosure_new (GType itype, guint struct_offset); /* --- prototypes --- */ GLIB_AVAILABLE_IN_ALL GClosure* g_closure_ref (GClosure *closure); GLIB_AVAILABLE_IN_ALL void g_closure_sink (GClosure *closure); GLIB_AVAILABLE_IN_ALL void g_closure_unref (GClosure *closure); /* intimidating */ GLIB_AVAILABLE_IN_ALL GClosure* g_closure_new_simple (guint sizeof_closure, gpointer data); GLIB_AVAILABLE_IN_ALL void g_closure_add_finalize_notifier (GClosure *closure, gpointer notify_data, GClosureNotify notify_func); GLIB_AVAILABLE_IN_ALL void g_closure_remove_finalize_notifier (GClosure *closure, gpointer notify_data, GClosureNotify notify_func); GLIB_AVAILABLE_IN_ALL void g_closure_add_invalidate_notifier (GClosure *closure, gpointer notify_data, GClosureNotify notify_func); GLIB_AVAILABLE_IN_ALL void g_closure_remove_invalidate_notifier (GClosure *closure, gpointer notify_data, GClosureNotify notify_func); GLIB_AVAILABLE_IN_ALL void g_closure_add_marshal_guards (GClosure *closure, gpointer pre_marshal_data, GClosureNotify pre_marshal_notify, gpointer post_marshal_data, GClosureNotify post_marshal_notify); GLIB_AVAILABLE_IN_ALL void g_closure_set_marshal (GClosure *closure, GClosureMarshal marshal); GLIB_AVAILABLE_IN_ALL void g_closure_set_meta_marshal (GClosure *closure, gpointer marshal_data, GClosureMarshal meta_marshal); GLIB_AVAILABLE_IN_ALL void g_closure_invalidate (GClosure *closure); GLIB_AVAILABLE_IN_ALL void g_closure_invoke (GClosure *closure, GValue /*out*/ *return_value, guint n_param_values, const GValue *param_values, gpointer invocation_hint); /* FIXME: OK: data_object::destroy -> closure_invalidate(); MIS: closure_invalidate() -> disconnect(closure); MIS: disconnect(closure) -> (unlink) closure_unref(); OK: closure_finalize() -> g_free (data_string); random remarks: - need marshaller repo with decent aliasing to base types - provide marshaller collection, virtually covering anything out there */ GLIB_AVAILABLE_IN_ALL void g_cclosure_marshal_generic (GClosure *closure, GValue *return_gvalue, guint n_param_values, const GValue *param_values, gpointer invocation_hint, gpointer marshal_data); GLIB_AVAILABLE_IN_ALL void g_cclosure_marshal_generic_va (GClosure *closure, GValue *return_value, gpointer instance, va_list args_list, gpointer marshal_data, int n_params, GType *param_types); G_END_DECLS #endif /* __G_CLOSURE_H__ */ PK rZ�[W�n� � gobject/gvaluearray.hnu �[��� /* GObject - GLib Type, Object, Parameter and Signal Library * Copyright (C) 2001 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. * * gvaluearray.h: GLib array type holding GValues */ #ifndef __G_VALUE_ARRAY_H__ #define __G_VALUE_ARRAY_H__ #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) #error "Only <glib-object.h> can be included directly." #endif #include <gobject/gvalue.h> G_BEGIN_DECLS /** * G_TYPE_VALUE_ARRAY: * * The type ID of the "GValueArray" type which is a boxed type, * used to pass around pointers to GValueArrays. * * Deprecated: 2.32: Use #GArray instead of #GValueArray */ #define G_TYPE_VALUE_ARRAY (g_value_array_get_type ()) GLIB_DEPRECATED_MACRO_IN_2_32_FOR(G_TYPE_ARRAY) /* --- typedefs & structs --- */ typedef struct _GValueArray GValueArray; /** * GValueArray: * @n_values: number of values contained in the array * @values: array of values * * A #GValueArray contains an array of #GValue elements. */ struct _GValueArray { guint n_values; GValue *values; /*< private >*/ guint n_prealloced; }; /* --- prototypes --- */ GLIB_DEPRECATED_IN_2_32_FOR(GArray) GType g_value_array_get_type (void) G_GNUC_CONST; GLIB_DEPRECATED_IN_2_32_FOR(GArray) GValue* g_value_array_get_nth (GValueArray *value_array, guint index_); GLIB_DEPRECATED_IN_2_32_FOR(GArray) GValueArray* g_value_array_new (guint n_prealloced); GLIB_DEPRECATED_IN_2_32_FOR(GArray) void g_value_array_free (GValueArray *value_array); GLIB_DEPRECATED_IN_2_32_FOR(GArray) GValueArray* g_value_array_copy (const GValueArray *value_array); GLIB_DEPRECATED_IN_2_32_FOR(GArray) GValueArray* g_value_array_prepend (GValueArray *value_array, const GValue *value); GLIB_DEPRECATED_IN_2_32_FOR(GArray) GValueArray* g_value_array_append (GValueArray *value_array, const GValue *value); GLIB_DEPRECATED_IN_2_32_FOR(GArray) GValueArray* g_value_array_insert (GValueArray *value_array, guint index_, const GValue *value); GLIB_DEPRECATED_IN_2_32_FOR(GArray) GValueArray* g_value_array_remove (GValueArray *value_array, guint index_); GLIB_DEPRECATED_IN_2_32_FOR(GArray) GValueArray* g_value_array_sort (GValueArray *value_array, GCompareFunc compare_func); GLIB_DEPRECATED_IN_2_32_FOR(GArray) GValueArray* g_value_array_sort_with_data (GValueArray *value_array, GCompareDataFunc compare_func, gpointer user_data); G_END_DECLS #endif /* __G_VALUE_ARRAY_H__ */ PK rZ�[+�U* U* gobject/gtypemodule.hnu �[��� /* GObject - GLib Type, Object, Parameter and Signal Library * Copyright (C) 2000 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __G_TYPE_MODULE_H__ #define __G_TYPE_MODULE_H__ #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) #error "Only <glib-object.h> can be included directly." #endif #include <gobject/gobject.h> #include <gobject/genums.h> G_BEGIN_DECLS typedef struct _GTypeModule GTypeModule; typedef struct _GTypeModuleClass GTypeModuleClass; #define G_TYPE_TYPE_MODULE (g_type_module_get_type ()) #define G_TYPE_MODULE(module) (G_TYPE_CHECK_INSTANCE_CAST ((module), G_TYPE_TYPE_MODULE, GTypeModule)) #define G_TYPE_MODULE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_TYPE_MODULE, GTypeModuleClass)) #define G_IS_TYPE_MODULE(module) (G_TYPE_CHECK_INSTANCE_TYPE ((module), G_TYPE_TYPE_MODULE)) #define G_IS_TYPE_MODULE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_TYPE_MODULE)) #define G_TYPE_MODULE_GET_CLASS(module) (G_TYPE_INSTANCE_GET_CLASS ((module), G_TYPE_TYPE_MODULE, GTypeModuleClass)) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTypeModule, g_object_unref) /** * GTypeModule: * @name: the name of the module * * The members of the GTypeModule structure should not * be accessed directly, except for the @name field. */ struct _GTypeModule { GObject parent_instance; guint use_count; GSList *type_infos; GSList *interface_infos; /*< public >*/ gchar *name; }; /** * GTypeModuleClass: * @parent_class: the parent class * @load: loads the module and registers one or more types using * g_type_module_register_type(). * @unload: unloads the module * * In order to implement dynamic loading of types based on #GTypeModule, * the @load and @unload functions in #GTypeModuleClass must be implemented. */ struct _GTypeModuleClass { GObjectClass parent_class; /*< public >*/ gboolean (* load) (GTypeModule *module); void (* unload) (GTypeModule *module); /*< private >*/ /* Padding for future expansion */ void (*reserved1) (void); void (*reserved2) (void); void (*reserved3) (void); void (*reserved4) (void); }; /** * G_DEFINE_DYNAMIC_TYPE: * @TN: The name of the new type, in Camel case. * @t_n: The name of the new type, in lowercase, with words * separated by '_'. * @T_P: The #GType of the parent type. * * A convenience macro for dynamic type implementations, which declares a * class initialization function, an instance initialization function (see * #GTypeInfo for information about these) and a static variable named * `t_n`_parent_class pointing to the parent class. Furthermore, * it defines a `*_get_type()` and a static `*_register_type()` functions * for use in your `module_init()`. * * See G_DEFINE_DYNAMIC_TYPE_EXTENDED() for an example. * * Since: 2.14 */ #define G_DEFINE_DYNAMIC_TYPE(TN, t_n, T_P) G_DEFINE_DYNAMIC_TYPE_EXTENDED (TN, t_n, T_P, 0, {}) /** * G_DEFINE_DYNAMIC_TYPE_EXTENDED: * @TypeName: The name of the new type, in Camel case. * @type_name: The name of the new type, in lowercase, with words * separated by '_'. * @TYPE_PARENT: The #GType of the parent type. * @flags: #GTypeFlags to pass to g_type_module_register_type() * @CODE: Custom code that gets inserted in the *_get_type() function. * * A more general version of G_DEFINE_DYNAMIC_TYPE() which * allows to specify #GTypeFlags and custom code. * * |[ * G_DEFINE_DYNAMIC_TYPE_EXTENDED (GtkGadget, * gtk_gadget, * GTK_TYPE_THING, * 0, * G_IMPLEMENT_INTERFACE_DYNAMIC (TYPE_GIZMO, * gtk_gadget_gizmo_init)); * ]| * expands to * |[ * static void gtk_gadget_init (GtkGadget *self); * static void gtk_gadget_class_init (GtkGadgetClass *klass); * static void gtk_gadget_class_finalize (GtkGadgetClass *klass); * * static gpointer gtk_gadget_parent_class = NULL; * static GType gtk_gadget_type_id = 0; * * static void gtk_gadget_class_intern_init (gpointer klass) * { * gtk_gadget_parent_class = g_type_class_peek_parent (klass); * gtk_gadget_class_init ((GtkGadgetClass*) klass); * } * * GType * gtk_gadget_get_type (void) * { * return gtk_gadget_type_id; * } * * static void * gtk_gadget_register_type (GTypeModule *type_module) * { * const GTypeInfo g_define_type_info = { * sizeof (GtkGadgetClass), * (GBaseInitFunc) NULL, * (GBaseFinalizeFunc) NULL, * (GClassInitFunc) gtk_gadget_class_intern_init, * (GClassFinalizeFunc) gtk_gadget_class_finalize, * NULL, // class_data * sizeof (GtkGadget), * 0, // n_preallocs * (GInstanceInitFunc) gtk_gadget_init, * NULL // value_table * }; * gtk_gadget_type_id = g_type_module_register_type (type_module, * GTK_TYPE_THING, * "GtkGadget", * &g_define_type_info, * (GTypeFlags) flags); * { * const GInterfaceInfo g_implement_interface_info = { * (GInterfaceInitFunc) gtk_gadget_gizmo_init * }; * g_type_module_add_interface (type_module, g_define_type_id, TYPE_GIZMO, &g_implement_interface_info); * } * } * ]| * * Since: 2.14 */ #define G_DEFINE_DYNAMIC_TYPE_EXTENDED(TypeName, type_name, TYPE_PARENT, flags, CODE) \ static void type_name##_init (TypeName *self); \ static void type_name##_class_init (TypeName##Class *klass); \ static void type_name##_class_finalize (TypeName##Class *klass); \ static gpointer type_name##_parent_class = NULL; \ static GType type_name##_type_id = 0; \ static gint TypeName##_private_offset; \ \ _G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \ \ G_GNUC_UNUSED \ static inline gpointer \ type_name##_get_instance_private (TypeName *self) \ { \ return (G_STRUCT_MEMBER_P (self, TypeName##_private_offset)); \ } \ \ GType \ type_name##_get_type (void) \ { \ return type_name##_type_id; \ } \ static void \ type_name##_register_type (GTypeModule *type_module) \ { \ GType g_define_type_id G_GNUC_UNUSED; \ const GTypeInfo g_define_type_info = { \ sizeof (TypeName##Class), \ (GBaseInitFunc) NULL, \ (GBaseFinalizeFunc) NULL, \ (GClassInitFunc)(void (*)(void)) type_name##_class_intern_init, \ (GClassFinalizeFunc)(void (*)(void)) type_name##_class_finalize, \ NULL, /* class_data */ \ sizeof (TypeName), \ 0, /* n_preallocs */ \ (GInstanceInitFunc)(void (*)(void)) type_name##_init, \ NULL /* value_table */ \ }; \ type_name##_type_id = g_type_module_register_type (type_module, \ TYPE_PARENT, \ #TypeName, \ &g_define_type_info, \ (GTypeFlags) flags); \ g_define_type_id = type_name##_type_id; \ { CODE ; } \ } /** * G_IMPLEMENT_INTERFACE_DYNAMIC: * @TYPE_IFACE: The #GType of the interface to add * @iface_init: The interface init function * * A convenience macro to ease interface addition in the @_C_ section * of G_DEFINE_DYNAMIC_TYPE_EXTENDED(). See G_DEFINE_DYNAMIC_TYPE_EXTENDED() * for an example. * * Note that this macro can only be used together with the * G_DEFINE_DYNAMIC_TYPE_EXTENDED macros, since it depends on variable * names from that macro. * * Since: 2.24 */ #define G_IMPLEMENT_INTERFACE_DYNAMIC(TYPE_IFACE, iface_init) { \ const GInterfaceInfo g_implement_interface_info = { \ (GInterfaceInitFunc)(void (*)(void)) iface_init, NULL, NULL \ }; \ g_type_module_add_interface (type_module, g_define_type_id, TYPE_IFACE, &g_implement_interface_info); \ } /** * G_ADD_PRIVATE_DYNAMIC: * @TypeName: the name of the type in CamelCase * * A convenience macro to ease adding private data to instances of a new dynamic * type in the @_C_ section of G_DEFINE_DYNAMIC_TYPE_EXTENDED(). See * G_ADD_PRIVATE() for details, it is similar but for static types. * * Note that this macro can only be used together with the * G_DEFINE_DYNAMIC_TYPE_EXTENDED macros, since it depends on variable * names from that macro. * * Since: 2.38 */ #define G_ADD_PRIVATE_DYNAMIC(TypeName) { \ TypeName##_private_offset = sizeof (TypeName##Private); \ } GLIB_AVAILABLE_IN_ALL GType g_type_module_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL gboolean g_type_module_use (GTypeModule *module); GLIB_AVAILABLE_IN_ALL void g_type_module_unuse (GTypeModule *module); GLIB_AVAILABLE_IN_ALL void g_type_module_set_name (GTypeModule *module, const gchar *name); GLIB_AVAILABLE_IN_ALL GType g_type_module_register_type (GTypeModule *module, GType parent_type, const gchar *type_name, const GTypeInfo *type_info, GTypeFlags flags); GLIB_AVAILABLE_IN_ALL void g_type_module_add_interface (GTypeModule *module, GType instance_type, GType interface_type, const GInterfaceInfo *interface_info); GLIB_AVAILABLE_IN_ALL GType g_type_module_register_enum (GTypeModule *module, const gchar *name, const GEnumValue *const_static_values); GLIB_AVAILABLE_IN_ALL GType g_type_module_register_flags (GTypeModule *module, const gchar *name, const GFlagsValue *const_static_values); G_END_DECLS #endif /* __G_TYPE_MODULE_H__ */ PK rZ�[k��� � gobject/gobjectnotifyqueue.cnu �[��� /* GObject - GLib Type, Object, Parameter and Signal Library * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* WARNING: * * This file is INSTALLED and other projects (outside of glib) * #include its contents. */ #ifndef __G_OBJECT_NOTIFY_QUEUE_H__ #define __G_OBJECT_NOTIFY_QUEUE_H__ #include <string.h> /* memset */ #include <glib-object.h> G_BEGIN_DECLS /* --- typedefs --- */ typedef struct _GObjectNotifyContext GObjectNotifyContext; typedef struct _GObjectNotifyQueue GObjectNotifyQueue; typedef void (*GObjectNotifyQueueDispatcher) (GObject *object, guint n_pspecs, GParamSpec **pspecs); /* --- structures --- */ struct _GObjectNotifyContext { GQuark quark_notify_queue; GObjectNotifyQueueDispatcher dispatcher; GTrashStack *_nqueue_trash; /* unused */ }; struct _GObjectNotifyQueue { GObjectNotifyContext *context; GSList *pspecs; guint16 n_pspecs; guint16 freeze_count; }; G_LOCK_DEFINE_STATIC(notify_lock); /* --- functions --- */ static void g_object_notify_queue_free (gpointer data) { GObjectNotifyQueue *nqueue = data; g_slist_free (nqueue->pspecs); g_slice_free (GObjectNotifyQueue, nqueue); } static inline GObjectNotifyQueue* g_object_notify_queue_freeze (GObject *object, GObjectNotifyContext *context) { GObjectNotifyQueue *nqueue; G_LOCK(notify_lock); nqueue = g_datalist_id_get_data (&object->qdata, context->quark_notify_queue); if (!nqueue) { nqueue = g_slice_new0 (GObjectNotifyQueue); nqueue->context = context; g_datalist_id_set_data_full (&object->qdata, context->quark_notify_queue, nqueue, g_object_notify_queue_free); } if (nqueue->freeze_count >= 65535) g_critical("Free queue for %s (%p) is larger than 65535," " called g_object_freeze_notify() too often." " Forgot to call g_object_thaw_notify() or infinite loop", G_OBJECT_TYPE_NAME (object), object); else nqueue->freeze_count++; G_UNLOCK(notify_lock); return nqueue; } static inline void g_object_notify_queue_thaw (GObject *object, GObjectNotifyQueue *nqueue) { GObjectNotifyContext *context = nqueue->context; GParamSpec *pspecs_mem[16], **pspecs, **free_me = NULL; GSList *slist; guint n_pspecs = 0; g_return_if_fail (nqueue->freeze_count > 0); g_return_if_fail (g_atomic_int_get(&object->ref_count) > 0); G_LOCK(notify_lock); /* Just make sure we never get into some nasty race condition */ if (G_UNLIKELY(nqueue->freeze_count == 0)) { G_UNLOCK(notify_lock); g_warning ("%s: property-changed notification for %s(%p) is not frozen", G_STRFUNC, G_OBJECT_TYPE_NAME (object), object); return; } nqueue->freeze_count--; if (nqueue->freeze_count) { G_UNLOCK(notify_lock); return; } pspecs = nqueue->n_pspecs > 16 ? free_me = g_new (GParamSpec*, nqueue->n_pspecs) : pspecs_mem; for (slist = nqueue->pspecs; slist; slist = slist->next) { pspecs[n_pspecs++] = slist->data; } g_datalist_id_set_data (&object->qdata, context->quark_notify_queue, NULL); G_UNLOCK(notify_lock); if (n_pspecs) context->dispatcher (object, n_pspecs, pspecs); g_free (free_me); } static inline void g_object_notify_queue_clear (GObject *object, GObjectNotifyQueue *nqueue) { g_return_if_fail (nqueue->freeze_count > 0); G_LOCK(notify_lock); g_slist_free (nqueue->pspecs); nqueue->pspecs = NULL; nqueue->n_pspecs = 0; G_UNLOCK(notify_lock); } static inline void g_object_notify_queue_add (GObject *object, GObjectNotifyQueue *nqueue, GParamSpec *pspec) { if (pspec->flags & G_PARAM_READABLE) { GParamSpec *redirect; G_LOCK(notify_lock); g_return_if_fail (nqueue->n_pspecs < 65535); redirect = g_param_spec_get_redirect_target (pspec); if (redirect) pspec = redirect; /* we do the deduping in _thaw */ if (g_slist_find (nqueue->pspecs, pspec) == NULL) { nqueue->pspecs = g_slist_prepend (nqueue->pspecs, pspec); nqueue->n_pspecs++; } G_UNLOCK(notify_lock); } } /* NB: This function is not threadsafe, do not ever use it if * you need a threadsafe notify queue. * Use g_object_notify_queue_freeze() to acquire the queue and * g_object_notify_queue_thaw() after you are done instead. */ static inline GObjectNotifyQueue* g_object_notify_queue_from_object (GObject *object, GObjectNotifyContext *context) { return g_datalist_id_get_data (&object->qdata, context->quark_notify_queue); } G_END_DECLS #endif /* __G_OBJECT_NOTIFY_QUEUE_H__ */ PK rZ�[�Zq�@ �@ gobject/gparam.hnu �[��� /* GObject - GLib Type, Object, Parameter and Signal Library * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. * * gparam.h: GParamSpec base class implementation */ #ifndef __G_PARAM_H__ #define __G_PARAM_H__ #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) #error "Only <glib-object.h> can be included directly." #endif #include <gobject/gvalue.h> G_BEGIN_DECLS /* --- standard type macros --- */ /** * G_TYPE_IS_PARAM: * @type: a #GType ID * * Checks whether @type "is a" %G_TYPE_PARAM. */ #define G_TYPE_IS_PARAM(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_PARAM) /** * G_PARAM_SPEC: * @pspec: a valid #GParamSpec * * Casts a derived #GParamSpec object (e.g. of type #GParamSpecInt) into * a #GParamSpec object. */ #define G_PARAM_SPEC(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM, GParamSpec)) /** * G_IS_PARAM_SPEC: * @pspec: a #GParamSpec * * Checks whether @pspec "is a" valid #GParamSpec structure of type %G_TYPE_PARAM * or derived. */ #if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_42 #define G_IS_PARAM_SPEC(pspec) (G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE ((pspec), G_TYPE_PARAM)) #else #define G_IS_PARAM_SPEC(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM)) #endif /** * G_PARAM_SPEC_CLASS: * @pclass: a valid #GParamSpecClass * * Casts a derived #GParamSpecClass structure into a #GParamSpecClass structure. */ #define G_PARAM_SPEC_CLASS(pclass) (G_TYPE_CHECK_CLASS_CAST ((pclass), G_TYPE_PARAM, GParamSpecClass)) /** * G_IS_PARAM_SPEC_CLASS: * @pclass: a #GParamSpecClass * * Checks whether @pclass "is a" valid #GParamSpecClass structure of type * %G_TYPE_PARAM or derived. */ #define G_IS_PARAM_SPEC_CLASS(pclass) (G_TYPE_CHECK_CLASS_TYPE ((pclass), G_TYPE_PARAM)) /** * G_PARAM_SPEC_GET_CLASS: * @pspec: a valid #GParamSpec * * Retrieves the #GParamSpecClass of a #GParamSpec. */ #define G_PARAM_SPEC_GET_CLASS(pspec) (G_TYPE_INSTANCE_GET_CLASS ((pspec), G_TYPE_PARAM, GParamSpecClass)) /* --- convenience macros --- */ /** * G_PARAM_SPEC_TYPE: * @pspec: a valid #GParamSpec * * Retrieves the #GType of this @pspec. */ #define G_PARAM_SPEC_TYPE(pspec) (G_TYPE_FROM_INSTANCE (pspec)) /** * G_PARAM_SPEC_TYPE_NAME: * @pspec: a valid #GParamSpec * * Retrieves the #GType name of this @pspec. */ #define G_PARAM_SPEC_TYPE_NAME(pspec) (g_type_name (G_PARAM_SPEC_TYPE (pspec))) /** * G_PARAM_SPEC_VALUE_TYPE: * @pspec: a valid #GParamSpec * * Retrieves the #GType to initialize a #GValue for this parameter. */ #define G_PARAM_SPEC_VALUE_TYPE(pspec) (G_PARAM_SPEC (pspec)->value_type) /** * G_VALUE_HOLDS_PARAM: * @value: a valid #GValue structure * * Checks whether the given #GValue can hold values derived from type %G_TYPE_PARAM. * * Returns: %TRUE on success. */ #define G_VALUE_HOLDS_PARAM(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_PARAM)) /* --- flags --- */ /** * GParamFlags: * @G_PARAM_READABLE: the parameter is readable * @G_PARAM_WRITABLE: the parameter is writable * @G_PARAM_READWRITE: alias for %G_PARAM_READABLE | %G_PARAM_WRITABLE * @G_PARAM_CONSTRUCT: the parameter will be set upon object construction * @G_PARAM_CONSTRUCT_ONLY: the parameter can only be set upon object construction * @G_PARAM_LAX_VALIDATION: upon parameter conversion (see g_param_value_convert()) * strict validation is not required * @G_PARAM_STATIC_NAME: the string used as name when constructing the * parameter is guaranteed to remain valid and * unmodified for the lifetime of the parameter. * Since 2.8 * @G_PARAM_STATIC_NICK: the string used as nick when constructing the * parameter is guaranteed to remain valid and * unmmodified for the lifetime of the parameter. * Since 2.8 * @G_PARAM_STATIC_BLURB: the string used as blurb when constructing the * parameter is guaranteed to remain valid and * unmodified for the lifetime of the parameter. * Since 2.8 * @G_PARAM_EXPLICIT_NOTIFY: calls to g_object_set_property() for this * property will not automatically result in a "notify" signal being * emitted: the implementation must call g_object_notify() themselves * in case the property actually changes. Since: 2.42. * @G_PARAM_PRIVATE: internal * @G_PARAM_DEPRECATED: the parameter is deprecated and will be removed * in a future version. A warning will be generated if it is used * while running with G_ENABLE_DIAGNOSTIC=1. * Since 2.26 * * Through the #GParamFlags flag values, certain aspects of parameters * can be configured. See also #G_PARAM_STATIC_STRINGS. */ typedef enum { G_PARAM_READABLE = 1 << 0, G_PARAM_WRITABLE = 1 << 1, G_PARAM_READWRITE = (G_PARAM_READABLE | G_PARAM_WRITABLE), G_PARAM_CONSTRUCT = 1 << 2, G_PARAM_CONSTRUCT_ONLY = 1 << 3, G_PARAM_LAX_VALIDATION = 1 << 4, G_PARAM_STATIC_NAME = 1 << 5, G_PARAM_PRIVATE GLIB_DEPRECATED_ENUMERATOR_IN_2_26 = G_PARAM_STATIC_NAME, G_PARAM_STATIC_NICK = 1 << 6, G_PARAM_STATIC_BLURB = 1 << 7, /* User defined flags go here */ G_PARAM_EXPLICIT_NOTIFY = 1 << 30, /* Avoid warning with -Wpedantic for gcc6 */ G_PARAM_DEPRECATED = (gint)(1u << 31) } GParamFlags; /** * G_PARAM_STATIC_STRINGS: * * #GParamFlags value alias for %G_PARAM_STATIC_NAME | %G_PARAM_STATIC_NICK | %G_PARAM_STATIC_BLURB. * * Since 2.13.0 */ #define G_PARAM_STATIC_STRINGS (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB) /* bits in the range 0xffffff00 are reserved for 3rd party usage */ /** * G_PARAM_MASK: * * Mask containing the bits of #GParamSpec.flags which are reserved for GLib. */ #define G_PARAM_MASK (0x000000ff) /** * G_PARAM_USER_SHIFT: * * Minimum shift count to be used for user defined flags, to be stored in * #GParamSpec.flags. The maximum allowed is 10. */ #define G_PARAM_USER_SHIFT (8) /* --- typedefs & structures --- */ typedef struct _GParamSpec GParamSpec; typedef struct _GParamSpecClass GParamSpecClass; typedef struct _GParameter GParameter GLIB_DEPRECATED_TYPE_IN_2_54; typedef struct _GParamSpecPool GParamSpecPool; /** * GParamSpec: (ref-func g_param_spec_ref_sink) (unref-func g_param_spec_uref) (set-value-func g_value_set_param) (get-value-func g_value_get_param) * @g_type_instance: private #GTypeInstance portion * @name: name of this parameter: always an interned string * @flags: #GParamFlags flags for this parameter * @value_type: the #GValue type for this parameter * @owner_type: #GType type that uses (introduces) this parameter * * All other fields of the GParamSpec struct are private and * should not be used directly. */ struct _GParamSpec { GTypeInstance g_type_instance; const gchar *name; /* interned string */ GParamFlags flags; GType value_type; GType owner_type; /* class or interface using this property */ /*< private >*/ gchar *_nick; gchar *_blurb; GData *qdata; guint ref_count; guint param_id; /* sort-criteria */ }; /** * GParamSpecClass: * @g_type_class: the parent class * @value_type: the #GValue type for this parameter * @finalize: The instance finalization function (optional), should chain * up to the finalize method of the parent class. * @value_set_default: Resets a @value to the default value for this type * (recommended, the default is g_value_reset()), see * g_param_value_set_default(). * @value_validate: Ensures that the contents of @value comply with the * specifications set out by this type (optional), see * g_param_value_validate(). * @values_cmp: Compares @value1 with @value2 according to this type * (recommended, the default is memcmp()), see g_param_values_cmp(). * * The class structure for the GParamSpec type. * Normally, GParamSpec classes are filled by * g_param_type_register_static(). */ struct _GParamSpecClass { GTypeClass g_type_class; GType value_type; void (*finalize) (GParamSpec *pspec); /* GParam methods */ void (*value_set_default) (GParamSpec *pspec, GValue *value); gboolean (*value_validate) (GParamSpec *pspec, GValue *value); gint (*values_cmp) (GParamSpec *pspec, const GValue *value1, const GValue *value2); /*< private >*/ gpointer dummy[4]; }; /** * GParameter: * @name: the parameter name * @value: the parameter value * * The GParameter struct is an auxiliary structure used * to hand parameter name/value pairs to g_object_newv(). * * Deprecated: 2.54: This type is not introspectable. */ struct _GParameter /* auxiliary structure for _setv() variants */ { const gchar *name; GValue value; } GLIB_DEPRECATED_TYPE_IN_2_54; /* --- prototypes --- */ GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_ref (GParamSpec *pspec); GLIB_AVAILABLE_IN_ALL void g_param_spec_unref (GParamSpec *pspec); GLIB_AVAILABLE_IN_ALL void g_param_spec_sink (GParamSpec *pspec); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_ref_sink (GParamSpec *pspec); GLIB_AVAILABLE_IN_ALL gpointer g_param_spec_get_qdata (GParamSpec *pspec, GQuark quark); GLIB_AVAILABLE_IN_ALL void g_param_spec_set_qdata (GParamSpec *pspec, GQuark quark, gpointer data); GLIB_AVAILABLE_IN_ALL void g_param_spec_set_qdata_full (GParamSpec *pspec, GQuark quark, gpointer data, GDestroyNotify destroy); GLIB_AVAILABLE_IN_ALL gpointer g_param_spec_steal_qdata (GParamSpec *pspec, GQuark quark); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_get_redirect_target (GParamSpec *pspec); GLIB_AVAILABLE_IN_ALL void g_param_value_set_default (GParamSpec *pspec, GValue *value); GLIB_AVAILABLE_IN_ALL gboolean g_param_value_defaults (GParamSpec *pspec, const GValue *value); GLIB_AVAILABLE_IN_ALL gboolean g_param_value_validate (GParamSpec *pspec, GValue *value); GLIB_AVAILABLE_IN_ALL gboolean g_param_value_convert (GParamSpec *pspec, const GValue *src_value, GValue *dest_value, gboolean strict_validation); GLIB_AVAILABLE_IN_ALL gint g_param_values_cmp (GParamSpec *pspec, const GValue *value1, const GValue *value2); GLIB_AVAILABLE_IN_ALL const gchar * g_param_spec_get_name (GParamSpec *pspec); GLIB_AVAILABLE_IN_ALL const gchar * g_param_spec_get_nick (GParamSpec *pspec); GLIB_AVAILABLE_IN_ALL const gchar * g_param_spec_get_blurb (GParamSpec *pspec); GLIB_AVAILABLE_IN_ALL void g_value_set_param (GValue *value, GParamSpec *param); GLIB_AVAILABLE_IN_ALL GParamSpec* g_value_get_param (const GValue *value); GLIB_AVAILABLE_IN_ALL GParamSpec* g_value_dup_param (const GValue *value); GLIB_AVAILABLE_IN_ALL void g_value_take_param (GValue *value, GParamSpec *param); GLIB_DEPRECATED_FOR(g_value_take_param) void g_value_set_param_take_ownership (GValue *value, GParamSpec *param); GLIB_AVAILABLE_IN_2_36 const GValue * g_param_spec_get_default_value (GParamSpec *pspec); GLIB_AVAILABLE_IN_2_46 GQuark g_param_spec_get_name_quark (GParamSpec *pspec); /* --- convenience functions --- */ typedef struct _GParamSpecTypeInfo GParamSpecTypeInfo; /** * GParamSpecTypeInfo: * @instance_size: Size of the instance (object) structure. * @n_preallocs: Prior to GLib 2.10, it specified the number of pre-allocated (cached) instances to reserve memory for (0 indicates no caching). Since GLib 2.10, it is ignored, since instances are allocated with the [slice allocator][glib-Memory-Slices] now. * @instance_init: Location of the instance initialization function (optional). * @value_type: The #GType of values conforming to this #GParamSpec * @finalize: The instance finalization function (optional). * @value_set_default: Resets a @value to the default value for @pspec * (recommended, the default is g_value_reset()), see * g_param_value_set_default(). * @value_validate: Ensures that the contents of @value comply with the * specifications set out by @pspec (optional), see * g_param_value_validate(). * @values_cmp: Compares @value1 with @value2 according to @pspec * (recommended, the default is memcmp()), see g_param_values_cmp(). * * This structure is used to provide the type system with the information * required to initialize and destruct (finalize) a parameter's class and * instances thereof. * The initialized structure is passed to the g_param_type_register_static() * The type system will perform a deep copy of this structure, so its memory * does not need to be persistent across invocation of * g_param_type_register_static(). */ struct _GParamSpecTypeInfo { /* type system portion */ guint16 instance_size; /* obligatory */ guint16 n_preallocs; /* optional */ void (*instance_init) (GParamSpec *pspec); /* optional */ /* class portion */ GType value_type; /* obligatory */ void (*finalize) (GParamSpec *pspec); /* optional */ void (*value_set_default) (GParamSpec *pspec, /* recommended */ GValue *value); gboolean (*value_validate) (GParamSpec *pspec, /* optional */ GValue *value); gint (*values_cmp) (GParamSpec *pspec, /* recommended */ const GValue *value1, const GValue *value2); }; GLIB_AVAILABLE_IN_ALL GType g_param_type_register_static (const gchar *name, const GParamSpecTypeInfo *pspec_info); GLIB_AVAILABLE_IN_2_66 gboolean g_param_spec_is_valid_name (const gchar *name); /* For registering builting types */ GType _g_param_type_register_static_constant (const gchar *name, const GParamSpecTypeInfo *pspec_info, GType opt_type); /* --- protected --- */ GLIB_AVAILABLE_IN_ALL gpointer g_param_spec_internal (GType param_type, const gchar *name, const gchar *nick, const gchar *blurb, GParamFlags flags); GLIB_AVAILABLE_IN_ALL GParamSpecPool* g_param_spec_pool_new (gboolean type_prefixing); GLIB_AVAILABLE_IN_ALL void g_param_spec_pool_insert (GParamSpecPool *pool, GParamSpec *pspec, GType owner_type); GLIB_AVAILABLE_IN_ALL void g_param_spec_pool_remove (GParamSpecPool *pool, GParamSpec *pspec); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_pool_lookup (GParamSpecPool *pool, const gchar *param_name, GType owner_type, gboolean walk_ancestors); GLIB_AVAILABLE_IN_ALL GList* g_param_spec_pool_list_owned (GParamSpecPool *pool, GType owner_type); GLIB_AVAILABLE_IN_ALL GParamSpec** g_param_spec_pool_list (GParamSpecPool *pool, GType owner_type, guint *n_pspecs_p); /* contracts: * * gboolean value_validate (GParamSpec *pspec, * GValue *value): * modify value contents in the least destructive way, so * that it complies with pspec's requirements (i.e. * according to minimum/maximum ranges etc...). return * whether modification was necessary. * * gint values_cmp (GParamSpec *pspec, * const GValue *value1, * const GValue *value2): * return value1 - value2, i.e. (-1) if value1 < value2, * (+1) if value1 > value2, and (0) otherwise (equality) */ G_END_DECLS #endif /* __G_PARAM_H__ */ PK rZ�[.-��c# c# gobject/glib-types.hnu �[��� /* GObject - GLib Type, Object, Parameter and Signal Library * Copyright (C) 2000-2001 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __GLIB_TYPES_H__ #define __GLIB_TYPES_H__ #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) && !defined(GLIB_COMPILATION) #error "Only <glib-object.h> can be included directly." #endif #include <glib.h> G_BEGIN_DECLS /* A hack necesssary to preprocess this file with g-ir-scanner */ #ifdef __GI_SCANNER__ typedef gsize GType; #endif /* --- GLib boxed types --- */ /** * G_TYPE_DATE: * * The #GType for #GDate. */ #define G_TYPE_DATE (g_date_get_type ()) /** * G_TYPE_STRV: * * The #GType for a boxed type holding a %NULL-terminated array of strings. * * The code fragments in the following example show the use of a property of * type #G_TYPE_STRV with g_object_class_install_property(), g_object_set() * and g_object_get(). * * |[ * g_object_class_install_property (object_class, * PROP_AUTHORS, * g_param_spec_boxed ("authors", * _("Authors"), * _("List of authors"), * G_TYPE_STRV, * G_PARAM_READWRITE)); * * gchar *authors[] = { "Owen", "Tim", NULL }; * g_object_set (obj, "authors", authors, NULL); * * gchar *writers[]; * g_object_get (obj, "authors", &writers, NULL); * /* do something with writers */ * g_strfreev (writers); * ]| * * Since: 2.4 */ #define G_TYPE_STRV (g_strv_get_type ()) /** * G_TYPE_GSTRING: * * The #GType for #GString. */ #define G_TYPE_GSTRING (g_gstring_get_type ()) /** * G_TYPE_HASH_TABLE: * * The #GType for a boxed type holding a #GHashTable reference. * * Since: 2.10 */ #define G_TYPE_HASH_TABLE (g_hash_table_get_type ()) /** * G_TYPE_REGEX: * * The #GType for a boxed type holding a #GRegex reference. * * Since: 2.14 */ #define G_TYPE_REGEX (g_regex_get_type ()) /** * G_TYPE_MATCH_INFO: * * The #GType for a boxed type holding a #GMatchInfo reference. * * Since: 2.30 */ #define G_TYPE_MATCH_INFO (g_match_info_get_type ()) /** * G_TYPE_ARRAY: * * The #GType for a boxed type holding a #GArray reference. * * Since: 2.22 */ #define G_TYPE_ARRAY (g_array_get_type ()) /** * G_TYPE_BYTE_ARRAY: * * The #GType for a boxed type holding a #GByteArray reference. * * Since: 2.22 */ #define G_TYPE_BYTE_ARRAY (g_byte_array_get_type ()) /** * G_TYPE_PTR_ARRAY: * * The #GType for a boxed type holding a #GPtrArray reference. * * Since: 2.22 */ #define G_TYPE_PTR_ARRAY (g_ptr_array_get_type ()) /** * G_TYPE_BYTES: * * The #GType for #GBytes. * * Since: 2.32 */ #define G_TYPE_BYTES (g_bytes_get_type ()) /** * G_TYPE_VARIANT_TYPE: * * The #GType for a boxed type holding a #GVariantType. * * Since: 2.24 */ #define G_TYPE_VARIANT_TYPE (g_variant_type_get_gtype ()) /** * G_TYPE_ERROR: * * The #GType for a boxed type holding a #GError. * * Since: 2.26 */ #define G_TYPE_ERROR (g_error_get_type ()) /** * G_TYPE_DATE_TIME: * * The #GType for a boxed type holding a #GDateTime. * * Since: 2.26 */ #define G_TYPE_DATE_TIME (g_date_time_get_type ()) /** * G_TYPE_TIME_ZONE: * * The #GType for a boxed type holding a #GTimeZone. * * Since: 2.34 */ #define G_TYPE_TIME_ZONE (g_time_zone_get_type ()) /** * G_TYPE_IO_CHANNEL: * * The #GType for #GIOChannel. */ #define G_TYPE_IO_CHANNEL (g_io_channel_get_type ()) /** * G_TYPE_IO_CONDITION: * * The #GType for #GIOCondition. */ #define G_TYPE_IO_CONDITION (g_io_condition_get_type ()) /** * G_TYPE_VARIANT_BUILDER: * * The #GType for a boxed type holding a #GVariantBuilder. * * Since: 2.30 */ #define G_TYPE_VARIANT_BUILDER (g_variant_builder_get_type ()) /** * G_TYPE_VARIANT_DICT: * * The #GType for a boxed type holding a #GVariantDict. * * Since: 2.40 */ #define G_TYPE_VARIANT_DICT (g_variant_dict_get_type ()) /** * G_TYPE_MAIN_LOOP: * * The #GType for a boxed type holding a #GMainLoop. * * Since: 2.30 */ #define G_TYPE_MAIN_LOOP (g_main_loop_get_type ()) /** * G_TYPE_MAIN_CONTEXT: * * The #GType for a boxed type holding a #GMainContext. * * Since: 2.30 */ #define G_TYPE_MAIN_CONTEXT (g_main_context_get_type ()) /** * G_TYPE_SOURCE: * * The #GType for a boxed type holding a #GSource. * * Since: 2.30 */ #define G_TYPE_SOURCE (g_source_get_type ()) /** * G_TYPE_POLLFD: * * The #GType for a boxed type holding a #GPollFD. * * Since: 2.36 */ #define G_TYPE_POLLFD (g_pollfd_get_type ()) /** * G_TYPE_MARKUP_PARSE_CONTEXT: * * The #GType for a boxed type holding a #GMarkupParseContext. * * Since: 2.36 */ #define G_TYPE_MARKUP_PARSE_CONTEXT (g_markup_parse_context_get_type ()) /** * G_TYPE_KEY_FILE: * * The #GType for a boxed type holding a #GKeyFile. * * Since: 2.32 */ #define G_TYPE_KEY_FILE (g_key_file_get_type ()) /** * G_TYPE_MAPPED_FILE: * * The #GType for a boxed type holding a #GMappedFile. * * Since: 2.40 */ #define G_TYPE_MAPPED_FILE (g_mapped_file_get_type ()) /** * G_TYPE_THREAD: * * The #GType for a boxed type holding a #GThread. * * Since: 2.36 */ #define G_TYPE_THREAD (g_thread_get_type ()) /** * G_TYPE_CHECKSUM: * * The #GType for a boxed type holding a #GChecksum. * * Since: 2.36 */ #define G_TYPE_CHECKSUM (g_checksum_get_type ()) /** * G_TYPE_OPTION_GROUP: * * The #GType for a boxed type holding a #GOptionGroup. * * Since: 2.44 */ #define G_TYPE_OPTION_GROUP (g_option_group_get_type ()) /** * G_TYPE_URI: * * The #GType for a boxed type holding a #GUri. * * Since: 2.66 */ #define G_TYPE_URI (g_uri_get_type ()) /** * G_TYPE_TREE: * * The #GType for #GTree. * * Since: 2.68 */ #define G_TYPE_TREE (g_tree_get_type ()) GLIB_AVAILABLE_IN_ALL GType g_date_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL GType g_strv_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL GType g_gstring_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL GType g_hash_table_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL GType g_array_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL GType g_byte_array_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL GType g_ptr_array_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL GType g_bytes_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL GType g_variant_type_get_gtype (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL GType g_regex_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_2_30 GType g_match_info_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL GType g_error_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL GType g_date_time_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL GType g_time_zone_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL GType g_io_channel_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL GType g_io_condition_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL GType g_variant_builder_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_2_40 GType g_variant_dict_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL GType g_key_file_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_2_30 GType g_main_loop_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_2_30 GType g_main_context_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_2_30 GType g_source_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_2_36 GType g_pollfd_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_2_36 GType g_thread_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_2_36 GType g_checksum_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_2_36 GType g_markup_parse_context_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_2_40 GType g_mapped_file_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_2_44 GType g_option_group_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_2_66 GType g_uri_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_2_68 GType g_tree_get_type (void) G_GNUC_CONST; GLIB_DEPRECATED_FOR('G_TYPE_VARIANT') GType g_variant_get_gtype (void) G_GNUC_CONST; G_END_DECLS #endif /* __GLIB_TYPES_H__ */ PK rZ�[�p� � gobject/glib-enumtypes.hnu �[��� /* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */ #ifndef __GOBJECT_ENUM_TYPES_H__ #define __GOBJECT_ENUM_TYPES_H__ #include <glib-object.h> G_BEGIN_DECLS /* enumerations from "../gobject/../glib/gunicode.h" */ GLIB_AVAILABLE_IN_2_60 GType g_unicode_type_get_type (void) G_GNUC_CONST; #define G_TYPE_UNICODE_TYPE (g_unicode_type_get_type ()) GLIB_AVAILABLE_IN_2_60 GType g_unicode_break_type_get_type (void) G_GNUC_CONST; #define G_TYPE_UNICODE_BREAK_TYPE (g_unicode_break_type_get_type ()) GLIB_AVAILABLE_IN_2_60 GType g_unicode_script_get_type (void) G_GNUC_CONST; #define G_TYPE_UNICODE_SCRIPT (g_unicode_script_get_type ()) GLIB_AVAILABLE_IN_2_60 GType g_normalize_mode_get_type (void) G_GNUC_CONST; #define G_TYPE_NORMALIZE_MODE (g_normalize_mode_get_type ()) G_END_DECLS #endif /* __GOBJECT_ENUM_TYPES_H__ */ /* Generated data ends here */ PK rZ�[+���� � gobject/gvalue.hnu �[��� /* GObject - GLib Type, Object, Parameter and Signal Library * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. * * gvalue.h: generic GValue functions */ #ifndef __G_VALUE_H__ #define __G_VALUE_H__ #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) #error "Only <glib-object.h> can be included directly." #endif #include <gobject/gtype.h> G_BEGIN_DECLS /* --- type macros --- */ /** * G_TYPE_IS_VALUE: * @type: A #GType value. * * Checks whether the passed in type ID can be used for g_value_init(). * That is, this macro checks whether this type provides an implementation * of the #GTypeValueTable functions required for a type to create a #GValue of. * * Returns: Whether @type is suitable as a #GValue type. */ #define G_TYPE_IS_VALUE(type) (g_type_check_is_value_type (type)) /** * G_IS_VALUE: * @value: A #GValue structure. * * Checks if @value is a valid and initialized #GValue structure. * * Returns: %TRUE on success. */ #define G_IS_VALUE(value) (G_TYPE_CHECK_VALUE (value)) /** * G_VALUE_TYPE: * @value: A #GValue structure. * * Get the type identifier of @value. * * Returns: the #GType. */ #define G_VALUE_TYPE(value) (((GValue*) (value))->g_type) /** * G_VALUE_TYPE_NAME: * @value: A #GValue structure. * * Gets the type name of @value. * * Returns: the type name. */ #define G_VALUE_TYPE_NAME(value) (g_type_name (G_VALUE_TYPE (value))) /** * G_VALUE_HOLDS: * @value: A #GValue structure. * @type: A #GType value. * * Checks if @value holds (or contains) a value of @type. * This macro will also check for @value != %NULL and issue a * warning if the check fails. * * Returns: %TRUE if @value holds the @type. */ #define G_VALUE_HOLDS(value,type) (G_TYPE_CHECK_VALUE_TYPE ((value), (type))) /* --- typedefs & structures --- */ /** * GValueTransform: * @src_value: Source value. * @dest_value: Target value. * * The type of value transformation functions which can be registered with * g_value_register_transform_func(). * * @dest_value will be initialized to the correct destination type. */ typedef void (*GValueTransform) (const GValue *src_value, GValue *dest_value); /** * GValue: * * An opaque structure used to hold different types of values. * The data within the structure has protected scope: it is accessible only * to functions within a #GTypeValueTable structure, or implementations of * the g_value_*() API. That is, code portions which implement new fundamental * types. * #GValue users cannot make any assumptions about how data is stored * within the 2 element @data union, and the @g_type member should * only be accessed through the G_VALUE_TYPE() macro. */ struct _GValue { /*< private >*/ GType g_type; /* public for GTypeValueTable methods */ union { gint v_int; guint v_uint; glong v_long; gulong v_ulong; gint64 v_int64; guint64 v_uint64; gfloat v_float; gdouble v_double; gpointer v_pointer; } data[2]; }; /* --- prototypes --- */ GLIB_AVAILABLE_IN_ALL GValue* g_value_init (GValue *value, GType g_type); GLIB_AVAILABLE_IN_ALL void g_value_copy (const GValue *src_value, GValue *dest_value); GLIB_AVAILABLE_IN_ALL GValue* g_value_reset (GValue *value); GLIB_AVAILABLE_IN_ALL void g_value_unset (GValue *value); GLIB_AVAILABLE_IN_ALL void g_value_set_instance (GValue *value, gpointer instance); GLIB_AVAILABLE_IN_2_42 void g_value_init_from_instance (GValue *value, gpointer instance); /* --- private --- */ GLIB_AVAILABLE_IN_ALL gboolean g_value_fits_pointer (const GValue *value); GLIB_AVAILABLE_IN_ALL gpointer g_value_peek_pointer (const GValue *value); /* --- implementation details --- */ GLIB_AVAILABLE_IN_ALL gboolean g_value_type_compatible (GType src_type, GType dest_type); GLIB_AVAILABLE_IN_ALL gboolean g_value_type_transformable (GType src_type, GType dest_type); GLIB_AVAILABLE_IN_ALL gboolean g_value_transform (const GValue *src_value, GValue *dest_value); GLIB_AVAILABLE_IN_ALL void g_value_register_transform_func (GType src_type, GType dest_type, GValueTransform transform_func); /** * G_VALUE_NOCOPY_CONTENTS: * * If passed to G_VALUE_COLLECT(), allocated data won't be copied * but used verbatim. This does not affect ref-counted types like * objects. This does not affect usage of g_value_copy(), the data will * be copied if it is not ref-counted. */ #define G_VALUE_NOCOPY_CONTENTS (1 << 27) /** * G_VALUE_INTERNED_STRING: * * For string values, indicates that the string contained is canonical and will * exist for the duration of the process. See g_value_set_interned_string(). * * Since: 2.66 */ #define G_VALUE_INTERNED_STRING (1 << 28) GLIB_AVAILABLE_MACRO_IN_2_66 /** * G_VALUE_INIT: * * A #GValue must be initialized before it can be used. This macro can * be used as initializer instead of an explicit `{ 0 }` when declaring * a variable, but it cannot be assigned to a variable. * * |[ * GValue value = G_VALUE_INIT; * ]| * * Since: 2.30 */ #define G_VALUE_INIT { 0, { { 0 } } } G_END_DECLS #endif /* __G_VALUE_H__ */ PK rZ�[R=�� � gobject/gbinding.hnu �[��� /* gbinding.h: Binding for object properties * * Copyright (C) 2010 Intel Corp. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. * * Author: Emmanuele Bassi <ebassi@linux.intel.com> */ #ifndef __G_BINDING_H__ #define __G_BINDING_H__ #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) #error "Only <glib-object.h> can be included directly." #endif #include <glib.h> #include <gobject/gobject.h> G_BEGIN_DECLS #define G_TYPE_BINDING_FLAGS (g_binding_flags_get_type ()) #define G_TYPE_BINDING (g_binding_get_type ()) #define G_BINDING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_BINDING, GBinding)) #define G_IS_BINDING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_BINDING)) /** * GBinding: * * GBinding is an opaque structure whose members * cannot be accessed directly. * * Since: 2.26 */ typedef struct _GBinding GBinding; /** * GBindingTransformFunc: * @binding: a #GBinding * @from_value: the #GValue containing the value to transform * @to_value: the #GValue in which to store the transformed value * @user_data: data passed to the transform function * * A function to be called to transform @from_value to @to_value. If * this is the @transform_to function of a binding, then @from_value * is the @source_property on the @source object, and @to_value is the * @target_property on the @target object. If this is the * @transform_from function of a %G_BINDING_BIDIRECTIONAL binding, * then those roles are reversed. * * Returns: %TRUE if the transformation was successful, and %FALSE * otherwise * * Since: 2.26 */ typedef gboolean (* GBindingTransformFunc) (GBinding *binding, const GValue *from_value, GValue *to_value, gpointer user_data); /** * GBindingFlags: * @G_BINDING_DEFAULT: The default binding; if the source property * changes, the target property is updated with its value. * @G_BINDING_BIDIRECTIONAL: Bidirectional binding; if either the * property of the source or the property of the target changes, * the other is updated. * @G_BINDING_SYNC_CREATE: Synchronize the values of the source and * target properties when creating the binding; the direction of * the synchronization is always from the source to the target. * @G_BINDING_INVERT_BOOLEAN: If the two properties being bound are * booleans, setting one to %TRUE will result in the other being * set to %FALSE and vice versa. This flag will only work for * boolean properties, and cannot be used when passing custom * transformation functions to g_object_bind_property_full(). * * Flags to be passed to g_object_bind_property() or * g_object_bind_property_full(). * * This enumeration can be extended at later date. * * Since: 2.26 */ typedef enum { /*< prefix=G_BINDING >*/ G_BINDING_DEFAULT = 0, G_BINDING_BIDIRECTIONAL = 1 << 0, G_BINDING_SYNC_CREATE = 1 << 1, G_BINDING_INVERT_BOOLEAN = 1 << 2 } GBindingFlags; GLIB_AVAILABLE_IN_ALL GType g_binding_flags_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL GType g_binding_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_ALL GBindingFlags g_binding_get_flags (GBinding *binding); GLIB_DEPRECATED_IN_2_68_FOR(g_binding_dup_source) GObject * g_binding_get_source (GBinding *binding); GLIB_AVAILABLE_IN_2_68 GObject * g_binding_dup_source (GBinding *binding); GLIB_DEPRECATED_IN_2_68_FOR(g_binding_dup_target) GObject * g_binding_get_target (GBinding *binding); GLIB_AVAILABLE_IN_2_68 GObject * g_binding_dup_target (GBinding *binding); GLIB_AVAILABLE_IN_ALL const gchar * g_binding_get_source_property (GBinding *binding); GLIB_AVAILABLE_IN_ALL const gchar * g_binding_get_target_property (GBinding *binding); GLIB_AVAILABLE_IN_2_38 void g_binding_unbind (GBinding *binding); GLIB_AVAILABLE_IN_ALL GBinding *g_object_bind_property (gpointer source, const gchar *source_property, gpointer target, const gchar *target_property, GBindingFlags flags); GLIB_AVAILABLE_IN_ALL GBinding *g_object_bind_property_full (gpointer source, const gchar *source_property, gpointer target, const gchar *target_property, GBindingFlags flags, GBindingTransformFunc transform_to, GBindingTransformFunc transform_from, gpointer user_data, GDestroyNotify notify); GLIB_AVAILABLE_IN_ALL GBinding *g_object_bind_property_with_closures (gpointer source, const gchar *source_property, gpointer target, const gchar *target_property, GBindingFlags flags, GClosure *transform_to, GClosure *transform_from); G_END_DECLS #endif /* __G_BINDING_H__ */ PK rZ�[�-J#� #� gobject/gparamspecs.hnu �[��� /* GObject - GLib Type, Object, Parameter and Signal Library * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. * * gparamspecs.h: GLib default param specs */ #ifndef __G_PARAMSPECS_H__ #define __G_PARAMSPECS_H__ #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) #error "Only <glib-object.h> can be included directly." #endif #include <gobject/gvalue.h> #include <gobject/genums.h> #include <gobject/gboxed.h> #include <gobject/gobject.h> G_BEGIN_DECLS /* --- type macros --- */ /** * G_TYPE_PARAM_CHAR: * * The #GType of #GParamSpecChar. */ #define G_TYPE_PARAM_CHAR (g_param_spec_types[0]) /** * G_IS_PARAM_SPEC_CHAR: * @pspec: a valid #GParamSpec instance * * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_CHAR. * * Returns: %TRUE on success. */ #define G_IS_PARAM_SPEC_CHAR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_CHAR)) /** * G_PARAM_SPEC_CHAR: * @pspec: a valid #GParamSpec instance * * Cast a #GParamSpec instance into a #GParamSpecChar. */ #define G_PARAM_SPEC_CHAR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_CHAR, GParamSpecChar)) /** * G_TYPE_PARAM_UCHAR: * * The #GType of #GParamSpecUChar. */ #define G_TYPE_PARAM_UCHAR (g_param_spec_types[1]) /** * G_IS_PARAM_SPEC_UCHAR: * @pspec: a valid #GParamSpec instance * * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_UCHAR. * * Returns: %TRUE on success. */ #define G_IS_PARAM_SPEC_UCHAR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UCHAR)) /** * G_PARAM_SPEC_UCHAR: * @pspec: a valid #GParamSpec instance * * Cast a #GParamSpec instance into a #GParamSpecUChar. */ #define G_PARAM_SPEC_UCHAR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UCHAR, GParamSpecUChar)) /** * G_TYPE_PARAM_BOOLEAN: * * The #GType of #GParamSpecBoolean. */ #define G_TYPE_PARAM_BOOLEAN (g_param_spec_types[2]) /** * G_IS_PARAM_SPEC_BOOLEAN: * @pspec: a valid #GParamSpec instance * * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_BOOLEAN. * * Returns: %TRUE on success. */ #define G_IS_PARAM_SPEC_BOOLEAN(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_BOOLEAN)) /** * G_PARAM_SPEC_BOOLEAN: * @pspec: a valid #GParamSpec instance * * Cast a #GParamSpec instance into a #GParamSpecBoolean. */ #define G_PARAM_SPEC_BOOLEAN(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_BOOLEAN, GParamSpecBoolean)) /** * G_TYPE_PARAM_INT: * * The #GType of #GParamSpecInt. */ #define G_TYPE_PARAM_INT (g_param_spec_types[3]) /** * G_IS_PARAM_SPEC_INT: * @pspec: a valid #GParamSpec instance * * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_INT. * * Returns: %TRUE on success. */ #define G_IS_PARAM_SPEC_INT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_INT)) /** * G_PARAM_SPEC_INT: * @pspec: a valid #GParamSpec instance * * Cast a #GParamSpec instance into a #GParamSpecInt. */ #define G_PARAM_SPEC_INT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_INT, GParamSpecInt)) /** * G_TYPE_PARAM_UINT: * * The #GType of #GParamSpecUInt. */ #define G_TYPE_PARAM_UINT (g_param_spec_types[4]) /** * G_IS_PARAM_SPEC_UINT: * @pspec: a valid #GParamSpec instance * * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_UINT. * * Returns: %TRUE on success. */ #define G_IS_PARAM_SPEC_UINT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UINT)) /** * G_PARAM_SPEC_UINT: * @pspec: a valid #GParamSpec instance * * Cast a #GParamSpec instance into a #GParamSpecUInt. */ #define G_PARAM_SPEC_UINT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UINT, GParamSpecUInt)) /** * G_TYPE_PARAM_LONG: * * The #GType of #GParamSpecLong. */ #define G_TYPE_PARAM_LONG (g_param_spec_types[5]) /** * G_IS_PARAM_SPEC_LONG: * @pspec: a valid #GParamSpec instance * * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_LONG. * * Returns: %TRUE on success. */ #define G_IS_PARAM_SPEC_LONG(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_LONG)) /** * G_PARAM_SPEC_LONG: * @pspec: a valid #GParamSpec instance * * Cast a #GParamSpec instance into a #GParamSpecLong. */ #define G_PARAM_SPEC_LONG(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_LONG, GParamSpecLong)) /** * G_TYPE_PARAM_ULONG: * * The #GType of #GParamSpecULong. */ #define G_TYPE_PARAM_ULONG (g_param_spec_types[6]) /** * G_IS_PARAM_SPEC_ULONG: * @pspec: a valid #GParamSpec instance * * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_ULONG. * * Returns: %TRUE on success. */ #define G_IS_PARAM_SPEC_ULONG(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_ULONG)) /** * G_PARAM_SPEC_ULONG: * @pspec: a valid #GParamSpec instance * * Cast a #GParamSpec instance into a #GParamSpecULong. */ #define G_PARAM_SPEC_ULONG(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ULONG, GParamSpecULong)) /** * G_TYPE_PARAM_INT64: * * The #GType of #GParamSpecInt64. */ #define G_TYPE_PARAM_INT64 (g_param_spec_types[7]) /** * G_IS_PARAM_SPEC_INT64: * @pspec: a valid #GParamSpec instance * * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_INT64. * * Returns: %TRUE on success. */ #define G_IS_PARAM_SPEC_INT64(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_INT64)) /** * G_PARAM_SPEC_INT64: * @pspec: a valid #GParamSpec instance * * Cast a #GParamSpec instance into a #GParamSpecInt64. */ #define G_PARAM_SPEC_INT64(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_INT64, GParamSpecInt64)) /** * G_TYPE_PARAM_UINT64: * * The #GType of #GParamSpecUInt64. */ #define G_TYPE_PARAM_UINT64 (g_param_spec_types[8]) /** * G_IS_PARAM_SPEC_UINT64: * @pspec: a valid #GParamSpec instance * * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_UINT64. * * Returns: %TRUE on success. */ #define G_IS_PARAM_SPEC_UINT64(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UINT64)) /** * G_PARAM_SPEC_UINT64: * @pspec: a valid #GParamSpec instance * * Cast a #GParamSpec instance into a #GParamSpecUInt64. */ #define G_PARAM_SPEC_UINT64(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UINT64, GParamSpecUInt64)) /** * G_TYPE_PARAM_UNICHAR: * * The #GType of #GParamSpecUnichar. */ #define G_TYPE_PARAM_UNICHAR (g_param_spec_types[9]) /** * G_PARAM_SPEC_UNICHAR: * @pspec: a valid #GParamSpec instance * * Cast a #GParamSpec instance into a #GParamSpecUnichar. */ #define G_PARAM_SPEC_UNICHAR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UNICHAR, GParamSpecUnichar)) /** * G_IS_PARAM_SPEC_UNICHAR: * @pspec: a valid #GParamSpec instance * * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_UNICHAR. * * Returns: %TRUE on success. */ #define G_IS_PARAM_SPEC_UNICHAR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UNICHAR)) /** * G_TYPE_PARAM_ENUM: * * The #GType of #GParamSpecEnum. */ #define G_TYPE_PARAM_ENUM (g_param_spec_types[10]) /** * G_IS_PARAM_SPEC_ENUM: * @pspec: a valid #GParamSpec instance * * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_ENUM. * * Returns: %TRUE on success. */ #define G_IS_PARAM_SPEC_ENUM(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_ENUM)) /** * G_PARAM_SPEC_ENUM: * @pspec: a valid #GParamSpec instance * * Cast a #GParamSpec instance into a #GParamSpecEnum. */ #define G_PARAM_SPEC_ENUM(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ENUM, GParamSpecEnum)) /** * G_TYPE_PARAM_FLAGS: * * The #GType of #GParamSpecFlags. */ #define G_TYPE_PARAM_FLAGS (g_param_spec_types[11]) /** * G_IS_PARAM_SPEC_FLAGS: * @pspec: a valid #GParamSpec instance * * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_FLAGS. * * Returns: %TRUE on success. */ #define G_IS_PARAM_SPEC_FLAGS(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLAGS)) /** * G_PARAM_SPEC_FLAGS: * @pspec: a valid #GParamSpec instance * * Cast a #GParamSpec instance into a #GParamSpecFlags. */ #define G_PARAM_SPEC_FLAGS(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLAGS, GParamSpecFlags)) /** * G_TYPE_PARAM_FLOAT: * * The #GType of #GParamSpecFloat. */ #define G_TYPE_PARAM_FLOAT (g_param_spec_types[12]) /** * G_IS_PARAM_SPEC_FLOAT: * @pspec: a valid #GParamSpec instance * * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_FLOAT. * * Returns: %TRUE on success. */ #define G_IS_PARAM_SPEC_FLOAT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLOAT)) /** * G_PARAM_SPEC_FLOAT: * @pspec: a valid #GParamSpec instance * * Cast a #GParamSpec instance into a #GParamSpecFloat. */ #define G_PARAM_SPEC_FLOAT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLOAT, GParamSpecFloat)) /** * G_TYPE_PARAM_DOUBLE: * * The #GType of #GParamSpecDouble. */ #define G_TYPE_PARAM_DOUBLE (g_param_spec_types[13]) /** * G_IS_PARAM_SPEC_DOUBLE: * @pspec: a valid #GParamSpec instance * * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_DOUBLE. * * Returns: %TRUE on success. */ #define G_IS_PARAM_SPEC_DOUBLE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_DOUBLE)) /** * G_PARAM_SPEC_DOUBLE: * @pspec: a valid #GParamSpec instance * * Cast a #GParamSpec instance into a #GParamSpecDouble. */ #define G_PARAM_SPEC_DOUBLE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_DOUBLE, GParamSpecDouble)) /** * G_TYPE_PARAM_STRING: * * The #GType of #GParamSpecString. */ #define G_TYPE_PARAM_STRING (g_param_spec_types[14]) /** * G_IS_PARAM_SPEC_STRING: * @pspec: a valid #GParamSpec instance * * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_STRING. * * Returns: %TRUE on success. */ #define G_IS_PARAM_SPEC_STRING(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_STRING)) /** * G_PARAM_SPEC_STRING: * @pspec: a valid #GParamSpec instance * * Casts a #GParamSpec instance into a #GParamSpecString. */ #define G_PARAM_SPEC_STRING(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_STRING, GParamSpecString)) /** * G_TYPE_PARAM_PARAM: * * The #GType of #GParamSpecParam. */ #define G_TYPE_PARAM_PARAM (g_param_spec_types[15]) /** * G_IS_PARAM_SPEC_PARAM: * @pspec: a valid #GParamSpec instance * * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_PARAM. * * Returns: %TRUE on success. */ #define G_IS_PARAM_SPEC_PARAM(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_PARAM)) /** * G_PARAM_SPEC_PARAM: * @pspec: a valid #GParamSpec instance * * Casts a #GParamSpec instance into a #GParamSpecParam. */ #define G_PARAM_SPEC_PARAM(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_PARAM, GParamSpecParam)) /** * G_TYPE_PARAM_BOXED: * * The #GType of #GParamSpecBoxed. */ #define G_TYPE_PARAM_BOXED (g_param_spec_types[16]) /** * G_IS_PARAM_SPEC_BOXED: * @pspec: a valid #GParamSpec instance * * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_BOXED. * * Returns: %TRUE on success. */ #define G_IS_PARAM_SPEC_BOXED(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_BOXED)) /** * G_PARAM_SPEC_BOXED: * @pspec: a valid #GParamSpec instance * * Cast a #GParamSpec instance into a #GParamSpecBoxed. */ #define G_PARAM_SPEC_BOXED(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_BOXED, GParamSpecBoxed)) /** * G_TYPE_PARAM_POINTER: * * The #GType of #GParamSpecPointer. */ #define G_TYPE_PARAM_POINTER (g_param_spec_types[17]) /** * G_IS_PARAM_SPEC_POINTER: * @pspec: a valid #GParamSpec instance * * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_POINTER. * * Returns: %TRUE on success. */ #define G_IS_PARAM_SPEC_POINTER(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_POINTER)) /** * G_PARAM_SPEC_POINTER: * @pspec: a valid #GParamSpec instance * * Casts a #GParamSpec instance into a #GParamSpecPointer. */ #define G_PARAM_SPEC_POINTER(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_POINTER, GParamSpecPointer)) /** * G_TYPE_PARAM_VALUE_ARRAY: * * The #GType of #GParamSpecValueArray. * * Deprecated: 2.32: Use #GArray instead of #GValueArray */ #define G_TYPE_PARAM_VALUE_ARRAY (g_param_spec_types[18]) GLIB_DEPRECATED_MACRO_IN_2_32 /** * G_IS_PARAM_SPEC_VALUE_ARRAY: * @pspec: a valid #GParamSpec instance * * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_VALUE_ARRAY. * * Returns: %TRUE on success. * * Deprecated: 2.32: Use #GArray instead of #GValueArray */ #define G_IS_PARAM_SPEC_VALUE_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_VALUE_ARRAY)) GLIB_DEPRECATED_MACRO_IN_2_32 /** * G_PARAM_SPEC_VALUE_ARRAY: * @pspec: a valid #GParamSpec instance * * Cast a #GParamSpec instance into a #GParamSpecValueArray. * * Deprecated: 2.32: Use #GArray instead of #GValueArray */ #define G_PARAM_SPEC_VALUE_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_VALUE_ARRAY, GParamSpecValueArray)) GLIB_DEPRECATED_MACRO_IN_2_32 /** * G_TYPE_PARAM_OBJECT: * * The #GType of #GParamSpecObject. */ #define G_TYPE_PARAM_OBJECT (g_param_spec_types[19]) /** * G_IS_PARAM_SPEC_OBJECT: * @pspec: a valid #GParamSpec instance * * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_OBJECT. * * Returns: %TRUE on success. */ #define G_IS_PARAM_SPEC_OBJECT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_OBJECT)) /** * G_PARAM_SPEC_OBJECT: * @pspec: a valid #GParamSpec instance * * Casts a #GParamSpec instance into a #GParamSpecObject. */ #define G_PARAM_SPEC_OBJECT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_OBJECT, GParamSpecObject)) /** * G_TYPE_PARAM_OVERRIDE: * * The #GType of #GParamSpecOverride. * * Since: 2.4 */ #define G_TYPE_PARAM_OVERRIDE (g_param_spec_types[20]) /** * G_IS_PARAM_SPEC_OVERRIDE: * @pspec: a #GParamSpec * * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_OVERRIDE. * * Since: 2.4 * Returns: %TRUE on success. */ #define G_IS_PARAM_SPEC_OVERRIDE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_OVERRIDE)) /** * G_PARAM_SPEC_OVERRIDE: * @pspec: a #GParamSpec * * Casts a #GParamSpec into a #GParamSpecOverride. * * Since: 2.4 */ #define G_PARAM_SPEC_OVERRIDE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_OVERRIDE, GParamSpecOverride)) /** * G_TYPE_PARAM_GTYPE: * * The #GType of #GParamSpecGType. * * Since: 2.10 */ #define G_TYPE_PARAM_GTYPE (g_param_spec_types[21]) /** * G_IS_PARAM_SPEC_GTYPE: * @pspec: a #GParamSpec * * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_GTYPE. * * Since: 2.10 * Returns: %TRUE on success. */ #define G_IS_PARAM_SPEC_GTYPE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_GTYPE)) /** * G_PARAM_SPEC_GTYPE: * @pspec: a #GParamSpec * * Casts a #GParamSpec into a #GParamSpecGType. * * Since: 2.10 */ #define G_PARAM_SPEC_GTYPE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_GTYPE, GParamSpecGType)) /** * G_TYPE_PARAM_VARIANT: * * The #GType of #GParamSpecVariant. * * Since: 2.26 */ #define G_TYPE_PARAM_VARIANT (g_param_spec_types[22]) /** * G_IS_PARAM_SPEC_VARIANT: * @pspec: a #GParamSpec * * Checks whether the given #GParamSpec is of type %G_TYPE_PARAM_VARIANT. * * Returns: %TRUE on success * * Since: 2.26 */ #define G_IS_PARAM_SPEC_VARIANT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_VARIANT)) /** * G_PARAM_SPEC_VARIANT: * @pspec: a #GParamSpec * * Casts a #GParamSpec into a #GParamSpecVariant. * * Since: 2.26 */ #define G_PARAM_SPEC_VARIANT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_VARIANT, GParamSpecVariant)) /* --- typedefs & structures --- */ typedef struct _GParamSpecChar GParamSpecChar; typedef struct _GParamSpecUChar GParamSpecUChar; typedef struct _GParamSpecBoolean GParamSpecBoolean; typedef struct _GParamSpecInt GParamSpecInt; typedef struct _GParamSpecUInt GParamSpecUInt; typedef struct _GParamSpecLong GParamSpecLong; typedef struct _GParamSpecULong GParamSpecULong; typedef struct _GParamSpecInt64 GParamSpecInt64; typedef struct _GParamSpecUInt64 GParamSpecUInt64; typedef struct _GParamSpecUnichar GParamSpecUnichar; typedef struct _GParamSpecEnum GParamSpecEnum; typedef struct _GParamSpecFlags GParamSpecFlags; typedef struct _GParamSpecFloat GParamSpecFloat; typedef struct _GParamSpecDouble GParamSpecDouble; typedef struct _GParamSpecString GParamSpecString; typedef struct _GParamSpecParam GParamSpecParam; typedef struct _GParamSpecBoxed GParamSpecBoxed; typedef struct _GParamSpecPointer GParamSpecPointer; typedef struct _GParamSpecValueArray GParamSpecValueArray; typedef struct _GParamSpecObject GParamSpecObject; typedef struct _GParamSpecOverride GParamSpecOverride; typedef struct _GParamSpecGType GParamSpecGType; typedef struct _GParamSpecVariant GParamSpecVariant; /** * GParamSpecChar: * @parent_instance: private #GParamSpec portion * @minimum: minimum value for the property specified * @maximum: maximum value for the property specified * @default_value: default value for the property specified * * A #GParamSpec derived structure that contains the meta data for character properties. */ struct _GParamSpecChar { GParamSpec parent_instance; gint8 minimum; gint8 maximum; gint8 default_value; }; /** * GParamSpecUChar: * @parent_instance: private #GParamSpec portion * @minimum: minimum value for the property specified * @maximum: maximum value for the property specified * @default_value: default value for the property specified * * A #GParamSpec derived structure that contains the meta data for unsigned character properties. */ struct _GParamSpecUChar { GParamSpec parent_instance; guint8 minimum; guint8 maximum; guint8 default_value; }; /** * GParamSpecBoolean: * @parent_instance: private #GParamSpec portion * @default_value: default value for the property specified * * A #GParamSpec derived structure that contains the meta data for boolean properties. */ struct _GParamSpecBoolean { GParamSpec parent_instance; gboolean default_value; }; /** * GParamSpecInt: * @parent_instance: private #GParamSpec portion * @minimum: minimum value for the property specified * @maximum: maximum value for the property specified * @default_value: default value for the property specified * * A #GParamSpec derived structure that contains the meta data for integer properties. */ struct _GParamSpecInt { GParamSpec parent_instance; gint minimum; gint maximum; gint default_value; }; /** * GParamSpecUInt: * @parent_instance: private #GParamSpec portion * @minimum: minimum value for the property specified * @maximum: maximum value for the property specified * @default_value: default value for the property specified * * A #GParamSpec derived structure that contains the meta data for unsigned integer properties. */ struct _GParamSpecUInt { GParamSpec parent_instance; guint minimum; guint maximum; guint default_value; }; /** * GParamSpecLong: * @parent_instance: private #GParamSpec portion * @minimum: minimum value for the property specified * @maximum: maximum value for the property specified * @default_value: default value for the property specified * * A #GParamSpec derived structure that contains the meta data for long integer properties. */ struct _GParamSpecLong { GParamSpec parent_instance; glong minimum; glong maximum; glong default_value; }; /** * GParamSpecULong: * @parent_instance: private #GParamSpec portion * @minimum: minimum value for the property specified * @maximum: maximum value for the property specified * @default_value: default value for the property specified * * A #GParamSpec derived structure that contains the meta data for unsigned long integer properties. */ struct _GParamSpecULong { GParamSpec parent_instance; gulong minimum; gulong maximum; gulong default_value; }; /** * GParamSpecInt64: * @parent_instance: private #GParamSpec portion * @minimum: minimum value for the property specified * @maximum: maximum value for the property specified * @default_value: default value for the property specified * * A #GParamSpec derived structure that contains the meta data for 64bit integer properties. */ struct _GParamSpecInt64 { GParamSpec parent_instance; gint64 minimum; gint64 maximum; gint64 default_value; }; /** * GParamSpecUInt64: * @parent_instance: private #GParamSpec portion * @minimum: minimum value for the property specified * @maximum: maximum value for the property specified * @default_value: default value for the property specified * * A #GParamSpec derived structure that contains the meta data for unsigned 64bit integer properties. */ struct _GParamSpecUInt64 { GParamSpec parent_instance; guint64 minimum; guint64 maximum; guint64 default_value; }; /** * GParamSpecUnichar: * @parent_instance: private #GParamSpec portion * @default_value: default value for the property specified * * A #GParamSpec derived structure that contains the meta data for unichar (unsigned integer) properties. */ struct _GParamSpecUnichar { GParamSpec parent_instance; gunichar default_value; }; /** * GParamSpecEnum: * @parent_instance: private #GParamSpec portion * @enum_class: the #GEnumClass for the enum * @default_value: default value for the property specified * * A #GParamSpec derived structure that contains the meta data for enum * properties. */ struct _GParamSpecEnum { GParamSpec parent_instance; GEnumClass *enum_class; gint default_value; }; /** * GParamSpecFlags: * @parent_instance: private #GParamSpec portion * @flags_class: the #GFlagsClass for the flags * @default_value: default value for the property specified * * A #GParamSpec derived structure that contains the meta data for flags * properties. */ struct _GParamSpecFlags { GParamSpec parent_instance; GFlagsClass *flags_class; guint default_value; }; /** * GParamSpecFloat: * @parent_instance: private #GParamSpec portion * @minimum: minimum value for the property specified * @maximum: maximum value for the property specified * @default_value: default value for the property specified * @epsilon: values closer than @epsilon will be considered identical * by g_param_values_cmp(); the default value is 1e-30. * * A #GParamSpec derived structure that contains the meta data for float properties. */ struct _GParamSpecFloat { GParamSpec parent_instance; gfloat minimum; gfloat maximum; gfloat default_value; gfloat epsilon; }; /** * GParamSpecDouble: * @parent_instance: private #GParamSpec portion * @minimum: minimum value for the property specified * @maximum: maximum value for the property specified * @default_value: default value for the property specified * @epsilon: values closer than @epsilon will be considered identical * by g_param_values_cmp(); the default value is 1e-90. * * A #GParamSpec derived structure that contains the meta data for double properties. */ struct _GParamSpecDouble { GParamSpec parent_instance; gdouble minimum; gdouble maximum; gdouble default_value; gdouble epsilon; }; /** * GParamSpecString: * @parent_instance: private #GParamSpec portion * @default_value: default value for the property specified * @cset_first: a string containing the allowed values for the first byte * @cset_nth: a string containing the allowed values for the subsequent bytes * @substitutor: the replacement byte for bytes which don't match @cset_first or @cset_nth. * @null_fold_if_empty: replace empty string by %NULL * @ensure_non_null: replace %NULL strings by an empty string * * A #GParamSpec derived structure that contains the meta data for string * properties. */ struct _GParamSpecString { GParamSpec parent_instance; gchar *default_value; gchar *cset_first; gchar *cset_nth; gchar substitutor; guint null_fold_if_empty : 1; guint ensure_non_null : 1; }; /** * GParamSpecParam: * @parent_instance: private #GParamSpec portion * * A #GParamSpec derived structure that contains the meta data for %G_TYPE_PARAM * properties. */ struct _GParamSpecParam { GParamSpec parent_instance; }; /** * GParamSpecBoxed: * @parent_instance: private #GParamSpec portion * * A #GParamSpec derived structure that contains the meta data for boxed properties. */ struct _GParamSpecBoxed { GParamSpec parent_instance; }; /** * GParamSpecPointer: * @parent_instance: private #GParamSpec portion * * A #GParamSpec derived structure that contains the meta data for pointer properties. */ struct _GParamSpecPointer { GParamSpec parent_instance; }; /** * GParamSpecValueArray: * @parent_instance: private #GParamSpec portion * @element_spec: a #GParamSpec describing the elements contained in arrays of this property, may be %NULL * @fixed_n_elements: if greater than 0, arrays of this property will always have this many elements * * A #GParamSpec derived structure that contains the meta data for #GValueArray properties. */ struct _GParamSpecValueArray { GParamSpec parent_instance; GParamSpec *element_spec; guint fixed_n_elements; }; /** * GParamSpecObject: * @parent_instance: private #GParamSpec portion * * A #GParamSpec derived structure that contains the meta data for object properties. */ struct _GParamSpecObject { GParamSpec parent_instance; }; /** * GParamSpecOverride: * * This is a type of #GParamSpec type that simply redirects operations to * another paramspec. All operations other than getting or * setting the value are redirected, including accessing the nick and * blurb, validating a value, and so forth. See * g_param_spec_get_redirect_target() for retrieving the overridden * property. #GParamSpecOverride is used in implementing * g_object_class_override_property(), and will not be directly useful * unless you are implementing a new base type similar to GObject. * * Since: 2.4 */ struct _GParamSpecOverride { /*< private >*/ GParamSpec parent_instance; GParamSpec *overridden; }; /** * GParamSpecGType: * @parent_instance: private #GParamSpec portion * @is_a_type: a #GType whose subtypes can occur as values * * A #GParamSpec derived structure that contains the meta data for #GType properties. * * Since: 2.10 */ struct _GParamSpecGType { GParamSpec parent_instance; GType is_a_type; }; /** * GParamSpecVariant: * @parent_instance: private #GParamSpec portion * @type: a #GVariantType, or %NULL * @default_value: a #GVariant, or %NULL * * A #GParamSpec derived structure that contains the meta data for #GVariant properties. * * When comparing values with g_param_values_cmp(), scalar values with the same * type will be compared with g_variant_compare(). Other non-%NULL variants will * be checked for equality with g_variant_equal(), and their sort order is * otherwise undefined. %NULL is ordered before non-%NULL variants. Two %NULL * values compare equal. * * Since: 2.26 */ struct _GParamSpecVariant { GParamSpec parent_instance; GVariantType *type; GVariant *default_value; /*< private >*/ gpointer padding[4]; }; /* --- GParamSpec prototypes --- */ GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_char (const gchar *name, const gchar *nick, const gchar *blurb, gint8 minimum, gint8 maximum, gint8 default_value, GParamFlags flags); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_uchar (const gchar *name, const gchar *nick, const gchar *blurb, guint8 minimum, guint8 maximum, guint8 default_value, GParamFlags flags); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_boolean (const gchar *name, const gchar *nick, const gchar *blurb, gboolean default_value, GParamFlags flags); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_int (const gchar *name, const gchar *nick, const gchar *blurb, gint minimum, gint maximum, gint default_value, GParamFlags flags); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_uint (const gchar *name, const gchar *nick, const gchar *blurb, guint minimum, guint maximum, guint default_value, GParamFlags flags); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_long (const gchar *name, const gchar *nick, const gchar *blurb, glong minimum, glong maximum, glong default_value, GParamFlags flags); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_ulong (const gchar *name, const gchar *nick, const gchar *blurb, gulong minimum, gulong maximum, gulong default_value, GParamFlags flags); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_int64 (const gchar *name, const gchar *nick, const gchar *blurb, gint64 minimum, gint64 maximum, gint64 default_value, GParamFlags flags); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_uint64 (const gchar *name, const gchar *nick, const gchar *blurb, guint64 minimum, guint64 maximum, guint64 default_value, GParamFlags flags); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_unichar (const gchar *name, const gchar *nick, const gchar *blurb, gunichar default_value, GParamFlags flags); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_enum (const gchar *name, const gchar *nick, const gchar *blurb, GType enum_type, gint default_value, GParamFlags flags); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_flags (const gchar *name, const gchar *nick, const gchar *blurb, GType flags_type, guint default_value, GParamFlags flags); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_float (const gchar *name, const gchar *nick, const gchar *blurb, gfloat minimum, gfloat maximum, gfloat default_value, GParamFlags flags); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_double (const gchar *name, const gchar *nick, const gchar *blurb, gdouble minimum, gdouble maximum, gdouble default_value, GParamFlags flags); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_string (const gchar *name, const gchar *nick, const gchar *blurb, const gchar *default_value, GParamFlags flags); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_param (const gchar *name, const gchar *nick, const gchar *blurb, GType param_type, GParamFlags flags); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_boxed (const gchar *name, const gchar *nick, const gchar *blurb, GType boxed_type, GParamFlags flags); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_pointer (const gchar *name, const gchar *nick, const gchar *blurb, GParamFlags flags); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_value_array (const gchar *name, const gchar *nick, const gchar *blurb, GParamSpec *element_spec, GParamFlags flags); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_object (const gchar *name, const gchar *nick, const gchar *blurb, GType object_type, GParamFlags flags); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_override (const gchar *name, GParamSpec *overridden); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_gtype (const gchar *name, const gchar *nick, const gchar *blurb, GType is_a_type, GParamFlags flags); GLIB_AVAILABLE_IN_ALL GParamSpec* g_param_spec_variant (const gchar *name, const gchar *nick, const gchar *blurb, const GVariantType *type, GVariant *default_value, GParamFlags flags); /* --- internal --- */ /* We prefix variable declarations so they can * properly get exported in windows dlls. */ #ifndef GOBJECT_VAR # ifdef G_PLATFORM_WIN32 # ifdef GOBJECT_STATIC_COMPILATION # define GOBJECT_VAR extern # else /* !GOBJECT_STATIC_COMPILATION */ # ifdef GOBJECT_COMPILATION # ifdef DLL_EXPORT # define GOBJECT_VAR extern __declspec(dllexport) # else /* !DLL_EXPORT */ # define GOBJECT_VAR extern # endif /* !DLL_EXPORT */ # else /* !GOBJECT_COMPILATION */ # define GOBJECT_VAR extern __declspec(dllimport) # endif /* !GOBJECT_COMPILATION */ # endif /* !GOBJECT_STATIC_COMPILATION */ # else /* !G_PLATFORM_WIN32 */ # define GOBJECT_VAR _GLIB_EXTERN # endif /* !G_PLATFORM_WIN32 */ #endif /* GOBJECT_VAR */ GOBJECT_VAR GType *g_param_spec_types; G_END_DECLS #endif /* __G_PARAMSPECS_H__ */ PK rZ�[$fe��c �c gobject/gsignal.hnu �[��� /* GObject - GLib Type, Object, Parameter and Signal Library * Copyright (C) 2000-2001 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef __G_SIGNAL_H__ #define __G_SIGNAL_H__ #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) #error "Only <glib-object.h> can be included directly." #endif #include <gobject/gclosure.h> #include <gobject/gvalue.h> #include <gobject/gparam.h> #include <gobject/gmarshal.h> G_BEGIN_DECLS /* --- typedefs --- */ typedef struct _GSignalQuery GSignalQuery; typedef struct _GSignalInvocationHint GSignalInvocationHint; /** * GSignalCMarshaller: * * This is the signature of marshaller functions, required to marshall * arrays of parameter values to signal emissions into C language callback * invocations. It is merely an alias to #GClosureMarshal since the #GClosure * mechanism takes over responsibility of actual function invocation for the * signal system. */ typedef GClosureMarshal GSignalCMarshaller; /** * GSignalCVaMarshaller: * * This is the signature of va_list marshaller functions, an optional * marshaller that can be used in some situations to avoid * marshalling the signal argument into GValues. */ typedef GVaClosureMarshal GSignalCVaMarshaller; /** * GSignalEmissionHook: * @ihint: Signal invocation hint, see #GSignalInvocationHint. * @n_param_values: the number of parameters to the function, including * the instance on which the signal was emitted. * @param_values: (array length=n_param_values): the instance on which * the signal was emitted, followed by the parameters of the emission. * @data: user data associated with the hook. * * A simple function pointer to get invoked when the signal is emitted. This * allows you to tie a hook to the signal type, so that it will trap all * emissions of that signal, from any object. * * You may not attach these to signals created with the #G_SIGNAL_NO_HOOKS flag. * * Returns: whether it wants to stay connected. If it returns %FALSE, the signal * hook is disconnected (and destroyed). */ typedef gboolean (*GSignalEmissionHook) (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, gpointer data); /** * GSignalAccumulator: * @ihint: Signal invocation hint, see #GSignalInvocationHint. * @return_accu: Accumulator to collect callback return values in, this * is the return value of the current signal emission. * @handler_return: A #GValue holding the return value of the signal handler. * @data: Callback data that was specified when creating the signal. * * The signal accumulator is a special callback function that can be used * to collect return values of the various callbacks that are called * during a signal emission. The signal accumulator is specified at signal * creation time, if it is left %NULL, no accumulation of callback return * values is performed. The return value of signal emissions is then the * value returned by the last callback. * * Returns: The accumulator function returns whether the signal emission * should be aborted. Returning %FALSE means to abort the * current emission and %TRUE is returned for continuation. */ typedef gboolean (*GSignalAccumulator) (GSignalInvocationHint *ihint, GValue *return_accu, const GValue *handler_return, gpointer data); /* --- run, match and connect types --- */ /** * GSignalFlags: * @G_SIGNAL_RUN_FIRST: Invoke the object method handler in the first emission stage. * @G_SIGNAL_RUN_LAST: Invoke the object method handler in the third emission stage. * @G_SIGNAL_RUN_CLEANUP: Invoke the object method handler in the last emission stage. * @G_SIGNAL_NO_RECURSE: Signals being emitted for an object while currently being in * emission for this very object will not be emitted recursively, * but instead cause the first emission to be restarted. * @G_SIGNAL_DETAILED: This signal supports "::detail" appendices to the signal name * upon handler connections and emissions. * @G_SIGNAL_ACTION: Action signals are signals that may freely be emitted on alive * objects from user code via g_signal_emit() and friends, without * the need of being embedded into extra code that performs pre or * post emission adjustments on the object. They can also be thought * of as object methods which can be called generically by * third-party code. * @G_SIGNAL_NO_HOOKS: No emissions hooks are supported for this signal. * @G_SIGNAL_MUST_COLLECT: Varargs signal emission will always collect the * arguments, even if there are no signal handlers connected. Since 2.30. * @G_SIGNAL_DEPRECATED: The signal is deprecated and will be removed * in a future version. A warning will be generated if it is connected while * running with G_ENABLE_DIAGNOSTIC=1. Since 2.32. * @G_SIGNAL_ACCUMULATOR_FIRST_RUN: Only used in #GSignalAccumulator accumulator * functions for the #GSignalInvocationHint::run_type field to mark the first * call to the accumulator function for a signal emission. Since 2.68. * * The signal flags are used to specify a signal's behaviour, the overall * signal description outlines how especially the RUN flags control the * stages of a signal emission. */ typedef enum { G_SIGNAL_RUN_FIRST = 1 << 0, G_SIGNAL_RUN_LAST = 1 << 1, G_SIGNAL_RUN_CLEANUP = 1 << 2, G_SIGNAL_NO_RECURSE = 1 << 3, G_SIGNAL_DETAILED = 1 << 4, G_SIGNAL_ACTION = 1 << 5, G_SIGNAL_NO_HOOKS = 1 << 6, G_SIGNAL_MUST_COLLECT = 1 << 7, G_SIGNAL_DEPRECATED = 1 << 8, /* normal signal flags until 1 << 16 */ G_SIGNAL_ACCUMULATOR_FIRST_RUN = 1 << 17, } GSignalFlags; /** * G_SIGNAL_FLAGS_MASK: * * A mask for all #GSignalFlags bits. */ #define G_SIGNAL_FLAGS_MASK 0x1ff /** * GConnectFlags: * @G_CONNECT_AFTER: whether the handler should be called before or after the * default handler of the signal. * @G_CONNECT_SWAPPED: whether the instance and data should be swapped when * calling the handler; see g_signal_connect_swapped() for an example. * * The connection flags are used to specify the behaviour of a signal's * connection. */ typedef enum { G_CONNECT_AFTER = 1 << 0, G_CONNECT_SWAPPED = 1 << 1 } GConnectFlags; /** * GSignalMatchType: * @G_SIGNAL_MATCH_ID: The signal id must be equal. * @G_SIGNAL_MATCH_DETAIL: The signal detail must be equal. * @G_SIGNAL_MATCH_CLOSURE: The closure must be the same. * @G_SIGNAL_MATCH_FUNC: The C closure callback must be the same. * @G_SIGNAL_MATCH_DATA: The closure data must be the same. * @G_SIGNAL_MATCH_UNBLOCKED: Only unblocked signals may be matched. * * The match types specify what g_signal_handlers_block_matched(), * g_signal_handlers_unblock_matched() and g_signal_handlers_disconnect_matched() * match signals by. */ typedef enum { G_SIGNAL_MATCH_ID = 1 << 0, G_SIGNAL_MATCH_DETAIL = 1 << 1, G_SIGNAL_MATCH_CLOSURE = 1 << 2, G_SIGNAL_MATCH_FUNC = 1 << 3, G_SIGNAL_MATCH_DATA = 1 << 4, G_SIGNAL_MATCH_UNBLOCKED = 1 << 5 } GSignalMatchType; /** * G_SIGNAL_MATCH_MASK: * * A mask for all #GSignalMatchType bits. */ #define G_SIGNAL_MATCH_MASK 0x3f /** * G_SIGNAL_TYPE_STATIC_SCOPE: * * This macro flags signal argument types for which the signal system may * assume that instances thereof remain persistent across all signal emissions * they are used in. This is only useful for non ref-counted, value-copy types. * * To flag a signal argument in this way, add `| G_SIGNAL_TYPE_STATIC_SCOPE` * to the corresponding argument of g_signal_new(). * |[ * g_signal_new ("size_request", * G_TYPE_FROM_CLASS (gobject_class), * G_SIGNAL_RUN_FIRST, * G_STRUCT_OFFSET (GtkWidgetClass, size_request), * NULL, NULL, * _gtk_marshal_VOID__BOXED, * G_TYPE_NONE, 1, * GTK_TYPE_REQUISITION | G_SIGNAL_TYPE_STATIC_SCOPE); * ]| */ #define G_SIGNAL_TYPE_STATIC_SCOPE (G_TYPE_FLAG_RESERVED_ID_BIT) /* --- signal information --- */ /** * GSignalInvocationHint: * @signal_id: The signal id of the signal invoking the callback * @detail: The detail passed on for this emission * @run_type: The stage the signal emission is currently in, this * field will contain one of %G_SIGNAL_RUN_FIRST, * %G_SIGNAL_RUN_LAST or %G_SIGNAL_RUN_CLEANUP and %G_SIGNAL_ACCUMULATOR_FIRST_RUN. * %G_SIGNAL_ACCUMULATOR_FIRST_RUN is only set for the first run of the accumulator * function for a signal emission. * * The #GSignalInvocationHint structure is used to pass on additional information * to callbacks during a signal emission. */ struct _GSignalInvocationHint { guint signal_id; GQuark detail; GSignalFlags run_type; }; /** * GSignalQuery: * @signal_id: The signal id of the signal being queried, or 0 if the * signal to be queried was unknown. * @signal_name: The signal name. * @itype: The interface/instance type that this signal can be emitted for. * @signal_flags: The signal flags as passed in to g_signal_new(). * @return_type: The return type for user callbacks. * @n_params: The number of parameters that user callbacks take. * @param_types: (array length=n_params): The individual parameter types for * user callbacks, note that the effective callback signature is: * |[<!-- language="C" --> * @return_type callback (#gpointer data1, * [param_types param_names,] * gpointer data2); * ]| * * A structure holding in-depth information for a specific signal. It is * filled in by the g_signal_query() function. */ struct _GSignalQuery { guint signal_id; const gchar *signal_name; GType itype; GSignalFlags signal_flags; GType return_type; /* mangled with G_SIGNAL_TYPE_STATIC_SCOPE flag */ guint n_params; const GType *param_types; /* mangled with G_SIGNAL_TYPE_STATIC_SCOPE flag */ }; /* --- signals --- */ GLIB_AVAILABLE_IN_ALL guint g_signal_newv (const gchar *signal_name, GType itype, GSignalFlags signal_flags, GClosure *class_closure, GSignalAccumulator accumulator, gpointer accu_data, GSignalCMarshaller c_marshaller, GType return_type, guint n_params, GType *param_types); GLIB_AVAILABLE_IN_ALL guint g_signal_new_valist (const gchar *signal_name, GType itype, GSignalFlags signal_flags, GClosure *class_closure, GSignalAccumulator accumulator, gpointer accu_data, GSignalCMarshaller c_marshaller, GType return_type, guint n_params, va_list args); GLIB_AVAILABLE_IN_ALL guint g_signal_new (const gchar *signal_name, GType itype, GSignalFlags signal_flags, guint class_offset, GSignalAccumulator accumulator, gpointer accu_data, GSignalCMarshaller c_marshaller, GType return_type, guint n_params, ...); GLIB_AVAILABLE_IN_ALL guint g_signal_new_class_handler (const gchar *signal_name, GType itype, GSignalFlags signal_flags, GCallback class_handler, GSignalAccumulator accumulator, gpointer accu_data, GSignalCMarshaller c_marshaller, GType return_type, guint n_params, ...); GLIB_AVAILABLE_IN_ALL void g_signal_set_va_marshaller (guint signal_id, GType instance_type, GSignalCVaMarshaller va_marshaller); GLIB_AVAILABLE_IN_ALL void g_signal_emitv (const GValue *instance_and_params, guint signal_id, GQuark detail, GValue *return_value); GLIB_AVAILABLE_IN_ALL void g_signal_emit_valist (gpointer instance, guint signal_id, GQuark detail, va_list var_args); GLIB_AVAILABLE_IN_ALL void g_signal_emit (gpointer instance, guint signal_id, GQuark detail, ...); GLIB_AVAILABLE_IN_ALL void g_signal_emit_by_name (gpointer instance, const gchar *detailed_signal, ...); GLIB_AVAILABLE_IN_ALL guint g_signal_lookup (const gchar *name, GType itype); GLIB_AVAILABLE_IN_ALL const gchar * g_signal_name (guint signal_id); GLIB_AVAILABLE_IN_ALL void g_signal_query (guint signal_id, GSignalQuery *query); GLIB_AVAILABLE_IN_ALL guint* g_signal_list_ids (GType itype, guint *n_ids); GLIB_AVAILABLE_IN_2_66 gboolean g_signal_is_valid_name (const gchar *name); GLIB_AVAILABLE_IN_ALL gboolean g_signal_parse_name (const gchar *detailed_signal, GType itype, guint *signal_id_p, GQuark *detail_p, gboolean force_detail_quark); GLIB_AVAILABLE_IN_ALL GSignalInvocationHint* g_signal_get_invocation_hint (gpointer instance); /* --- signal emissions --- */ GLIB_AVAILABLE_IN_ALL void g_signal_stop_emission (gpointer instance, guint signal_id, GQuark detail); GLIB_AVAILABLE_IN_ALL void g_signal_stop_emission_by_name (gpointer instance, const gchar *detailed_signal); GLIB_AVAILABLE_IN_ALL gulong g_signal_add_emission_hook (guint signal_id, GQuark detail, GSignalEmissionHook hook_func, gpointer hook_data, GDestroyNotify data_destroy); GLIB_AVAILABLE_IN_ALL void g_signal_remove_emission_hook (guint signal_id, gulong hook_id); /* --- signal handlers --- */ GLIB_AVAILABLE_IN_ALL gboolean g_signal_has_handler_pending (gpointer instance, guint signal_id, GQuark detail, gboolean may_be_blocked); GLIB_AVAILABLE_IN_ALL gulong g_signal_connect_closure_by_id (gpointer instance, guint signal_id, GQuark detail, GClosure *closure, gboolean after); GLIB_AVAILABLE_IN_ALL gulong g_signal_connect_closure (gpointer instance, const gchar *detailed_signal, GClosure *closure, gboolean after); GLIB_AVAILABLE_IN_ALL gulong g_signal_connect_data (gpointer instance, const gchar *detailed_signal, GCallback c_handler, gpointer data, GClosureNotify destroy_data, GConnectFlags connect_flags); GLIB_AVAILABLE_IN_ALL void g_signal_handler_block (gpointer instance, gulong handler_id); GLIB_AVAILABLE_IN_ALL void g_signal_handler_unblock (gpointer instance, gulong handler_id); GLIB_AVAILABLE_IN_ALL void g_signal_handler_disconnect (gpointer instance, gulong handler_id); GLIB_AVAILABLE_IN_ALL gboolean g_signal_handler_is_connected (gpointer instance, gulong handler_id); GLIB_AVAILABLE_IN_ALL gulong g_signal_handler_find (gpointer instance, GSignalMatchType mask, guint signal_id, GQuark detail, GClosure *closure, gpointer func, gpointer data); GLIB_AVAILABLE_IN_ALL guint g_signal_handlers_block_matched (gpointer instance, GSignalMatchType mask, guint signal_id, GQuark detail, GClosure *closure, gpointer func, gpointer data); GLIB_AVAILABLE_IN_ALL guint g_signal_handlers_unblock_matched (gpointer instance, GSignalMatchType mask, guint signal_id, GQuark detail, GClosure *closure, gpointer func, gpointer data); GLIB_AVAILABLE_IN_ALL guint g_signal_handlers_disconnect_matched (gpointer instance, GSignalMatchType mask, guint signal_id, GQuark detail, GClosure *closure, gpointer func, gpointer data); GLIB_AVAILABLE_IN_2_62 void g_clear_signal_handler (gulong *handler_id_ptr, gpointer instance); #define g_clear_signal_handler(handler_id_ptr, instance) \ G_STMT_START { \ gpointer const _instance = (instance); \ gulong *const _handler_id_ptr = (handler_id_ptr); \ const gulong _handler_id = *_handler_id_ptr; \ \ if (_handler_id > 0) \ { \ *_handler_id_ptr = 0; \ g_signal_handler_disconnect (_instance, _handler_id); \ } \ } G_STMT_END \ GLIB_AVAILABLE_MACRO_IN_2_62 /* --- overriding and chaining --- */ GLIB_AVAILABLE_IN_ALL void g_signal_override_class_closure (guint signal_id, GType instance_type, GClosure *class_closure); GLIB_AVAILABLE_IN_ALL void g_signal_override_class_handler (const gchar *signal_name, GType instance_type, GCallback class_handler); GLIB_AVAILABLE_IN_ALL void g_signal_chain_from_overridden (const GValue *instance_and_params, GValue *return_value); GLIB_AVAILABLE_IN_ALL void g_signal_chain_from_overridden_handler (gpointer instance, ...); /* --- convenience --- */ /** * g_signal_connect: * @instance: the instance to connect to. * @detailed_signal: a string of the form "signal-name::detail". * @c_handler: the #GCallback to connect. * @data: data to pass to @c_handler calls. * * Connects a #GCallback function to a signal for a particular object. * * The handler will be called before the default handler of the signal. * * See [memory management of signal handlers][signal-memory-management] for * details on how to handle the return value and memory management of @data. * * Returns: the handler ID, of type #gulong (always greater than 0 for successful connections) */ #define g_signal_connect(instance, detailed_signal, c_handler, data) \ g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, (GConnectFlags) 0) /** * g_signal_connect_after: * @instance: the instance to connect to. * @detailed_signal: a string of the form "signal-name::detail". * @c_handler: the #GCallback to connect. * @data: data to pass to @c_handler calls. * * Connects a #GCallback function to a signal for a particular object. * * The handler will be called after the default handler of the signal. * * Returns: the handler ID, of type #gulong (always greater than 0 for successful connections) */ #define g_signal_connect_after(instance, detailed_signal, c_handler, data) \ g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, G_CONNECT_AFTER) /** * g_signal_connect_swapped: * @instance: the instance to connect to. * @detailed_signal: a string of the form "signal-name::detail". * @c_handler: the #GCallback to connect. * @data: data to pass to @c_handler calls. * * Connects a #GCallback function to a signal for a particular object. * * The instance on which the signal is emitted and @data will be swapped when * calling the handler. This is useful when calling pre-existing functions to * operate purely on the @data, rather than the @instance: swapping the * parameters avoids the need to write a wrapper function. * * For example, this allows the shorter code: * |[<!-- language="C" --> * g_signal_connect_swapped (button, "clicked", * (GCallback) gtk_widget_hide, other_widget); * ]| * * Rather than the cumbersome: * |[<!-- language="C" --> * static void * button_clicked_cb (GtkButton *button, GtkWidget *other_widget) * { * gtk_widget_hide (other_widget); * } * * ... * * g_signal_connect (button, "clicked", * (GCallback) button_clicked_cb, other_widget); * ]| * * Returns: the handler ID, of type #gulong (always greater than 0 for successful connections) */ #define g_signal_connect_swapped(instance, detailed_signal, c_handler, data) \ g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, G_CONNECT_SWAPPED) /** * g_signal_handlers_disconnect_by_func: * @instance: The instance to remove handlers from. * @func: The C closure callback of the handlers (useless for non-C closures). * @data: The closure data of the handlers' closures. * * Disconnects all handlers on an instance that match @func and @data. * * Returns: The number of handlers that matched. */ #define g_signal_handlers_disconnect_by_func(instance, func, data) \ g_signal_handlers_disconnect_matched ((instance), \ (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), \ 0, 0, NULL, (func), (data)) /** * g_signal_handlers_disconnect_by_data: * @instance: The instance to remove handlers from * @data: the closure data of the handlers' closures * * Disconnects all handlers on an instance that match @data. * * Returns: The number of handlers that matched. * * Since: 2.32 */ #define g_signal_handlers_disconnect_by_data(instance, data) \ g_signal_handlers_disconnect_matched ((instance), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, (data)) /** * g_signal_handlers_block_by_func: * @instance: The instance to block handlers from. * @func: The C closure callback of the handlers (useless for non-C closures). * @data: The closure data of the handlers' closures. * * Blocks all handlers on an instance that match @func and @data. * * Returns: The number of handlers that matched. */ #define g_signal_handlers_block_by_func(instance, func, data) \ g_signal_handlers_block_matched ((instance), \ (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), \ 0, 0, NULL, (func), (data)) /** * g_signal_handlers_unblock_by_func: * @instance: The instance to unblock handlers from. * @func: The C closure callback of the handlers (useless for non-C closures). * @data: The closure data of the handlers' closures. * * Unblocks all handlers on an instance that match @func and @data. * * Returns: The number of handlers that matched. */ #define g_signal_handlers_unblock_by_func(instance, func, data) \ g_signal_handlers_unblock_matched ((instance), \ (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), \ 0, 0, NULL, (func), (data)) GLIB_AVAILABLE_IN_ALL gboolean g_signal_accumulator_true_handled (GSignalInvocationHint *ihint, GValue *return_accu, const GValue *handler_return, gpointer dummy); GLIB_AVAILABLE_IN_ALL gboolean g_signal_accumulator_first_wins (GSignalInvocationHint *ihint, GValue *return_accu, const GValue *handler_return, gpointer dummy); /*< private >*/ GLIB_AVAILABLE_IN_ALL void g_signal_handlers_destroy (gpointer instance); void _g_signals_destroy (GType itype); G_END_DECLS #endif /* __G_SIGNAL_H__ */ PK rZ�[��mE[&