Blame gobject/gtype.h

Packit ae235b
/* GObject - GLib Type, Object, Parameter and Signal Library
Packit ae235b
 * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc.
Packit ae235b
 *
Packit ae235b
 * This library is free software; you can redistribute it and/or
Packit ae235b
 * modify it under the terms of the GNU Lesser General Public
Packit ae235b
 * License as published by the Free Software Foundation; either
Packit ae235b
 * version 2.1 of the License, or (at your option) any later version.
Packit ae235b
 *
Packit ae235b
 * This library is distributed in the hope that it will be useful,
Packit ae235b
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit ae235b
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit ae235b
 * Lesser General Public License for more details.
Packit ae235b
 *
Packit ae235b
 * You should have received a copy of the GNU Lesser General
Packit ae235b
 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
Packit ae235b
 */
Packit ae235b
#ifndef __G_TYPE_H__
Packit ae235b
#define __G_TYPE_H__
Packit ae235b
Packit ae235b
#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
Packit ae235b
#error "Only <glib-object.h> can be included directly."
Packit ae235b
#endif
Packit ae235b
Packit ae235b
#include        <glib.h>
Packit ae235b
Packit ae235b
G_BEGIN_DECLS
Packit ae235b
Packit ae235b
/* Basic Type Macros
Packit ae235b
 */
Packit ae235b
/**
Packit ae235b
 * G_TYPE_FUNDAMENTAL:
Packit ae235b
 * @type: A #GType value.
Packit ae235b
 * 
Packit ae235b
 * The fundamental type which is the ancestor of @type.
Packit ae235b
 * Fundamental types are types that serve as ultimate bases for the derived types, 
Packit ae235b
 * thus they are the roots of distinct inheritance hierarchies.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_FUNDAMENTAL(type)	(g_type_fundamental (type))
Packit ae235b
/**
Packit ae235b
 * G_TYPE_FUNDAMENTAL_MAX:
Packit ae235b
 * 
Packit ae235b
 * An integer constant that represents the number of identifiers reserved
Packit ae235b
 * for types that are assigned at compile-time.
Packit ae235b
 */
Packit ae235b
#define	G_TYPE_FUNDAMENTAL_MAX		(255 << G_TYPE_FUNDAMENTAL_SHIFT)
Packit ae235b
Packit ae235b
/* Constant fundamental types,
Packit ae235b
 */
Packit ae235b
/**
Packit ae235b
 * G_TYPE_INVALID:
Packit ae235b
 * 
Packit ae235b
 * An invalid #GType used as error return value in some functions which return
Packit ae235b
 * a #GType. 
Packit ae235b
 */
Packit ae235b
#define G_TYPE_INVALID			G_TYPE_MAKE_FUNDAMENTAL (0)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_NONE:
Packit ae235b
 * 
Packit ae235b
 * A fundamental type which is used as a replacement for the C
Packit ae235b
 * void return type.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_NONE			G_TYPE_MAKE_FUNDAMENTAL (1)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_INTERFACE:
Packit ae235b
 * 
Packit ae235b
 * The fundamental type from which all interfaces are derived.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_INTERFACE		G_TYPE_MAKE_FUNDAMENTAL (2)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_CHAR:
Packit ae235b
 * 
Packit ae235b
 * The fundamental type corresponding to #gchar.
Packit ae235b
 * The type designated by G_TYPE_CHAR is unconditionally an 8-bit signed integer.
Packit ae235b
 * This may or may not be the same type a the C type "gchar".
Packit ae235b
 */
Packit ae235b
#define G_TYPE_CHAR			G_TYPE_MAKE_FUNDAMENTAL (3)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_UCHAR:
Packit ae235b
 * 
Packit ae235b
 * The fundamental type corresponding to #guchar.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_UCHAR			G_TYPE_MAKE_FUNDAMENTAL (4)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_BOOLEAN:
Packit ae235b
 * 
Packit ae235b
 * The fundamental type corresponding to #gboolean.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_BOOLEAN			G_TYPE_MAKE_FUNDAMENTAL (5)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_INT:
Packit ae235b
 * 
Packit ae235b
 * The fundamental type corresponding to #gint.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_INT			G_TYPE_MAKE_FUNDAMENTAL (6)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_UINT:
Packit ae235b
 * 
Packit ae235b
 * The fundamental type corresponding to #guint.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_UINT			G_TYPE_MAKE_FUNDAMENTAL (7)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_LONG:
Packit ae235b
 * 
Packit ae235b
 * The fundamental type corresponding to #glong.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_LONG			G_TYPE_MAKE_FUNDAMENTAL (8)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_ULONG:
Packit ae235b
 * 
Packit ae235b
 * The fundamental type corresponding to #gulong.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_ULONG			G_TYPE_MAKE_FUNDAMENTAL (9)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_INT64:
Packit ae235b
 * 
Packit ae235b
 * The fundamental type corresponding to #gint64.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_INT64			G_TYPE_MAKE_FUNDAMENTAL (10)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_UINT64:
Packit ae235b
 * 
Packit ae235b
 * The fundamental type corresponding to #guint64.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_UINT64			G_TYPE_MAKE_FUNDAMENTAL (11)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_ENUM:
Packit ae235b
 * 
Packit ae235b
 * The fundamental type from which all enumeration types are derived.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_ENUM			G_TYPE_MAKE_FUNDAMENTAL (12)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_FLAGS:
Packit ae235b
 * 
Packit ae235b
 * The fundamental type from which all flags types are derived.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_FLAGS			G_TYPE_MAKE_FUNDAMENTAL (13)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_FLOAT:
Packit ae235b
 * 
Packit ae235b
 * The fundamental type corresponding to #gfloat.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_FLOAT			G_TYPE_MAKE_FUNDAMENTAL (14)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_DOUBLE:
Packit ae235b
 * 
Packit ae235b
 * The fundamental type corresponding to #gdouble.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_DOUBLE			G_TYPE_MAKE_FUNDAMENTAL (15)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_STRING:
Packit ae235b
 * 
Packit ae235b
 * The fundamental type corresponding to nul-terminated C strings.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_STRING			G_TYPE_MAKE_FUNDAMENTAL (16)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_POINTER:
Packit ae235b
 * 
Packit ae235b
 * The fundamental type corresponding to #gpointer.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_POINTER			G_TYPE_MAKE_FUNDAMENTAL (17)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_BOXED:
Packit ae235b
 * 
Packit ae235b
 * The fundamental type from which all boxed types are derived.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_BOXED			G_TYPE_MAKE_FUNDAMENTAL (18)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_PARAM:
Packit ae235b
 * 
Packit ae235b
 * The fundamental type from which all #GParamSpec types are derived.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_PARAM			G_TYPE_MAKE_FUNDAMENTAL (19)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_OBJECT:
Packit ae235b
 * 
Packit ae235b
 * The fundamental type for #GObject.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_OBJECT			G_TYPE_MAKE_FUNDAMENTAL (20)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_VARIANT:
Packit ae235b
 *
Packit ae235b
 * The fundamental type corresponding to #GVariant.
Packit ae235b
 *
Packit ae235b
 * All floating #GVariant instances passed through the #GType system are
Packit ae235b
 * consumed.
Packit ae235b
 * 
Packit ae235b
 * Note that callbacks in closures, and signal handlers
Packit ae235b
 * for signals of return type %G_TYPE_VARIANT, must never return floating
Packit ae235b
 * variants.
Packit ae235b
 *
Packit ae235b
 * Note: GLib 2.24 did include a boxed type with this name. It was replaced
Packit ae235b
 * with this fundamental type in 2.26.
Packit ae235b
 *
Packit ae235b
 * Since: 2.26
Packit ae235b
 */
Packit ae235b
#define	G_TYPE_VARIANT                  G_TYPE_MAKE_FUNDAMENTAL (21)
Packit ae235b
Packit ae235b
Packit ae235b
/* Reserved fundamental type numbers to create new fundamental
Packit ae235b
 * type IDs with G_TYPE_MAKE_FUNDAMENTAL().
Packit ae235b
 * Send email to gtk-devel-list@gnome.org for reservations.
Packit ae235b
 */
Packit ae235b
/**
Packit ae235b
 * G_TYPE_FUNDAMENTAL_SHIFT:
Packit ae235b
 *
Packit ae235b
 * Shift value used in converting numbers to type IDs.
Packit ae235b
 */
Packit ae235b
#define	G_TYPE_FUNDAMENTAL_SHIFT	(2)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_MAKE_FUNDAMENTAL:
Packit ae235b
 * @x: the fundamental type number.
Packit ae235b
 * 
Packit ae235b
 * Get the type ID for the fundamental type number @x.
Packit ae235b
 * Use g_type_fundamental_next() instead of this macro to create new fundamental 
Packit ae235b
 * types.
Packit ae235b
 *
Packit ae235b
 * Returns: the GType
Packit ae235b
 */
Packit ae235b
#define	G_TYPE_MAKE_FUNDAMENTAL(x)	((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT))
Packit ae235b
/**
Packit ae235b
 * G_TYPE_RESERVED_GLIB_FIRST:
Packit ae235b
 * 
Packit ae235b
 * First fundamental type number to create a new fundamental type id with
Packit ae235b
 * G_TYPE_MAKE_FUNDAMENTAL() reserved for GLib.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_RESERVED_GLIB_FIRST	(22)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_RESERVED_GLIB_LAST:
Packit ae235b
 * 
Packit ae235b
 * Last fundamental type number reserved for GLib.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_RESERVED_GLIB_LAST	(31)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_RESERVED_BSE_FIRST:
Packit ae235b
 * 
Packit ae235b
 * First fundamental type number to create a new fundamental type id with
Packit ae235b
 * G_TYPE_MAKE_FUNDAMENTAL() reserved for BSE.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_RESERVED_BSE_FIRST	(32)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_RESERVED_BSE_LAST:
Packit ae235b
 * 
Packit ae235b
 * Last fundamental type number reserved for BSE.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_RESERVED_BSE_LAST	(48)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_RESERVED_USER_FIRST:
Packit ae235b
 * 
Packit ae235b
 * First available fundamental type number to create new fundamental 
Packit ae235b
 * type id with G_TYPE_MAKE_FUNDAMENTAL().
Packit ae235b
 */
Packit ae235b
#define G_TYPE_RESERVED_USER_FIRST	(49)
Packit ae235b
Packit ae235b
Packit ae235b
/* Type Checking Macros
Packit ae235b
 */
Packit ae235b
/**
Packit ae235b
 * G_TYPE_IS_FUNDAMENTAL:
Packit ae235b
 * @type: A #GType value
Packit ae235b
 * 
Packit ae235b
 * Checks if @type is a fundamental type.
Packit ae235b
 *
Packit ae235b
 * Returns: %TRUE on success
Packit ae235b
 */
Packit ae235b
#define G_TYPE_IS_FUNDAMENTAL(type)             ((type) <= G_TYPE_FUNDAMENTAL_MAX)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_IS_DERIVED:
Packit ae235b
 * @type: A #GType value
Packit ae235b
 * 
Packit ae235b
 * Checks if @type is derived (or in object-oriented terminology:
Packit ae235b
 * inherited) from another type (this holds true for all non-fundamental
Packit ae235b
 * types).
Packit ae235b
 *
Packit ae235b
 * Returns: %TRUE on success
Packit ae235b
 */
Packit ae235b
#define G_TYPE_IS_DERIVED(type)                 ((type) > G_TYPE_FUNDAMENTAL_MAX)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_IS_INTERFACE:
Packit ae235b
 * @type: A #GType value
Packit ae235b
 * 
Packit ae235b
 * Checks if @type is an interface type.
Packit ae235b
 * An interface type provides a pure API, the implementation
Packit ae235b
 * of which is provided by another type (which is then said to conform
Packit ae235b
 * to the interface).  GLib interfaces are somewhat analogous to Java
Packit ae235b
 * interfaces and C++ classes containing only pure virtual functions, 
Packit ae235b
 * with the difference that GType interfaces are not derivable (but see
Packit ae235b
 * g_type_interface_add_prerequisite() for an alternative).
Packit ae235b
 *
Packit ae235b
 * Returns: %TRUE on success
Packit ae235b
 */
Packit ae235b
#define G_TYPE_IS_INTERFACE(type)               (G_TYPE_FUNDAMENTAL (type) == G_TYPE_INTERFACE)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_IS_CLASSED:
Packit ae235b
 * @type: A #GType value
Packit ae235b
 * 
Packit ae235b
 * Checks if @type is a classed type.
Packit ae235b
 *
Packit ae235b
 * Returns: %TRUE on success
Packit ae235b
 */
Packit ae235b
#define G_TYPE_IS_CLASSED(type)                 (g_type_test_flags ((type), G_TYPE_FLAG_CLASSED))
Packit ae235b
/**
Packit ae235b
 * G_TYPE_IS_INSTANTIATABLE:
Packit ae235b
 * @type: A #GType value
Packit ae235b
 * 
Packit ae235b
 * Checks if @type can be instantiated.  Instantiation is the
Packit ae235b
 * process of creating an instance (object) of this type.
Packit ae235b
 *
Packit ae235b
 * Returns: %TRUE on success
Packit ae235b
 */
Packit ae235b
#define G_TYPE_IS_INSTANTIATABLE(type)          (g_type_test_flags ((type), G_TYPE_FLAG_INSTANTIATABLE))
Packit ae235b
/**
Packit ae235b
 * G_TYPE_IS_DERIVABLE:
Packit ae235b
 * @type: A #GType value
Packit ae235b
 * 
Packit ae235b
 * Checks if @type is a derivable type.  A derivable type can
Packit ae235b
 * be used as the base class of a flat (single-level) class hierarchy.
Packit ae235b
 *
Packit ae235b
 * Returns: %TRUE on success
Packit ae235b
 */
Packit ae235b
#define G_TYPE_IS_DERIVABLE(type)               (g_type_test_flags ((type), G_TYPE_FLAG_DERIVABLE))
Packit ae235b
/**
Packit ae235b
 * G_TYPE_IS_DEEP_DERIVABLE:
Packit ae235b
 * @type: A #GType value
Packit ae235b
 * 
Packit ae235b
 * Checks if @type is a deep derivable type.  A deep derivable type
Packit ae235b
 * can be used as the base class of a deep (multi-level) class hierarchy.
Packit ae235b
 *
Packit ae235b
 * Returns: %TRUE on success
Packit ae235b
 */
Packit ae235b
#define G_TYPE_IS_DEEP_DERIVABLE(type)          (g_type_test_flags ((type), G_TYPE_FLAG_DEEP_DERIVABLE))
Packit ae235b
/**
Packit ae235b
 * G_TYPE_IS_ABSTRACT:
Packit ae235b
 * @type: A #GType value
Packit ae235b
 * 
Packit ae235b
 * Checks if @type is an abstract type.  An abstract type cannot be
Packit ae235b
 * instantiated and is normally used as an abstract base class for
Packit ae235b
 * derived classes.
Packit ae235b
 *
Packit ae235b
 * Returns: %TRUE on success
Packit ae235b
 */
Packit ae235b
#define G_TYPE_IS_ABSTRACT(type)                (g_type_test_flags ((type), G_TYPE_FLAG_ABSTRACT))
Packit ae235b
/**
Packit ae235b
 * G_TYPE_IS_VALUE_ABSTRACT:
Packit ae235b
 * @type: A #GType value
Packit ae235b
 * 
Packit ae235b
 * Checks if @type is an abstract value type.  An abstract value type introduces
Packit ae235b
 * a value table, but can't be used for g_value_init() and is normally used as
Packit ae235b
 * an abstract base type for derived value types.
Packit ae235b
 *
Packit ae235b
 * Returns: %TRUE on success
Packit ae235b
 */
Packit ae235b
#define G_TYPE_IS_VALUE_ABSTRACT(type)          (g_type_test_flags ((type), G_TYPE_FLAG_VALUE_ABSTRACT))
Packit ae235b
/**
Packit ae235b
 * G_TYPE_IS_VALUE_TYPE:
Packit ae235b
 * @type: A #GType value
Packit ae235b
 * 
Packit ae235b
 * Checks if @type is a value type and can be used with g_value_init(). 
Packit ae235b
 *
Packit ae235b
 * Returns: %TRUE on success
Packit ae235b
 */
Packit ae235b
#define G_TYPE_IS_VALUE_TYPE(type)              (g_type_check_is_value_type (type))
Packit ae235b
/**
Packit ae235b
 * G_TYPE_HAS_VALUE_TABLE:
Packit ae235b
 * @type: A #GType value
Packit ae235b
 * 
Packit ae235b
 * Checks if @type has a #GTypeValueTable.
Packit ae235b
 *
Packit ae235b
 * Returns: %TRUE on success
Packit ae235b
 */
Packit ae235b
#define G_TYPE_HAS_VALUE_TABLE(type)            (g_type_value_table_peek (type) != NULL)
Packit ae235b
Packit ae235b
Packit ae235b
/* Typedefs
Packit ae235b
 */
Packit ae235b
/**
Packit ae235b
 * GType:
Packit ae235b
 * 
Packit ae235b
 * A numerical value which represents the unique identifier of a registered
Packit ae235b
 * type.
Packit ae235b
 */
Packit ae235b
#if     GLIB_SIZEOF_SIZE_T != GLIB_SIZEOF_LONG || !defined __cplusplus
Packit ae235b
typedef gsize                           GType;
Packit ae235b
#else   /* for historic reasons, C++ links against gulong GTypes */
Packit ae235b
typedef gulong                          GType;
Packit ae235b
#endif
Packit ae235b
typedef struct _GValue                  GValue;
Packit ae235b
typedef union  _GTypeCValue             GTypeCValue;
Packit ae235b
typedef struct _GTypePlugin             GTypePlugin;
Packit ae235b
typedef struct _GTypeClass              GTypeClass;
Packit ae235b
typedef struct _GTypeInterface          GTypeInterface;
Packit ae235b
typedef struct _GTypeInstance           GTypeInstance;
Packit ae235b
typedef struct _GTypeInfo               GTypeInfo;
Packit ae235b
typedef struct _GTypeFundamentalInfo    GTypeFundamentalInfo;
Packit ae235b
typedef struct _GInterfaceInfo          GInterfaceInfo;
Packit ae235b
typedef struct _GTypeValueTable         GTypeValueTable;
Packit ae235b
typedef struct _GTypeQuery		GTypeQuery;
Packit ae235b
Packit ae235b
Packit ae235b
/* Basic Type Structures
Packit ae235b
 */
Packit ae235b
/**
Packit ae235b
 * GTypeClass:
Packit ae235b
 * 
Packit ae235b
 * An opaque structure used as the base of all classes.
Packit ae235b
 */
Packit ae235b
struct _GTypeClass
Packit ae235b
{
Packit ae235b
  /*< private >*/
Packit ae235b
  GType g_type;
Packit ae235b
};
Packit ae235b
/**
Packit ae235b
 * GTypeInstance:
Packit ae235b
 * 
Packit ae235b
 * An opaque structure used as the base of all type instances.
Packit ae235b
 */
Packit ae235b
struct _GTypeInstance
Packit ae235b
{
Packit ae235b
  /*< private >*/
Packit ae235b
  GTypeClass *g_class;
Packit ae235b
};
Packit ae235b
/**
Packit ae235b
 * GTypeInterface:
Packit ae235b
 * 
Packit ae235b
 * An opaque structure used as the base of all interface types.
Packit ae235b
 */
Packit ae235b
struct _GTypeInterface
Packit ae235b
{
Packit ae235b
  /*< private >*/
Packit ae235b
  GType g_type;         /* iface type */
Packit ae235b
  GType g_instance_type;
Packit ae235b
};
Packit ae235b
/**
Packit ae235b
 * GTypeQuery:
Packit ae235b
 * @type: the #GType value of the type
Packit ae235b
 * @type_name: the name of the type
Packit ae235b
 * @class_size: the size of the class structure
Packit ae235b
 * @instance_size: the size of the instance structure
Packit ae235b
 * 
Packit ae235b
 * A structure holding information for a specific type.
Packit ae235b
 * It is filled in by the g_type_query() function.
Packit ae235b
 */
Packit ae235b
struct _GTypeQuery
Packit ae235b
{
Packit ae235b
  GType		type;
Packit ae235b
  const gchar  *type_name;
Packit ae235b
  guint		class_size;
Packit ae235b
  guint		instance_size;
Packit ae235b
};
Packit ae235b
Packit ae235b
Packit ae235b
/* Casts, checks and accessors for structured types
Packit ae235b
 * usage of these macros is reserved to type implementations only
Packit ae235b
 */
Packit ae235b
/*< protected >*/
Packit ae235b
/**
Packit ae235b
 * G_TYPE_CHECK_INSTANCE:
Packit ae235b
 * @instance: Location of a #GTypeInstance structure
Packit ae235b
 * 
Packit ae235b
 * Checks if @instance is a valid #GTypeInstance structure,
Packit ae235b
 * otherwise issues a warning and returns %FALSE. %NULL is not a valid
Packit ae235b
 * #GTypeInstance.
Packit ae235b
 * 
Packit ae235b
 * This macro should only be used in type implementations.
Packit ae235b
 *
Packit ae235b
 * Returns: %TRUE on success
Packit ae235b
 */
Packit ae235b
#define G_TYPE_CHECK_INSTANCE(instance)				(_G_TYPE_CHI ((GTypeInstance*) (instance)))
Packit ae235b
/**
Packit ae235b
 * G_TYPE_CHECK_INSTANCE_CAST:
Packit ae235b
 * @instance: (nullable): Location of a #GTypeInstance structure
Packit ae235b
 * @g_type: The type to be returned
Packit ae235b
 * @c_type: The corresponding C type of @g_type
Packit ae235b
 * 
Packit ae235b
 * Checks that @instance is an instance of the type identified by @g_type
Packit ae235b
 * and issues a warning if this is not the case. Returns @instance casted 
Packit ae235b
 * to a pointer to @c_type.
Packit ae235b
 *
Packit ae235b
 * No warning will be issued if @instance is %NULL, and %NULL will be returned.
Packit ae235b
 * 
Packit ae235b
 * This macro should only be used in type implementations.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type)    (_G_TYPE_CIC ((instance), (g_type), c_type))
Packit ae235b
/**
Packit ae235b
 * G_TYPE_CHECK_INSTANCE_TYPE:
Packit ae235b
 * @instance: (nullable): Location of a #GTypeInstance structure.
Packit ae235b
 * @g_type: The type to be checked
Packit ae235b
 * 
Packit ae235b
 * Checks if @instance is an instance of the type identified by @g_type. If
Packit ae235b
 * @instance is %NULL, %FALSE will be returned.
Packit ae235b
 * 
Packit ae235b
 * This macro should only be used in type implementations.
Packit ae235b
 *
Packit ae235b
 * Returns: %TRUE on success
Packit ae235b
 */
Packit ae235b
#define G_TYPE_CHECK_INSTANCE_TYPE(instance, g_type)            (_G_TYPE_CIT ((instance), (g_type)))
Packit ae235b
/**
Packit ae235b
 * G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE:
Packit ae235b
 * @instance: (nullable): Location of a #GTypeInstance structure.
Packit ae235b
 * @g_type: The fundamental type to be checked
Packit ae235b
 *
Packit ae235b
 * Checks if @instance is an instance of the fundamental type identified by @g_type.
Packit ae235b
 * If @instance is %NULL, %FALSE will be returned.
Packit ae235b
 *
Packit ae235b
 * This macro should only be used in type implementations.
Packit ae235b
 *
Packit ae235b
 * Returns: %TRUE on success
Packit ae235b
 */
Packit ae235b
#define G_TYPE_CHECK_INSTANCE_FUNDAMENTAL_TYPE(instance, g_type)            (_G_TYPE_CIFT ((instance), (g_type)))
Packit ae235b
/**
Packit ae235b
 * G_TYPE_INSTANCE_GET_CLASS:
Packit ae235b
 * @instance: Location of the #GTypeInstance structure
Packit ae235b
 * @g_type: The #GType of the class to be returned
Packit ae235b
 * @c_type: The C type of the class structure
Packit ae235b
 * 
Packit ae235b
 * Get the class structure of a given @instance, casted
Packit ae235b
 * to a specified ancestor type @g_type of the instance.
Packit ae235b
 * 
Packit ae235b
 * Note that while calling a GInstanceInitFunc(), the class pointer
Packit ae235b
 * gets modified, so it might not always return the expected pointer.
Packit ae235b
 * 
Packit ae235b
 * This macro should only be used in type implementations.
Packit ae235b
 *
Packit ae235b
 * Returns: a pointer to the class structure
Packit ae235b
 */
Packit ae235b
#define G_TYPE_INSTANCE_GET_CLASS(instance, g_type, c_type)     (_G_TYPE_IGC ((instance), (g_type), c_type))
Packit ae235b
/**
Packit ae235b
 * G_TYPE_INSTANCE_GET_INTERFACE:
Packit ae235b
 * @instance: Location of the #GTypeInstance structure
Packit ae235b
 * @g_type: The #GType of the interface to be returned
Packit ae235b
 * @c_type: The C type of the interface structure
Packit ae235b
 * 
Packit ae235b
 * Get the interface structure for interface @g_type of a given @instance.
Packit ae235b
 * 
Packit ae235b
 * This macro should only be used in type implementations.
Packit ae235b
 *
Packit ae235b
 * Returns: a pointer to the interface structure
Packit ae235b
 */
Packit ae235b
#define G_TYPE_INSTANCE_GET_INTERFACE(instance, g_type, c_type) (_G_TYPE_IGI ((instance), (g_type), c_type))
Packit ae235b
/**
Packit ae235b
 * G_TYPE_CHECK_CLASS_CAST:
Packit ae235b
 * @g_class: Location of a #GTypeClass structure
Packit ae235b
 * @g_type: The type to be returned
Packit ae235b
 * @c_type: The corresponding C type of class structure of @g_type
Packit ae235b
 * 
Packit ae235b
 * Checks that @g_class is a class structure of the type identified by @g_type
Packit ae235b
 * and issues a warning if this is not the case. Returns @g_class casted 
Packit ae235b
 * to a pointer to @c_type. %NULL is not a valid class structure.
Packit ae235b
 * 
Packit ae235b
 * This macro should only be used in type implementations.
Packit ae235b
 */
Packit ae235b
#define G_TYPE_CHECK_CLASS_CAST(g_class, g_type, c_type)        (_G_TYPE_CCC ((g_class), (g_type), c_type))
Packit ae235b
/**
Packit ae235b
 * G_TYPE_CHECK_CLASS_TYPE:
Packit ae235b
 * @g_class: (nullable): Location of a #GTypeClass structure
Packit ae235b
 * @g_type: The type to be checked
Packit ae235b
 * 
Packit ae235b
 * Checks if @g_class is a class structure of the type identified by 
Packit ae235b
 * @g_type. If @g_class is %NULL, %FALSE will be returned.
Packit ae235b
 * 
Packit ae235b
 * This macro should only be used in type implementations.
Packit ae235b
 *
Packit ae235b
 * Returns: %TRUE on success
Packit ae235b
 */
Packit ae235b
#define G_TYPE_CHECK_CLASS_TYPE(g_class, g_type)                (_G_TYPE_CCT ((g_class), (g_type)))
Packit ae235b
/**
Packit ae235b
 * G_TYPE_CHECK_VALUE:
Packit ae235b
 * @value: a #GValue
Packit ae235b
 * 
Packit ae235b
 * Checks if @value has been initialized to hold values
Packit ae235b
 * of a value type.
Packit ae235b
 * 
Packit ae235b
 * This macro should only be used in type implementations.
Packit ae235b
 *
Packit ae235b
 * Returns: %TRUE on success
Packit ae235b
 */
Packit ae235b
#define G_TYPE_CHECK_VALUE(value)				(_G_TYPE_CHV ((value)))
Packit ae235b
/**
Packit ae235b
 * G_TYPE_CHECK_VALUE_TYPE:
Packit ae235b
 * @value: a #GValue
Packit ae235b
 * @g_type: The type to be checked
Packit ae235b
 * 
Packit ae235b
 * Checks if @value has been initialized to hold values
Packit ae235b
 * of type @g_type. 
Packit ae235b
 * 
Packit ae235b
 * This macro should only be used in type implementations.
Packit ae235b
 *
Packit ae235b
 * Returns: %TRUE on success
Packit ae235b
 */
Packit ae235b
#define G_TYPE_CHECK_VALUE_TYPE(value, g_type)			(_G_TYPE_CVH ((value), (g_type)))
Packit ae235b
/**
Packit ae235b
 * G_TYPE_FROM_INSTANCE:
Packit ae235b
 * @instance: Location of a valid #GTypeInstance structure
Packit ae235b
 * 
Packit ae235b
 * Get the type identifier from a given @instance structure. 
Packit ae235b
 * 
Packit ae235b
 * This macro should only be used in type implementations.
Packit ae235b
 *
Packit ae235b
 * Returns: the #GType
Packit ae235b
 */
Packit ae235b
#define G_TYPE_FROM_INSTANCE(instance)                          (G_TYPE_FROM_CLASS (((GTypeInstance*) (instance))->g_class))
Packit ae235b
/**
Packit ae235b
 * G_TYPE_FROM_CLASS:
Packit ae235b
 * @g_class: Location of a valid #GTypeClass structure
Packit ae235b
 * 
Packit ae235b
 * Get the type identifier from a given @class structure.
Packit ae235b
 * 
Packit ae235b
 * This macro should only be used in type implementations.
Packit ae235b
 *
Packit ae235b
 * Returns: the #GType
Packit ae235b
 */
Packit ae235b
#define G_TYPE_FROM_CLASS(g_class)                              (((GTypeClass*) (g_class))->g_type)
Packit ae235b
/**
Packit ae235b
 * G_TYPE_FROM_INTERFACE:
Packit ae235b
 * @g_iface: Location of a valid #GTypeInterface structure
Packit ae235b
 * 
Packit ae235b
 * Get the type identifier from a given @interface structure.
Packit ae235b
 * 
Packit ae235b
 * This macro should only be used in type implementations.
Packit ae235b
 *
Packit ae235b
 * Returns: the #GType
Packit ae235b
 */
Packit ae235b
#define G_TYPE_FROM_INTERFACE(g_iface)                          (((GTypeInterface*) (g_iface))->g_type)
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * G_TYPE_INSTANCE_GET_PRIVATE:
Packit ae235b
 * @instance: the instance of a type deriving from @private_type
Packit ae235b
 * @g_type: the type identifying which private data to retrieve
Packit ae235b
 * @c_type: The C type for the private structure
Packit ae235b
 * 
Packit ae235b
 * Gets the private structure for a particular type.
Packit ae235b
 * The private structure must have been registered in the
Packit ae235b
 * class_init function with g_type_class_add_private().
Packit ae235b
 * 
Packit ae235b
 * This macro should only be used in type implementations.
Packit ae235b
 * 
Packit ae235b
 * Since: 2.4
Packit ae235b
 * Returns: (not nullable): a pointer to the private data structure
Packit ae235b
 */
Packit ae235b
#define G_TYPE_INSTANCE_GET_PRIVATE(instance, g_type, c_type)   ((c_type*) g_type_instance_get_private ((GTypeInstance*) (instance), (g_type)))
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * G_TYPE_CLASS_GET_PRIVATE:
Packit ae235b
 * @klass: the class of a type deriving from @private_type
Packit ae235b
 * @g_type: the type identifying which private data to retrieve
Packit ae235b
 * @c_type: The C type for the private structure
Packit ae235b
 * 
Packit ae235b
 * Gets the private class structure for a particular type.
Packit ae235b
 * The private structure must have been registered in the
Packit ae235b
 * get_type() function with g_type_add_class_private().
Packit ae235b
 * 
Packit ae235b
 * This macro should only be used in type implementations.
Packit ae235b
 * 
Packit ae235b
 * Since: 2.24
Packit ae235b
 * Returns: (not nullable): a pointer to the private data structure
Packit ae235b
 */
Packit ae235b
#define G_TYPE_CLASS_GET_PRIVATE(klass, g_type, c_type)   ((c_type*) g_type_class_get_private ((GTypeClass*) (klass), (g_type)))
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * GTypeDebugFlags:
Packit ae235b
 * @G_TYPE_DEBUG_NONE: Print no messages
Packit ae235b
 * @G_TYPE_DEBUG_OBJECTS: Print messages about object bookkeeping
Packit ae235b
 * @G_TYPE_DEBUG_SIGNALS: Print messages about signal emissions
Packit ae235b
 * @G_TYPE_DEBUG_MASK: Mask covering all debug flags
Packit ae235b
 * @G_TYPE_DEBUG_INSTANCE_COUNT: Keep a count of instances of each type
Packit ae235b
 *
Packit ae235b
 * These flags used to be passed to g_type_init_with_debug_flags() which
Packit ae235b
 * is now deprecated.
Packit ae235b
 *
Packit ae235b
 * If you need to enable debugging features, use the GOBJECT_DEBUG
Packit ae235b
 * environment variable.
Packit ae235b
 *
Packit ae235b
 * Deprecated: 2.36: g_type_init() is now done automatically
Packit ae235b
 */
Packit ae235b
typedef enum	/*< skip >*/
Packit ae235b
{
Packit ae235b
  G_TYPE_DEBUG_NONE	= 0,
Packit ae235b
  G_TYPE_DEBUG_OBJECTS	= 1 << 0,
Packit ae235b
  G_TYPE_DEBUG_SIGNALS	= 1 << 1,
Packit ae235b
  G_TYPE_DEBUG_INSTANCE_COUNT = 1 << 2,
Packit ae235b
  G_TYPE_DEBUG_MASK	= 0x07
Packit ae235b
} GTypeDebugFlags;
Packit ae235b
Packit ae235b
Packit ae235b
/* --- prototypes --- */
Packit ae235b
GLIB_DEPRECATED_IN_2_36
Packit ae235b
void                  g_type_init                    (void);
Packit ae235b
GLIB_DEPRECATED_IN_2_36
Packit ae235b
void                  g_type_init_with_debug_flags   (GTypeDebugFlags  debug_flags);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
const gchar *         g_type_name                    (GType            type);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GQuark                g_type_qname                   (GType            type);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GType                 g_type_from_name               (const gchar     *name);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GType                 g_type_parent                  (GType            type);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
guint                 g_type_depth                   (GType            type);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GType                 g_type_next_base               (GType            leaf_type,
Packit ae235b
						      GType            root_type);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean              g_type_is_a                    (GType            type,
Packit ae235b
						      GType            is_a_type);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gpointer              g_type_class_ref               (GType            type);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gpointer              g_type_class_peek              (GType            type);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gpointer              g_type_class_peek_static       (GType            type);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void                  g_type_class_unref             (gpointer         g_class);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gpointer              g_type_class_peek_parent       (gpointer         g_class);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gpointer              g_type_interface_peek          (gpointer         instance_class,
Packit ae235b
						      GType            iface_type);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gpointer              g_type_interface_peek_parent   (gpointer         g_iface);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gpointer              g_type_default_interface_ref   (GType            g_type);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gpointer              g_type_default_interface_peek  (GType            g_type);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void                  g_type_default_interface_unref (gpointer         g_iface);
Packit ae235b
Packit ae235b
/* g_free() the returned arrays */
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GType*                g_type_children                (GType            type,
Packit ae235b
						      guint           *n_children);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GType*                g_type_interfaces              (GType            type,
Packit ae235b
						      guint           *n_interfaces);
Packit ae235b
Packit ae235b
/* per-type _static_ data */
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void                  g_type_set_qdata               (GType            type,
Packit ae235b
						      GQuark           quark,
Packit ae235b
						      gpointer         data);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gpointer              g_type_get_qdata               (GType            type,
Packit ae235b
						      GQuark           quark);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void		      g_type_query		     (GType	       type,
Packit ae235b
						      GTypeQuery      *query);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_2_44
Packit ae235b
int                   g_type_get_instance_count      (GType            type);
Packit ae235b
Packit ae235b
/* --- type registration --- */
Packit ae235b
/**
Packit ae235b
 * GBaseInitFunc:
Packit ae235b
 * @g_class: (type GObject.TypeClass): The #GTypeClass structure to initialize
Packit ae235b
 * 
Packit ae235b
 * A callback function used by the type system to do base initialization
Packit ae235b
 * of the class structures of derived types. It is called as part of the
Packit ae235b
 * initialization process of all derived classes and should reallocate
Packit ae235b
 * or reset all dynamic class members copied over from the parent class.
Packit ae235b
 * For example, class members (such as strings) that are not sufficiently
Packit ae235b
 * handled by a plain memory copy of the parent class into the derived class
Packit ae235b
 * have to be altered. See GClassInitFunc() for a discussion of the class
Packit ae235b
 * initialization process.
Packit ae235b
 */
Packit ae235b
typedef void   (*GBaseInitFunc)              (gpointer         g_class);
Packit ae235b
/**
Packit ae235b
 * GBaseFinalizeFunc:
Packit ae235b
 * @g_class: (type GObject.TypeClass): The #GTypeClass structure to finalize
Packit ae235b
 * 
Packit ae235b
 * A callback function used by the type system to finalize those portions
Packit ae235b
 * of a derived types class structure that were setup from the corresponding
Packit ae235b
 * GBaseInitFunc() function. Class finalization basically works the inverse
Packit ae235b
 * way in which class initialization is performed.
Packit ae235b
 * See GClassInitFunc() for a discussion of the class initialization process.
Packit ae235b
 */
Packit ae235b
typedef void   (*GBaseFinalizeFunc)          (gpointer         g_class);
Packit ae235b
/**
Packit ae235b
 * GClassInitFunc:
Packit ae235b
 * @g_class: (type GObject.TypeClass): The #GTypeClass structure to initialize.
Packit ae235b
 * @class_data: The @class_data member supplied via the #GTypeInfo structure.
Packit ae235b
 * 
Packit ae235b
 * A callback function used by the type system to initialize the class
Packit ae235b
 * of a specific type. This function should initialize all static class
Packit ae235b
 * members.
Packit ae235b
 *
Packit ae235b
 * The initialization process of a class involves:
Packit ae235b
 * 
Packit ae235b
 * - Copying common members from the parent class over to the
Packit ae235b
 *   derived class structure.
Packit ae235b
 * - Zero initialization of the remaining members not copied
Packit ae235b
 *   over from the parent class.
Packit ae235b
 * - Invocation of the GBaseInitFunc() initializers of all parent
Packit ae235b
 *   types and the class' type.
Packit ae235b
 * - Invocation of the class' GClassInitFunc() initializer.
Packit ae235b
 *
Packit ae235b
 * Since derived classes are partially initialized through a memory copy
Packit ae235b
 * of the parent class, the general rule is that GBaseInitFunc() and
Packit ae235b
 * GBaseFinalizeFunc() should take care of necessary reinitialization
Packit ae235b
 * and release of those class members that were introduced by the type
Packit ae235b
 * that specified these GBaseInitFunc()/GBaseFinalizeFunc().
Packit ae235b
 * GClassInitFunc() should only care about initializing static
Packit ae235b
 * class members, while dynamic class members (such as allocated strings
Packit ae235b
 * or reference counted resources) are better handled by a GBaseInitFunc()
Packit ae235b
 * for this type, so proper initialization of the dynamic class members
Packit ae235b
 * is performed for class initialization of derived types as well.
Packit ae235b
 *
Packit ae235b
 * An example may help to correspond the intend of the different class
Packit ae235b
 * initializers:
Packit ae235b
 * 
Packit ae235b
 * |[
Packit ae235b
 * typedef struct {
Packit ae235b
 *   GObjectClass parent_class;
Packit ae235b
 *   gint         static_integer;
Packit ae235b
 *   gchar       *dynamic_string;
Packit ae235b
 * } TypeAClass;
Packit ae235b
 * static void
Packit ae235b
 * type_a_base_class_init (TypeAClass *class)
Packit ae235b
 * {
Packit ae235b
 *   class->dynamic_string = g_strdup ("some string");
Packit ae235b
 * }
Packit ae235b
 * static void
Packit ae235b
 * type_a_base_class_finalize (TypeAClass *class)
Packit ae235b
 * {
Packit ae235b
 *   g_free (class->dynamic_string);
Packit ae235b
 * }
Packit ae235b
 * static void
Packit ae235b
 * type_a_class_init (TypeAClass *class)
Packit ae235b
 * {
Packit ae235b
 *   class->static_integer = 42;
Packit ae235b
 * }
Packit ae235b
 * 
Packit ae235b
 * typedef struct {
Packit ae235b
 *   TypeAClass   parent_class;
Packit ae235b
 *   gfloat       static_float;
Packit ae235b
 *   GString     *dynamic_gstring;
Packit ae235b
 * } TypeBClass;
Packit ae235b
 * static void
Packit ae235b
 * type_b_base_class_init (TypeBClass *class)
Packit ae235b
 * {
Packit ae235b
 *   class->dynamic_gstring = g_string_new ("some other string");
Packit ae235b
 * }
Packit ae235b
 * static void
Packit ae235b
 * type_b_base_class_finalize (TypeBClass *class)
Packit ae235b
 * {
Packit ae235b
 *   g_string_free (class->dynamic_gstring);
Packit ae235b
 * }
Packit ae235b
 * static void
Packit ae235b
 * type_b_class_init (TypeBClass *class)
Packit ae235b
 * {
Packit ae235b
 *   class->static_float = 3.14159265358979323846;
Packit ae235b
 * }
Packit ae235b
 * ]|
Packit ae235b
 * Initialization of TypeBClass will first cause initialization of
Packit ae235b
 * TypeAClass (derived classes reference their parent classes, see
Packit ae235b
 * g_type_class_ref() on this).
Packit ae235b
 *
Packit ae235b
 * Initialization of TypeAClass roughly involves zero-initializing its fields,
Packit ae235b
 * then calling its GBaseInitFunc() type_a_base_class_init() to allocate
Packit ae235b
 * its dynamic members (dynamic_string), and finally calling its GClassInitFunc()
Packit ae235b
 * type_a_class_init() to initialize its static members (static_integer).
Packit ae235b
 * The first step in the initialization process of TypeBClass is then
Packit ae235b
 * a plain memory copy of the contents of TypeAClass into TypeBClass and 
Packit ae235b
 * zero-initialization of the remaining fields in TypeBClass.
Packit ae235b
 * The dynamic members of TypeAClass within TypeBClass now need
Packit ae235b
 * reinitialization which is performed by calling type_a_base_class_init()
Packit ae235b
 * with an argument of TypeBClass.
Packit ae235b
 *
Packit ae235b
 * After that, the GBaseInitFunc() of TypeBClass, type_b_base_class_init()
Packit ae235b
 * is called to allocate the dynamic members of TypeBClass (dynamic_gstring),
Packit ae235b
 * and finally the GClassInitFunc() of TypeBClass, type_b_class_init(),
Packit ae235b
 * is called to complete the initialization process with the static members
Packit ae235b
 * (static_float).
Packit ae235b
 *
Packit ae235b
 * Corresponding finalization counter parts to the GBaseInitFunc() functions
Packit ae235b
 * have to be provided to release allocated resources at class finalization
Packit ae235b
 * time.
Packit ae235b
 */
Packit ae235b
typedef void   (*GClassInitFunc)             (gpointer         g_class,
Packit ae235b
					      gpointer         class_data);
Packit ae235b
/**
Packit ae235b
 * GClassFinalizeFunc:
Packit ae235b
 * @g_class: (type GObject.TypeClass): The #GTypeClass structure to finalize
Packit ae235b
 * @class_data: The @class_data member supplied via the #GTypeInfo structure
Packit ae235b
 * 
Packit ae235b
 * A callback function used by the type system to finalize a class.
Packit ae235b
 * This function is rarely needed, as dynamically allocated class resources
Packit ae235b
 * should be handled by GBaseInitFunc() and GBaseFinalizeFunc().
Packit ae235b
 * Also, specification of a GClassFinalizeFunc() in the #GTypeInfo
Packit ae235b
 * structure of a static type is invalid, because classes of static types
Packit ae235b
 * will never be finalized (they are artificially kept alive when their
Packit ae235b
 * reference count drops to zero).
Packit ae235b
 */
Packit ae235b
typedef void   (*GClassFinalizeFunc)         (gpointer         g_class,
Packit ae235b
					      gpointer         class_data);
Packit ae235b
/**
Packit ae235b
 * GInstanceInitFunc:
Packit ae235b
 * @instance: The instance to initialize
Packit ae235b
 * @g_class: (type GObject.TypeClass): The class of the type the instance is
Packit ae235b
 *    created for
Packit ae235b
 * 
Packit ae235b
 * A callback function used by the type system to initialize a new
Packit ae235b
 * instance of a type. This function initializes all instance members and
Packit ae235b
 * allocates any resources required by it.
Packit ae235b
 *
Packit ae235b
 * Initialization of a derived instance involves calling all its parent
Packit ae235b
 * types instance initializers, so the class member of the instance
Packit ae235b
 * is altered during its initialization to always point to the class that
Packit ae235b
 * belongs to the type the current initializer was introduced for.
Packit ae235b
 *
Packit ae235b
 * The extended members of @instance are guaranteed to have been filled with
Packit ae235b
 * zeros before this function is called.
Packit ae235b
 */
Packit ae235b
typedef void   (*GInstanceInitFunc)          (GTypeInstance   *instance,
Packit ae235b
					      gpointer         g_class);
Packit ae235b
/**
Packit ae235b
 * GInterfaceInitFunc:
Packit ae235b
 * @g_iface: (type GObject.TypeInterface): The interface structure to initialize
Packit ae235b
 * @iface_data: The @interface_data supplied via the #GInterfaceInfo structure
Packit ae235b
 * 
Packit ae235b
 * A callback function used by the type system to initialize a new
Packit ae235b
 * interface.  This function should initialize all internal data and
Packit ae235b
 * allocate any resources required by the interface.
Packit ae235b
 *
Packit ae235b
 * The members of @iface_data are guaranteed to have been filled with
Packit ae235b
 * zeros before this function is called.
Packit ae235b
 */
Packit ae235b
typedef void   (*GInterfaceInitFunc)         (gpointer         g_iface,
Packit ae235b
					      gpointer         iface_data);
Packit ae235b
/**
Packit ae235b
 * GInterfaceFinalizeFunc:
Packit ae235b
 * @g_iface: (type GObject.TypeInterface): The interface structure to finalize
Packit ae235b
 * @iface_data: The @interface_data supplied via the #GInterfaceInfo structure
Packit ae235b
 * 
Packit ae235b
 * A callback function used by the type system to finalize an interface.
Packit ae235b
 * This function should destroy any internal data and release any resources
Packit ae235b
 * allocated by the corresponding GInterfaceInitFunc() function.
Packit ae235b
 */
Packit ae235b
typedef void   (*GInterfaceFinalizeFunc)     (gpointer         g_iface,
Packit ae235b
					      gpointer         iface_data);
Packit ae235b
/**
Packit ae235b
 * GTypeClassCacheFunc:
Packit ae235b
 * @cache_data: data that was given to the g_type_add_class_cache_func() call
Packit ae235b
 * @g_class: (type GObject.TypeClass): The #GTypeClass structure which is
Packit ae235b
 *    unreferenced
Packit ae235b
 * 
Packit ae235b
 * A callback function which is called when the reference count of a class 
Packit ae235b
 * drops to zero. It may use g_type_class_ref() to prevent the class from
Packit ae235b
 * being freed. You should not call g_type_class_unref() from a 
Packit ae235b
 * #GTypeClassCacheFunc function to prevent infinite recursion, use 
Packit ae235b
 * g_type_class_unref_uncached() instead.
Packit ae235b
 * 
Packit ae235b
 * The functions have to check the class id passed in to figure 
Packit ae235b
 * whether they actually want to cache the class of this type, since all
Packit ae235b
 * classes are routed through the same #GTypeClassCacheFunc chain.
Packit ae235b
 * 
Packit ae235b
 * Returns: %TRUE to stop further #GTypeClassCacheFuncs from being 
Packit ae235b
 *  called, %FALSE to continue
Packit ae235b
 */
Packit ae235b
typedef gboolean (*GTypeClassCacheFunc)	     (gpointer	       cache_data,
Packit ae235b
					      GTypeClass      *g_class);
Packit ae235b
/**
Packit ae235b
 * GTypeInterfaceCheckFunc:
Packit ae235b
 * @check_data: data passed to g_type_add_interface_check()
Packit ae235b
 * @g_iface: (type GObject.TypeInterface): the interface that has been
Packit ae235b
 *    initialized
Packit ae235b
 * 
Packit ae235b
 * A callback called after an interface vtable is initialized.
Packit ae235b
 * See g_type_add_interface_check().
Packit ae235b
 * 
Packit ae235b
 * Since: 2.4
Packit ae235b
 */
Packit ae235b
typedef void     (*GTypeInterfaceCheckFunc)  (gpointer	       check_data,
Packit ae235b
					      gpointer         g_iface);
Packit ae235b
/**
Packit ae235b
 * GTypeFundamentalFlags:
Packit ae235b
 * @G_TYPE_FLAG_CLASSED: Indicates a classed type
Packit ae235b
 * @G_TYPE_FLAG_INSTANTIATABLE: Indicates an instantiable type (implies classed)
Packit ae235b
 * @G_TYPE_FLAG_DERIVABLE: Indicates a flat derivable type
Packit ae235b
 * @G_TYPE_FLAG_DEEP_DERIVABLE: Indicates a deep derivable type (implies derivable)
Packit ae235b
 * 
Packit ae235b
 * Bit masks used to check or determine specific characteristics of a
Packit ae235b
 * fundamental type.
Packit ae235b
 */
Packit ae235b
typedef enum    /*< skip >*/
Packit ae235b
{
Packit ae235b
  G_TYPE_FLAG_CLASSED           = (1 << 0),
Packit ae235b
  G_TYPE_FLAG_INSTANTIATABLE    = (1 << 1),
Packit ae235b
  G_TYPE_FLAG_DERIVABLE         = (1 << 2),
Packit ae235b
  G_TYPE_FLAG_DEEP_DERIVABLE    = (1 << 3)
Packit ae235b
} GTypeFundamentalFlags;
Packit ae235b
/**
Packit ae235b
 * GTypeFlags:
Packit ae235b
 * @G_TYPE_FLAG_ABSTRACT: Indicates an abstract type. No instances can be
Packit ae235b
 *  created for an abstract type
Packit ae235b
 * @G_TYPE_FLAG_VALUE_ABSTRACT: Indicates an abstract value type, i.e. a type
Packit ae235b
 *  that introduces a value table, but can't be used for
Packit ae235b
 *  g_value_init()
Packit ae235b
 * 
Packit ae235b
 * Bit masks used to check or determine characteristics of a type.
Packit ae235b
 */
Packit ae235b
typedef enum    /*< skip >*/
Packit ae235b
{
Packit ae235b
  G_TYPE_FLAG_ABSTRACT		= (1 << 4),
Packit ae235b
  G_TYPE_FLAG_VALUE_ABSTRACT	= (1 << 5)
Packit ae235b
} GTypeFlags;
Packit ae235b
/**
Packit ae235b
 * GTypeInfo:
Packit ae235b
 * @class_size: Size of the class structure (required for interface, classed and instantiatable types)
Packit ae235b
 * @base_init: Location of the base initialization function (optional)
Packit ae235b
 * @base_finalize: Location of the base finalization function (optional)
Packit ae235b
 * @class_init: Location of the class initialization function for
Packit ae235b
 *  classed and instantiatable types. Location of the default vtable 
Packit ae235b
 *  inititalization function for interface types. (optional) This function 
Packit ae235b
 *  is used both to fill in virtual functions in the class or default vtable, 
Packit ae235b
 *  and to do type-specific setup such as registering signals and object
Packit ae235b
 *  properties.
Packit ae235b
 * @class_finalize: Location of the class finalization function for
Packit ae235b
 *  classed and instantiatable types. Location of the default vtable
Packit ae235b
 *  finalization function for interface types. (optional)
Packit ae235b
 * @class_data: User-supplied data passed to the class init/finalize functions
Packit ae235b
 * @instance_size: Size of the instance (object) structure (required for instantiatable types only)
Packit ae235b
 * @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.
Packit ae235b
 * @instance_init: Location of the instance initialization function (optional, for instantiatable types only)
Packit ae235b
 * @value_table: A #GTypeValueTable function table for generic handling of GValues
Packit ae235b
 *  of this type (usually only useful for fundamental types)
Packit ae235b
 * 
Packit ae235b
 * This structure is used to provide the type system with the information
Packit ae235b
 * required to initialize and destruct (finalize) a type's class and
Packit ae235b
 * its instances.
Packit ae235b
 *
Packit ae235b
 * The initialized structure is passed to the g_type_register_static() function
Packit ae235b
 * (or is copied into the provided #GTypeInfo structure in the
Packit ae235b
 * g_type_plugin_complete_type_info()). The type system will perform a deep
Packit ae235b
 * copy of this structure, so its memory does not need to be persistent
Packit ae235b
 * across invocation of g_type_register_static().
Packit ae235b
 */
Packit ae235b
struct _GTypeInfo
Packit ae235b
{
Packit ae235b
  /* interface types, classed types, instantiated types */
Packit ae235b
  guint16                class_size;
Packit ae235b
  
Packit ae235b
  GBaseInitFunc          base_init;
Packit ae235b
  GBaseFinalizeFunc      base_finalize;
Packit ae235b
  
Packit ae235b
  /* interface types, classed types, instantiated types */
Packit ae235b
  GClassInitFunc         class_init;
Packit ae235b
  GClassFinalizeFunc     class_finalize;
Packit ae235b
  gconstpointer          class_data;
Packit ae235b
  
Packit ae235b
  /* instantiated types */
Packit ae235b
  guint16                instance_size;
Packit ae235b
  guint16                n_preallocs;
Packit ae235b
  GInstanceInitFunc      instance_init;
Packit ae235b
  
Packit ae235b
  /* value handling */
Packit ae235b
  const GTypeValueTable	*value_table;
Packit ae235b
};
Packit ae235b
/**
Packit ae235b
 * GTypeFundamentalInfo:
Packit ae235b
 * @type_flags: #GTypeFundamentalFlags describing the characteristics of the fundamental type
Packit ae235b
 * 
Packit ae235b
 * A structure that provides information to the type system which is
Packit ae235b
 * used specifically for managing fundamental types.  
Packit ae235b
 */
Packit ae235b
struct _GTypeFundamentalInfo
Packit ae235b
{
Packit ae235b
  GTypeFundamentalFlags  type_flags;
Packit ae235b
};
Packit ae235b
/**
Packit ae235b
 * GInterfaceInfo:
Packit ae235b
 * @interface_init: location of the interface initialization function
Packit ae235b
 * @interface_finalize: location of the interface finalization function
Packit ae235b
 * @interface_data: user-supplied data passed to the interface init/finalize functions
Packit ae235b
 * 
Packit ae235b
 * A structure that provides information to the type system which is
Packit ae235b
 * used specifically for managing interface types.
Packit ae235b
 */
Packit ae235b
struct _GInterfaceInfo
Packit ae235b
{
Packit ae235b
  GInterfaceInitFunc     interface_init;
Packit ae235b
  GInterfaceFinalizeFunc interface_finalize;
Packit ae235b
  gpointer               interface_data;
Packit ae235b
};
Packit ae235b
/**
Packit ae235b
 * GTypeValueTable:
Packit ae235b
 * @value_init: Default initialize @values contents by poking values
Packit ae235b
 *  directly into the value->data array. The data array of
Packit ae235b
 *  the #GValue passed into this function was zero-filled
Packit ae235b
 *  with `memset()`, so no care has to be taken to free any
Packit ae235b
 *  old contents. E.g. for the implementation of a string
Packit ae235b
 *  value that may never be %NULL, the implementation might
Packit ae235b
 *  look like:
Packit ae235b
 *  |[
Packit ae235b
 *  value->data[0].v_pointer = g_strdup ("");
Packit ae235b
 *  ]|
Packit ae235b
 * @value_free: Free any old contents that might be left in the
Packit ae235b
 *  data array of the passed in @value. No resources may
Packit ae235b
 *  remain allocated through the #GValue contents after
Packit ae235b
 *  this function returns. E.g. for our above string type:
Packit ae235b
 *  |[
Packit ae235b
 *  // only free strings without a specific flag for static storage
Packit ae235b
 *  if (!(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS))
Packit ae235b
 *    g_free (value->data[0].v_pointer);
Packit ae235b
 *  ]|
Packit ae235b
 * @value_copy: @dest_value is a #GValue with zero-filled data section
Packit ae235b
 *  and @src_value is a properly setup #GValue of same or
Packit ae235b
 *  derived type.
Packit ae235b
 *  The purpose of this function is to copy the contents of
Packit ae235b
 *  @src_value into @dest_value in a way, that even after
Packit ae235b
 *  @src_value has been freed, the contents of @dest_value
Packit ae235b
 *  remain valid. String type example:
Packit ae235b
 *  |[
Packit ae235b
 *  dest_value->data[0].v_pointer = g_strdup (src_value->data[0].v_pointer);
Packit ae235b
 *  ]|
Packit ae235b
 * @value_peek_pointer: If the value contents fit into a pointer, such as objects
Packit ae235b
 *  or strings, return this pointer, so the caller can peek at
Packit ae235b
 *  the current contents. To extend on our above string example:
Packit ae235b
 *  |[
Packit ae235b
 *  return value->data[0].v_pointer;
Packit ae235b
 *  ]|
Packit ae235b
 * @collect_format: A string format describing how to collect the contents of
Packit ae235b
 *  this value bit-by-bit. Each character in the format represents
Packit ae235b
 *  an argument to be collected, and the characters themselves indicate
Packit ae235b
 *  the type of the argument. Currently supported arguments are:
Packit ae235b
 *  - 'i' - Integers. passed as collect_values[].v_int.
Packit ae235b
 *  - 'l' - Longs. passed as collect_values[].v_long.
Packit ae235b
 *  - 'd' - Doubles. passed as collect_values[].v_double.
Packit ae235b
 *  - 'p' - Pointers. passed as collect_values[].v_pointer.
Packit ae235b
 *  It should be noted that for variable argument list construction,
Packit ae235b
 *  ANSI C promotes every type smaller than an integer to an int, and
Packit ae235b
 *  floats to doubles. So for collection of short int or char, 'i'
Packit ae235b
 *  needs to be used, and for collection of floats 'd'.
Packit ae235b
 * @collect_value: The collect_value() function is responsible for converting the
Packit ae235b
 *  values collected from a variable argument list into contents
Packit ae235b
 *  suitable for storage in a GValue. This function should setup
Packit ae235b
 *  @value similar to value_init(); e.g. for a string value that
Packit ae235b
 *  does not allow %NULL pointers, it needs to either spew an error,
Packit ae235b
 *  or do an implicit conversion by storing an empty string.
Packit ae235b
 *  The @value passed in to this function has a zero-filled data
Packit ae235b
 *  array, so just like for value_init() it is guaranteed to not
Packit ae235b
 *  contain any old contents that might need freeing.
Packit ae235b
 *  @n_collect_values is exactly the string length of @collect_format,
Packit ae235b
 *  and @collect_values is an array of unions #GTypeCValue with
Packit ae235b
 *  length @n_collect_values, containing the collected values
Packit ae235b
 *  according to @collect_format.
Packit ae235b
 *  @collect_flags is an argument provided as a hint by the caller.
Packit ae235b
 *  It may contain the flag %G_VALUE_NOCOPY_CONTENTS indicating,
Packit ae235b
 *  that the collected value contents may be considered "static"
Packit ae235b
 *  for the duration of the @value lifetime.
Packit ae235b
 *  Thus an extra copy of the contents stored in @collect_values is
Packit ae235b
 *  not required for assignment to @value.
Packit ae235b
 *  For our above string example, we continue with:
Packit ae235b
 *  |[
Packit ae235b
 *  if (!collect_values[0].v_pointer)
Packit ae235b
 *    value->data[0].v_pointer = g_strdup ("");
Packit ae235b
 *  else if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
Packit ae235b
 *  {
Packit ae235b
 *    value->data[0].v_pointer = collect_values[0].v_pointer;
Packit ae235b
 *    // keep a flag for the value_free() implementation to not free this string
Packit ae235b
 *    value->data[1].v_uint = G_VALUE_NOCOPY_CONTENTS;
Packit ae235b
 *  }
Packit ae235b
 *  else
Packit ae235b
 *    value->data[0].v_pointer = g_strdup (collect_values[0].v_pointer);
Packit ae235b
 *  return NULL;
Packit ae235b
 *  ]|
Packit ae235b
 *  It should be noted, that it is generally a bad idea to follow the
Packit ae235b
 *  #G_VALUE_NOCOPY_CONTENTS hint for reference counted types. Due to
Packit ae235b
 *  reentrancy requirements and reference count assertions performed
Packit ae235b
 *  by the signal emission code, reference counts should always be
Packit ae235b
 *  incremented for reference counted contents stored in the value->data
Packit ae235b
 *  array.  To deviate from our string example for a moment, and taking
Packit ae235b
 *  a look at an exemplary implementation for collect_value() of
Packit ae235b
 *  #GObject:
Packit ae235b
 *  |[
Packit ae235b
 *  if (collect_values[0].v_pointer)
Packit ae235b
 *  {
Packit ae235b
 *    GObject *object = G_OBJECT (collect_values[0].v_pointer);
Packit ae235b
 *    // never honour G_VALUE_NOCOPY_CONTENTS for ref-counted types
Packit ae235b
 *    value->data[0].v_pointer = g_object_ref (object);
Packit ae235b
 *    return NULL;
Packit ae235b
 *  }
Packit ae235b
 *  else
Packit ae235b
 *    return g_strdup_printf ("Object passed as invalid NULL pointer");
Packit ae235b
 *  }
Packit ae235b
 *  ]|
Packit ae235b
 *  The reference count for valid objects is always incremented,
Packit ae235b
 *  regardless of @collect_flags. For invalid objects, the example
Packit ae235b
 *  returns a newly allocated string without altering @value.
Packit ae235b
 *  Upon success, collect_value() needs to return %NULL. If, however,
Packit ae235b
 *  an error condition occurred, collect_value() may spew an
Packit ae235b
 *  error by returning a newly allocated non-%NULL string, giving
Packit ae235b
 *  a suitable description of the error condition.
Packit ae235b
 *  The calling code makes no assumptions about the @value
Packit ae235b
 *  contents being valid upon error returns, @value
Packit ae235b
 *  is simply thrown away without further freeing. As such, it is
Packit ae235b
 *  a good idea to not allocate #GValue contents, prior to returning
Packit ae235b
 *  an error, however, collect_values() is not obliged to return
Packit ae235b
 *  a correctly setup @value for error returns, simply because
Packit ae235b
 *  any non-%NULL return is considered a fatal condition so further
Packit ae235b
 *  program behaviour is undefined.
Packit ae235b
 * @lcopy_format: Format description of the arguments to collect for @lcopy_value,
Packit ae235b
 *  analogous to @collect_format. Usually, @lcopy_format string consists
Packit ae235b
 *  only of 'p's to provide lcopy_value() with pointers to storage locations.
Packit ae235b
 * @lcopy_value: This function is responsible for storing the @value contents into
Packit ae235b
 *  arguments passed through a variable argument list which got
Packit ae235b
 *  collected into @collect_values according to @lcopy_format.
Packit ae235b
 *  @n_collect_values equals the string length of @lcopy_format,
Packit ae235b
 *  and @collect_flags may contain %G_VALUE_NOCOPY_CONTENTS.
Packit ae235b
 *  In contrast to collect_value(), lcopy_value() is obliged to
Packit ae235b
 *  always properly support %G_VALUE_NOCOPY_CONTENTS.
Packit ae235b
 *  Similar to collect_value() the function may prematurely abort
Packit ae235b
 *  by returning a newly allocated string describing an error condition.
Packit ae235b
 *  To complete the string example:
Packit ae235b
 *  |[
Packit ae235b
 *  gchar **string_p = collect_values[0].v_pointer;
Packit ae235b
 *  if (!string_p)
Packit ae235b
 *    return g_strdup_printf ("string location passed as NULL");
Packit ae235b
 *  if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
Packit ae235b
 *    *string_p = value->data[0].v_pointer;
Packit ae235b
 *  else
Packit ae235b
 *    *string_p = g_strdup (value->data[0].v_pointer);
Packit ae235b
 *  ]|
Packit ae235b
 *  And an illustrative version of lcopy_value() for
Packit ae235b
 *  reference-counted types:
Packit ae235b
 *  |[
Packit ae235b
 *  GObject **object_p = collect_values[0].v_pointer;
Packit ae235b
 *  if (!object_p)
Packit ae235b
 *    return g_strdup_printf ("object location passed as NULL");
Packit ae235b
 *  if (!value->data[0].v_pointer)
Packit ae235b
 *    *object_p = NULL;
Packit ae235b
 *  else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) // always honour
Packit ae235b
 *    *object_p = value->data[0].v_pointer;
Packit ae235b
 *  else
Packit ae235b
 *    *object_p = g_object_ref (value->data[0].v_pointer);
Packit ae235b
 *  return NULL;
Packit ae235b
 *  ]|
Packit ae235b
 * 
Packit ae235b
 * The #GTypeValueTable provides the functions required by the #GValue
Packit ae235b
 * implementation, to serve as a container for values of a type.
Packit ae235b
 */
Packit ae235b
Packit ae235b
struct _GTypeValueTable
Packit ae235b
{
Packit ae235b
  void     (*value_init)         (GValue       *value);
Packit ae235b
  void     (*value_free)         (GValue       *value);
Packit ae235b
  void     (*value_copy)         (const GValue *src_value,
Packit ae235b
				  GValue       *dest_value);
Packit ae235b
  /* varargs functionality (optional) */
Packit ae235b
  gpointer (*value_peek_pointer) (const GValue *value);
Packit ae235b
  const gchar *collect_format;
Packit ae235b
  gchar*   (*collect_value)      (GValue       *value,
Packit ae235b
				  guint         n_collect_values,
Packit ae235b
				  GTypeCValue  *collect_values,
Packit ae235b
				  guint		collect_flags);
Packit ae235b
  const gchar *lcopy_format;
Packit ae235b
  gchar*   (*lcopy_value)        (const GValue *value,
Packit ae235b
				  guint         n_collect_values,
Packit ae235b
				  GTypeCValue  *collect_values,
Packit ae235b
				  guint		collect_flags);
Packit ae235b
};
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GType g_type_register_static		(GType			     parent_type,
Packit ae235b
					 const gchar		    *type_name,
Packit ae235b
					 const GTypeInfo	    *info,
Packit ae235b
					 GTypeFlags		     flags);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GType g_type_register_static_simple     (GType                       parent_type,
Packit ae235b
					 const gchar                *type_name,
Packit ae235b
					 guint                       class_size,
Packit ae235b
					 GClassInitFunc              class_init,
Packit ae235b
					 guint                       instance_size,
Packit ae235b
					 GInstanceInitFunc           instance_init,
Packit ae235b
					 GTypeFlags	             flags);
Packit ae235b
  
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GType g_type_register_dynamic		(GType			     parent_type,
Packit ae235b
					 const gchar		    *type_name,
Packit ae235b
					 GTypePlugin		    *plugin,
Packit ae235b
					 GTypeFlags		     flags);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GType g_type_register_fundamental	(GType			     type_id,
Packit ae235b
					 const gchar		    *type_name,
Packit ae235b
					 const GTypeInfo	    *info,
Packit ae235b
					 const GTypeFundamentalInfo *finfo,
Packit ae235b
					 GTypeFlags		     flags);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void  g_type_add_interface_static	(GType			     instance_type,
Packit ae235b
					 GType			     interface_type,
Packit ae235b
					 const GInterfaceInfo	    *info);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void  g_type_add_interface_dynamic	(GType			     instance_type,
Packit ae235b
					 GType			     interface_type,
Packit ae235b
					 GTypePlugin		    *plugin);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void  g_type_interface_add_prerequisite (GType			     interface_type,
Packit ae235b
					 GType			     prerequisite_type);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GType*g_type_interface_prerequisites    (GType                       interface_type,
Packit ae235b
					 guint                      *n_prerequisites);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void     g_type_class_add_private       (gpointer                    g_class,
Packit ae235b
                                         gsize                       private_size);
Packit ae235b
GLIB_AVAILABLE_IN_2_38
Packit ae235b
gint     g_type_add_instance_private    (GType                       class_type,
Packit ae235b
                                         gsize                       private_size);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gpointer g_type_instance_get_private    (GTypeInstance              *instance,
Packit ae235b
                                         GType                       private_type);
Packit ae235b
GLIB_AVAILABLE_IN_2_38
Packit ae235b
void     g_type_class_adjust_private_offset (gpointer                g_class,
Packit ae235b
                                             gint                   *private_size_or_offset);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void      g_type_add_class_private      (GType    		     class_type,
Packit ae235b
					 gsize    		     private_size);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gpointer  g_type_class_get_private      (GTypeClass 		    *klass,
Packit ae235b
					 GType			     private_type);
Packit ae235b
GLIB_AVAILABLE_IN_2_38
Packit ae235b
gint      g_type_class_get_instance_private_offset (gpointer         g_class);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_2_34
Packit ae235b
void      g_type_ensure                 (GType                       type);
Packit ae235b
GLIB_AVAILABLE_IN_2_36
Packit ae235b
guint     g_type_get_type_registration_serial (void);
Packit ae235b
Packit ae235b
Packit ae235b
/* --- GType boilerplate --- */
Packit ae235b
/**
Packit ae235b
 * G_DECLARE_FINAL_TYPE:
Packit ae235b
 * @ModuleObjName: The name of the new type, in camel case (like GtkWidget)
Packit ae235b
 * @module_obj_name: The name of the new type in lowercase, with words
Packit ae235b
 *  separated by '_' (like 'gtk_widget')
Packit ae235b
 * @MODULE: The name of the module, in all caps (like 'GTK')
Packit ae235b
 * @OBJ_NAME: The bare name of the type, in all caps (like 'WIDGET')
Packit ae235b
 * @ParentName: the name of the parent type, in camel case (like GtkWidget)
Packit ae235b
 *
Packit ae235b
 * A convenience macro for emitting the usual declarations in the header file for a type which is not (at the
Packit ae235b
 * present time) intended to be subclassed.
Packit ae235b
 *
Packit ae235b
 * You might use it in a header as follows:
Packit ae235b
 *
Packit ae235b
 * |[
Packit ae235b
 * #ifndef _myapp_window_h_
Packit ae235b
 * #define _myapp_window_h_
Packit ae235b
 *
Packit ae235b
 * #include <gtk/gtk.h>
Packit ae235b
 *
Packit ae235b
 * #define MY_APP_TYPE_WINDOW my_app_window_get_type ()
Packit ae235b
 * G_DECLARE_FINAL_TYPE (MyAppWindow, my_app_window, MY_APP, WINDOW, GtkWindow)
Packit ae235b
 *
Packit ae235b
 * MyAppWindow *    my_app_window_new    (void);
Packit ae235b
 *
Packit ae235b
 * ...
Packit ae235b
 *
Packit ae235b
 * #endif
Packit ae235b
 * ]|
Packit ae235b
 *
Packit ae235b
 * This results in the following things happening:
Packit ae235b
 *
Packit ae235b
 * - the usual my_app_window_get_type() function is declared with a return type of #GType
Packit ae235b
 *
Packit ae235b
 * - the MyAppWindow types is defined as a typedef of struct _MyAppWindow.  The struct itself is not
Packit ae235b
 *   defined and should be defined from the .c file before G_DEFINE_TYPE() is used.
Packit ae235b
 *
Packit ae235b
 * - the MY_APP_WINDOW() cast is emitted as static inline function along with the MY_APP_IS_WINDOW() type
Packit ae235b
 *   checking function
Packit ae235b
 *
Packit ae235b
 * - the MyAppWindowClass type is defined as a struct containing GtkWindowClass.  This is done for the
Packit ae235b
 *   convenience of the person defining the type and should not be considered to be part of the ABI.  In
Packit ae235b
 *   particular, without a firm declaration of the instance structure, it is not possible to subclass the type
Packit ae235b
 *   and therefore the fact that the size of the class structure is exposed is not a concern and it can be
Packit ae235b
 *   freely changed at any point in the future.
Packit ae235b
 *
Packit ae235b
 * - g_autoptr() support being added for your type, based on the type of your parent class
Packit ae235b
 *
Packit ae235b
 * You can only use this function if your parent type also supports g_autoptr().
Packit ae235b
 *
Packit ae235b
 * Because the type macro (MY_APP_TYPE_WINDOW in the above example) is not a callable, you must continue to
Packit ae235b
 * manually define this as a macro for yourself.
Packit ae235b
 *
Packit ae235b
 * The declaration of the _get_type() function is the first thing emitted by the macro.  This allows this macro
Packit ae235b
 * to be used in the usual way with export control and API versioning macros.
Packit ae235b
 *
Packit ae235b
 * If you want to declare your own class structure, use G_DECLARE_DERIVABLE_TYPE().
Packit ae235b
 *
Packit ae235b
 * If you are writing a library, it is important to note that it is possible to convert a type from using
Packit ae235b
 * G_DECLARE_FINAL_TYPE() to G_DECLARE_DERIVABLE_TYPE() without breaking API or ABI.  As a precaution, you
Packit ae235b
 * should therefore use G_DECLARE_FINAL_TYPE() until you are sure that it makes sense for your class to be
Packit ae235b
 * subclassed.  Once a class structure has been exposed it is not possible to change its size or remove or
Packit ae235b
 * reorder items without breaking the API and/or ABI.
Packit ae235b
 *
Packit ae235b
 * Since: 2.44
Packit ae235b
 **/
Packit ae235b
#define G_DECLARE_FINAL_TYPE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME, ParentName) \
Packit ae235b
  GType module_obj_name##_get_type (void);                                                               \
Packit ae235b
  G_GNUC_BEGIN_IGNORE_DEPRECATIONS                                                                       \
Packit ae235b
  typedef struct _##ModuleObjName ModuleObjName;                                                         \
Packit ae235b
  typedef struct { ParentName##Class parent_class; } ModuleObjName##Class;                               \
Packit ae235b
                                                                                                         \
Packit ae235b
  _GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, ParentName)                                               \
Packit ae235b
                                                                                                         \
Packit ae235b
  static inline ModuleObjName * MODULE##_##OBJ_NAME (gpointer ptr) {                                     \
Packit ae235b
    return G_TYPE_CHECK_INSTANCE_CAST (ptr, module_obj_name##_get_type (), ModuleObjName); }             \
Packit ae235b
  static inline gboolean MODULE##_IS_##OBJ_NAME (gpointer ptr) {                                         \
Packit ae235b
    return G_TYPE_CHECK_INSTANCE_TYPE (ptr, module_obj_name##_get_type ()); }                            \
Packit ae235b
  G_GNUC_END_IGNORE_DEPRECATIONS
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * G_DECLARE_DERIVABLE_TYPE:
Packit ae235b
 * @ModuleObjName: The name of the new type, in camel case (like GtkWidget)
Packit ae235b
 * @module_obj_name: The name of the new type in lowercase, with words
Packit ae235b
 *  separated by '_' (like 'gtk_widget')
Packit ae235b
 * @MODULE: The name of the module, in all caps (like 'GTK')
Packit ae235b
 * @OBJ_NAME: The bare name of the type, in all caps (like 'WIDGET')
Packit ae235b
 * @ParentName: the name of the parent type, in camel case (like GtkWidget)
Packit ae235b
 *
Packit ae235b
 * A convenience macro for emitting the usual declarations in the header file for a type which will is intended
Packit ae235b
 * to be subclassed.
Packit ae235b
 *
Packit ae235b
 * You might use it in a header as follows:
Packit ae235b
 *
Packit ae235b
 * |[
Packit ae235b
 * #ifndef _gtk_frobber_h_
Packit ae235b
 * #define _gtk_frobber_h_
Packit ae235b
 *
Packit ae235b
 * #define GTK_TYPE_FROBBER gtk_frobber_get_type ()
Packit ae235b
 * GDK_AVAILABLE_IN_3_12
Packit ae235b
 * G_DECLARE_DERIVABLE_TYPE (GtkFrobber, gtk_frobber, GTK, FROBBER, GtkWidget)
Packit ae235b
 *
Packit ae235b
 * struct _GtkFrobberClass
Packit ae235b
 * {
Packit ae235b
 *   GtkWidgetClass parent_class;
Packit ae235b
 *
Packit ae235b
 *   void (* handle_frob)  (GtkFrobber *frobber,
Packit ae235b
 *                          guint       n_frobs);
Packit ae235b
 *
Packit ae235b
 *   gpointer padding[12];
Packit ae235b
 * };
Packit ae235b
 *
Packit ae235b
 * GtkWidget *    gtk_frobber_new   (void);
Packit ae235b
 *
Packit ae235b
 * ...
Packit ae235b
 *
Packit ae235b
 * #endif
Packit ae235b
 * ]|
Packit ae235b
 *
Packit ae235b
 * This results in the following things happening:
Packit ae235b
 *
Packit ae235b
 * - the usual gtk_frobber_get_type() function is declared with a return type of #GType
Packit ae235b
 *
Packit ae235b
 * - the GtkFrobber struct is created with GtkWidget as the first and only item.  You are expected to use
Packit ae235b
 *   a private structure from your .c file to store your instance variables.
Packit ae235b
 *
Packit ae235b
 * - the GtkFrobberClass type is defined as a typedef to struct _GtkFrobberClass, which is left undefined.
Packit ae235b
 *   You should do this from the header file directly after you use the macro.
Packit ae235b
 *
Packit ae235b
 * - the GTK_FROBBER() and GTK_FROBBER_CLASS() casts are emitted as static inline functions along with
Packit ae235b
 *   the GTK_IS_FROBBER() and GTK_IS_FROBBER_CLASS() type checking functions and GTK_FROBBER_GET_CLASS()
Packit ae235b
 *   function.
Packit ae235b
 *
Packit ae235b
 * - g_autoptr() support being added for your type, based on the type of your parent class
Packit ae235b
 *
Packit ae235b
 * You can only use this function if your parent type also supports g_autoptr().
Packit ae235b
 *
Packit ae235b
 * Because the type macro (GTK_TYPE_FROBBER in the above example) is not a callable, you must continue to
Packit ae235b
 * manually define this as a macro for yourself.
Packit ae235b
 *
Packit ae235b
 * The declaration of the _get_type() function is the first thing emitted by the macro.  This allows this macro
Packit ae235b
 * to be used in the usual way with export control and API versioning macros.
Packit ae235b
 *
Packit ae235b
 * If you are writing a library, it is important to note that it is possible to convert a type from using
Packit ae235b
 * G_DECLARE_FINAL_TYPE() to G_DECLARE_DERIVABLE_TYPE() without breaking API or ABI.  As a precaution, you
Packit ae235b
 * should therefore use G_DECLARE_FINAL_TYPE() until you are sure that it makes sense for your class to be
Packit ae235b
 * subclassed.  Once a class structure has been exposed it is not possible to change its size or remove or
Packit ae235b
 * reorder items without breaking the API and/or ABI.  If you want to declare your own class structure, use
Packit ae235b
 * G_DECLARE_DERIVABLE_TYPE().  If you want to declare a class without exposing the class or instance
Packit ae235b
 * structures, use G_DECLARE_FINAL_TYPE().
Packit ae235b
 *
Packit ae235b
 * If you must use G_DECLARE_DERIVABLE_TYPE() you should be sure to include some padding at the bottom of your
Packit ae235b
 * class structure to leave space for the addition of future virtual functions.
Packit ae235b
 *
Packit ae235b
 * Since: 2.44
Packit ae235b
 **/
Packit ae235b
#define G_DECLARE_DERIVABLE_TYPE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME, ParentName) \
Packit ae235b
  GType module_obj_name##_get_type (void);                                                               \
Packit ae235b
  G_GNUC_BEGIN_IGNORE_DEPRECATIONS                                                                       \
Packit ae235b
  typedef struct _##ModuleObjName ModuleObjName;                                                         \
Packit ae235b
  typedef struct _##ModuleObjName##Class ModuleObjName##Class;                                           \
Packit ae235b
  struct _##ModuleObjName { ParentName parent_instance; };                                               \
Packit ae235b
                                                                                                         \
Packit ae235b
  _GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, ParentName)                                               \
Packit ae235b
                                                                                                         \
Packit ae235b
  static inline ModuleObjName * MODULE##_##OBJ_NAME (gpointer ptr) {                                     \
Packit ae235b
    return G_TYPE_CHECK_INSTANCE_CAST (ptr, module_obj_name##_get_type (), ModuleObjName); }             \
Packit ae235b
  static inline ModuleObjName##Class * MODULE##_##OBJ_NAME##_CLASS (gpointer ptr) {                      \
Packit ae235b
    return G_TYPE_CHECK_CLASS_CAST (ptr, module_obj_name##_get_type (), ModuleObjName##Class); }         \
Packit ae235b
  static inline gboolean MODULE##_IS_##OBJ_NAME (gpointer ptr) {                                         \
Packit ae235b
    return G_TYPE_CHECK_INSTANCE_TYPE (ptr, module_obj_name##_get_type ()); }                            \
Packit ae235b
  static inline gboolean MODULE##_IS_##OBJ_NAME##_CLASS (gpointer ptr) {                                 \
Packit ae235b
    return G_TYPE_CHECK_CLASS_TYPE (ptr, module_obj_name##_get_type ()); }                               \
Packit ae235b
  static inline ModuleObjName##Class * MODULE##_##OBJ_NAME##_GET_CLASS (gpointer ptr) {                  \
Packit ae235b
    return G_TYPE_INSTANCE_GET_CLASS (ptr, module_obj_name##_get_type (), ModuleObjName##Class); }       \
Packit ae235b
  G_GNUC_END_IGNORE_DEPRECATIONS
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * G_DECLARE_INTERFACE:
Packit ae235b
 * @ModuleObjName: The name of the new type, in camel case (like GtkWidget)
Packit ae235b
 * @module_obj_name: The name of the new type in lowercase, with words
Packit ae235b
 *  separated by '_' (like 'gtk_widget')
Packit ae235b
 * @MODULE: The name of the module, in all caps (like 'GTK')
Packit ae235b
 * @OBJ_NAME: The bare name of the type, in all caps (like 'WIDGET')
Packit ae235b
 * @PrerequisiteName: the name of the prerequisite type, in camel case (like GtkWidget)
Packit ae235b
 *
Packit ae235b
 * A convenience macro for emitting the usual declarations in the header file for a GInterface type.
Packit ae235b
 *
Packit ae235b
 * You might use it in a header as follows:
Packit ae235b
 *
Packit ae235b
 * |[
Packit ae235b
 * #ifndef _my_model_h_
Packit ae235b
 * #define _my_model_h_
Packit ae235b
 *
Packit ae235b
 * #define MY_TYPE_MODEL my_model_get_type ()
Packit ae235b
 * GDK_AVAILABLE_IN_3_12
Packit ae235b
 * G_DECLARE_INTERFACE (MyModel, my_model, MY, MODEL, GObject)
Packit ae235b
 *
Packit ae235b
 * struct _MyModelInterface
Packit ae235b
 * {
Packit ae235b
 *   GTypeInterface g_iface;
Packit ae235b
 *
Packit ae235b
 *   gpointer (* get_item)  (MyModel *model);
Packit ae235b
 * };
Packit ae235b
 *
Packit ae235b
 * gpointer my_model_get_item (MyModel *model);
Packit ae235b
 *
Packit ae235b
 * ...
Packit ae235b
 *
Packit ae235b
 * #endif
Packit ae235b
 * ]|
Packit ae235b
 *
Packit ae235b
 * This results in the following things happening:
Packit ae235b
 *
Packit ae235b
 * - the usual my_model_get_type() function is declared with a return type of #GType
Packit ae235b
 *
Packit ae235b
 * - the MyModelInterface type is defined as a typedef to struct _MyModelInterface,
Packit ae235b
 *   which is left undefined. You should do this from the header file directly after
Packit ae235b
 *   you use the macro.
Packit ae235b
 *
Packit ae235b
 * - the MY_MODEL() cast is emitted as static inline functions along with
Packit ae235b
 *   the MY_IS_MODEL() type checking function and MY_MODEL_GET_IFACE() function.
Packit ae235b
 *
Packit ae235b
 * - g_autoptr() support being added for your type, based on your prerequisite type.
Packit ae235b
 *
Packit ae235b
 * You can only use this function if your prerequisite type also supports g_autoptr().
Packit ae235b
 *
Packit ae235b
 * Because the type macro (MY_TYPE_MODEL in the above example) is not a callable, you must continue to
Packit ae235b
 * manually define this as a macro for yourself.
Packit ae235b
 *
Packit ae235b
 * The declaration of the _get_type() function is the first thing emitted by the macro.  This allows this macro
Packit ae235b
 * to be used in the usual way with export control and API versioning macros.
Packit ae235b
 *
Packit ae235b
 * Since: 2.44
Packit ae235b
 **/
Packit ae235b
#define G_DECLARE_INTERFACE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME, PrerequisiteName) \
Packit ae235b
  GType module_obj_name##_get_type (void);                                                                 \
Packit ae235b
  G_GNUC_BEGIN_IGNORE_DEPRECATIONS                                                                         \
Packit ae235b
  typedef struct _##ModuleObjName ModuleObjName;                                                           \
Packit ae235b
  typedef struct _##ModuleObjName##Interface ModuleObjName##Interface;                                     \
Packit ae235b
                                                                                                           \
Packit ae235b
  _GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, PrerequisiteName)                                           \
Packit ae235b
                                                                                                           \
Packit ae235b
  static inline ModuleObjName * MODULE##_##OBJ_NAME (gpointer ptr) {                                       \
Packit ae235b
    return G_TYPE_CHECK_INSTANCE_CAST (ptr, module_obj_name##_get_type (), ModuleObjName); }               \
Packit ae235b
  static inline gboolean MODULE##_IS_##OBJ_NAME (gpointer ptr) {                                           \
Packit ae235b
    return G_TYPE_CHECK_INSTANCE_TYPE (ptr, module_obj_name##_get_type ()); }                              \
Packit ae235b
  static inline ModuleObjName##Interface * MODULE##_##OBJ_NAME##_GET_IFACE (gpointer ptr) {                \
Packit ae235b
    return G_TYPE_INSTANCE_GET_INTERFACE (ptr, module_obj_name##_get_type (), ModuleObjName##Interface); } \
Packit ae235b
  G_GNUC_END_IGNORE_DEPRECATIONS
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * G_DEFINE_TYPE:
Packit ae235b
 * @TN: The name of the new type, in Camel case.
Packit ae235b
 * @t_n: The name of the new type, in lowercase, with words 
Packit ae235b
 *  separated by '_'.
Packit ae235b
 * @T_P: The #GType of the parent type.
Packit ae235b
 * 
Packit ae235b
 * A convenience macro for type implementations, which declares a class
Packit ae235b
 * initialization function, an instance initialization function (see #GTypeInfo
Packit ae235b
 * for information about these) and a static variable named `t_n_parent_class`
Packit ae235b
 * pointing to the parent class. Furthermore, it defines  a *_get_type() function.
Packit ae235b
 * See G_DEFINE_TYPE_EXTENDED() for an example.
Packit ae235b
 * 
Packit ae235b
 * Since: 2.4
Packit ae235b
 */
Packit ae235b
#define G_DEFINE_TYPE(TN, t_n, T_P)			    G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, 0, {})
Packit ae235b
/**
Packit ae235b
 * G_DEFINE_TYPE_WITH_CODE:
Packit ae235b
 * @TN: The name of the new type, in Camel case.
Packit ae235b
 * @t_n: The name of the new type in lowercase, with words separated by '_'.
Packit ae235b
 * @T_P: The #GType of the parent type.
Packit ae235b
 * @_C_: Custom code that gets inserted in the *_get_type() function.
Packit ae235b
 * 
Packit ae235b
 * A convenience macro for type implementations.  
Packit ae235b
 * Similar to G_DEFINE_TYPE(), but allows you to insert custom code into the 
Packit ae235b
 * *_get_type() function, e.g. interface implementations via G_IMPLEMENT_INTERFACE().
Packit ae235b
 * See G_DEFINE_TYPE_EXTENDED() for an example.
Packit ae235b
 * 
Packit ae235b
 * Since: 2.4
Packit ae235b
 */
Packit ae235b
#define G_DEFINE_TYPE_WITH_CODE(TN, t_n, T_P, _C_)	    _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, 0) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
Packit ae235b
/**
Packit ae235b
 * G_DEFINE_TYPE_WITH_PRIVATE:
Packit ae235b
 * @TN: The name of the new type, in Camel case.
Packit ae235b
 * @t_n: The name of the new type, in lowercase, with words 
Packit ae235b
 *  separated by '_'.
Packit ae235b
 * @T_P: The #GType of the parent type.
Packit ae235b
 * 
Packit ae235b
 * A convenience macro for type implementations, which declares a class
Packit ae235b
 * initialization function, an instance initialization function (see #GTypeInfo
Packit ae235b
 * for information about these), a static variable named `t_n_parent_class`
Packit ae235b
 * pointing to the parent class, and adds private instance data to the type.
Packit ae235b
 * Furthermore, it defines a *_get_type() function. See G_DEFINE_TYPE_EXTENDED()
Packit ae235b
 * for an example.
Packit ae235b
 * 
Packit ae235b
 * Note that private structs added with this macros must have a struct
Packit ae235b
 * name of the form @TN Private.
Packit ae235b
 *
Packit ae235b
 * Since: 2.38
Packit ae235b
 */
Packit ae235b
#define G_DEFINE_TYPE_WITH_PRIVATE(TN, t_n, T_P)            G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, 0, G_ADD_PRIVATE (TN))
Packit ae235b
/**
Packit ae235b
 * G_DEFINE_ABSTRACT_TYPE:
Packit ae235b
 * @TN: The name of the new type, in Camel case.
Packit ae235b
 * @t_n: The name of the new type, in lowercase, with words 
Packit ae235b
 *  separated by '_'.
Packit ae235b
 * @T_P: The #GType of the parent type.
Packit ae235b
 * 
Packit ae235b
 * A convenience macro for type implementations. 
Packit ae235b
 * Similar to G_DEFINE_TYPE(), but defines an abstract type. 
Packit ae235b
 * See G_DEFINE_TYPE_EXTENDED() for an example.
Packit ae235b
 * 
Packit ae235b
 * Since: 2.4
Packit ae235b
 */
Packit ae235b
#define G_DEFINE_ABSTRACT_TYPE(TN, t_n, T_P)		    G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT, {})
Packit ae235b
/**
Packit ae235b
 * G_DEFINE_ABSTRACT_TYPE_WITH_CODE:
Packit ae235b
 * @TN: The name of the new type, in Camel case.
Packit ae235b
 * @t_n: The name of the new type, in lowercase, with words 
Packit ae235b
 *  separated by '_'.
Packit ae235b
 * @T_P: The #GType of the parent type.
Packit ae235b
 * @_C_: Custom code that gets inserted in the @type_name_get_type() function.
Packit ae235b
 * 
Packit ae235b
 * A convenience macro for type implementations.
Packit ae235b
 * Similar to G_DEFINE_TYPE_WITH_CODE(), but defines an abstract type and
Packit ae235b
 * allows you to insert custom code into the *_get_type() function, e.g.
Packit ae235b
 * interface implementations  via G_IMPLEMENT_INTERFACE().
Packit ae235b
 * See G_DEFINE_TYPE_EXTENDED() for an example.
Packit ae235b
 * 
Packit ae235b
 * Since: 2.4
Packit ae235b
 */
Packit ae235b
#define G_DEFINE_ABSTRACT_TYPE_WITH_CODE(TN, t_n, T_P, _C_) _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
Packit ae235b
/**
Packit ae235b
 * G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE:
Packit ae235b
 * @TN: The name of the new type, in Camel case.
Packit ae235b
 * @t_n: The name of the new type, in lowercase, with words 
Packit ae235b
 *  separated by '_'.
Packit ae235b
 * @T_P: The #GType of the parent type.
Packit ae235b
 *
Packit ae235b
 * Similar to G_DEFINE_TYPE_WITH_PRIVATE(), but defines an abstract type. 
Packit ae235b
 * See G_DEFINE_TYPE_EXTENDED() for an example.
Packit ae235b
 * 
Packit ae235b
 * Since: 2.38
Packit ae235b
 */
Packit ae235b
#define G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(TN, t_n, T_P)   G_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT, G_ADD_PRIVATE (TN))
Packit ae235b
/**
Packit ae235b
 * G_DEFINE_TYPE_EXTENDED:
Packit ae235b
 * @TN: The name of the new type, in Camel case.
Packit ae235b
 * @t_n: The name of the new type, in lowercase, with words
Packit ae235b
 *    separated by '_'.
Packit ae235b
 * @T_P: The #GType of the parent type.
Packit ae235b
 * @_f_: #GTypeFlags to pass to g_type_register_static()
Packit ae235b
 * @_C_: Custom code that gets inserted in the *_get_type() function.
Packit ae235b
 *
Packit ae235b
 * The most general convenience macro for type implementations, on which
Packit ae235b
 * G_DEFINE_TYPE(), etc are based.
Packit ae235b
 *
Packit ae235b
 * |[
Packit ae235b
 * G_DEFINE_TYPE_EXTENDED (GtkGadget,
Packit ae235b
 *                         gtk_gadget,
Packit ae235b
 *                         GTK_TYPE_WIDGET,
Packit ae235b
 *                         0,
Packit ae235b
 *                         G_IMPLEMENT_INTERFACE (TYPE_GIZMO,
Packit ae235b
 *                                                gtk_gadget_gizmo_init));
Packit ae235b
 * ]|
Packit ae235b
 * expands to
Packit ae235b
 * |[
Packit ae235b
 * static void     gtk_gadget_init       (GtkGadget      *self);
Packit ae235b
 * static void     gtk_gadget_class_init (GtkGadgetClass *klass);
Packit ae235b
 * static gpointer gtk_gadget_parent_class = NULL;
Packit ae235b
 * static void     gtk_gadget_class_intern_init (gpointer klass)
Packit ae235b
 * {
Packit ae235b
 *   gtk_gadget_parent_class = g_type_class_peek_parent (klass);
Packit ae235b
 *   gtk_gadget_class_init ((GtkGadgetClass*) klass);
Packit ae235b
 * }
Packit ae235b
 *
Packit ae235b
 * GType
Packit ae235b
 * gtk_gadget_get_type (void)
Packit ae235b
 * {
Packit ae235b
 *   static volatile gsize g_define_type_id__volatile = 0;
Packit ae235b
 *   if (g_once_init_enter (&g_define_type_id__volatile))
Packit ae235b
 *     {
Packit ae235b
 *       GType g_define_type_id =
Packit ae235b
 *         g_type_register_static_simple (GTK_TYPE_WIDGET,
Packit ae235b
 *                                        g_intern_static_string ("GtkGadget"),
Packit ae235b
 *                                        sizeof (GtkGadgetClass),
Packit ae235b
 *                                        (GClassInitFunc) gtk_gadget_class_intern_init,
Packit ae235b
 *                                        sizeof (GtkGadget),
Packit ae235b
 *                                        (GInstanceInitFunc) gtk_gadget_init,
Packit ae235b
 *                                        0);
Packit ae235b
 *       {
Packit ae235b
 *         const GInterfaceInfo g_implement_interface_info = {
Packit ae235b
 *           (GInterfaceInitFunc) gtk_gadget_gizmo_init
Packit ae235b
 *         };
Packit ae235b
 *         g_type_add_interface_static (g_define_type_id, TYPE_GIZMO, &g_implement_interface_info);
Packit ae235b
 *       }
Packit ae235b
 *       g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
Packit ae235b
 *     }
Packit ae235b
 *   return g_define_type_id__volatile;
Packit ae235b
 * }
Packit ae235b
 * ]|
Packit ae235b
 * The only pieces which have to be manually provided are the definitions of
Packit ae235b
 * the instance and class structure and the definitions of the instance and
Packit ae235b
 * class init functions.
Packit ae235b
 *
Packit ae235b
 * Since: 2.4
Packit ae235b
 */
Packit ae235b
#define G_DEFINE_TYPE_EXTENDED(TN, t_n, T_P, _f_, _C_)	    _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, _f_) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * G_DEFINE_INTERFACE:
Packit ae235b
 * @TN: The name of the new type, in Camel case.
Packit ae235b
 * @t_n: The name of the new type, in lowercase, with words separated by '_'.
Packit ae235b
 * @T_P: The #GType of the prerequisite type for the interface, or 0
Packit ae235b
 * (%G_TYPE_INVALID) for no prerequisite type.
Packit ae235b
 *
Packit ae235b
 * A convenience macro for #GTypeInterface definitions, which declares
Packit ae235b
 * a default vtable initialization function and defines a *_get_type()
Packit ae235b
 * function.
Packit ae235b
 *
Packit ae235b
 * The macro expects the interface initialization function to have the
Packit ae235b
 * name `t_n ## _default_init`, and the interface structure to have the
Packit ae235b
 * name `TN ## Interface`.
Packit ae235b
 *
Packit ae235b
 * Since: 2.24
Packit ae235b
 */
Packit ae235b
#define G_DEFINE_INTERFACE(TN, t_n, T_P)		    G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, ;)
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * G_DEFINE_INTERFACE_WITH_CODE:
Packit ae235b
 * @TN: The name of the new type, in Camel case.
Packit ae235b
 * @t_n: The name of the new type, in lowercase, with words separated by '_'.
Packit ae235b
 * @T_P: The #GType of the prerequisite type for the interface, or 0
Packit ae235b
 * (%G_TYPE_INVALID) for no prerequisite type.
Packit ae235b
 * @_C_: Custom code that gets inserted in the *_get_type() function.
Packit ae235b
 *
Packit ae235b
 * A convenience macro for #GTypeInterface definitions. Similar to
Packit ae235b
 * G_DEFINE_INTERFACE(), but allows you to insert custom code into the
Packit ae235b
 * *_get_type() function, e.g. additional interface implementations
Packit ae235b
 * via G_IMPLEMENT_INTERFACE(), or additional prerequisite types. See
Packit ae235b
 * G_DEFINE_TYPE_EXTENDED() for a similar example using
Packit ae235b
 * G_DEFINE_TYPE_WITH_CODE().
Packit ae235b
 *
Packit ae235b
 * Since: 2.24
Packit ae235b
 */
Packit ae235b
#define G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, _C_)     _G_DEFINE_INTERFACE_EXTENDED_BEGIN(TN, t_n, T_P) {_C_;} _G_DEFINE_INTERFACE_EXTENDED_END()
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * G_IMPLEMENT_INTERFACE:
Packit ae235b
 * @TYPE_IFACE: The #GType of the interface to add
Packit ae235b
 * @iface_init: The interface init function
Packit ae235b
 *
Packit ae235b
 * A convenience macro to ease interface addition in the `_C_` section
Packit ae235b
 * of G_DEFINE_TYPE_WITH_CODE() or G_DEFINE_ABSTRACT_TYPE_WITH_CODE().
Packit ae235b
 * See G_DEFINE_TYPE_EXTENDED() for an example.
Packit ae235b
 *
Packit ae235b
 * Note that this macro can only be used together with the G_DEFINE_TYPE_*
Packit ae235b
 * macros, since it depends on variable names from those macros.
Packit ae235b
 *
Packit ae235b
 * Since: 2.4
Packit ae235b
 */
Packit ae235b
#define G_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init)       { \
Packit ae235b
  const GInterfaceInfo g_implement_interface_info = { \
Packit ae235b
    (GInterfaceInitFunc)(void (*)(void)) iface_init, NULL, NULL \
Packit ae235b
  }; \
Packit ae235b
  g_type_add_interface_static (g_define_type_id, TYPE_IFACE, &g_implement_interface_info); \
Packit ae235b
}
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * G_ADD_PRIVATE:
Packit ae235b
 * @TypeName: the name of the type in CamelCase
Packit ae235b
 *
Packit ae235b
 * A convenience macro to ease adding private data to instances of a new type
Packit ae235b
 * in the @_C_ section of G_DEFINE_TYPE_WITH_CODE() or
Packit ae235b
 * G_DEFINE_ABSTRACT_TYPE_WITH_CODE().
Packit ae235b
 *
Packit ae235b
 * For instance:
Packit ae235b
 *
Packit ae235b
 * |[
Packit ae235b
 *   typedef struct _MyObject MyObject;
Packit ae235b
 *   typedef struct _MyObjectClass MyObjectClass;
Packit ae235b
 *
Packit ae235b
 *   typedef struct {
Packit ae235b
 *     gint foo;
Packit ae235b
 *     gint bar;
Packit ae235b
 *   } MyObjectPrivate;
Packit ae235b
 *
Packit ae235b
 *   G_DEFINE_TYPE_WITH_CODE (MyObject, my_object, G_TYPE_OBJECT,
Packit ae235b
 *                            G_ADD_PRIVATE (MyObject))
Packit ae235b
 * ]|
Packit ae235b
 *
Packit ae235b
 * Will add MyObjectPrivate as the private data to any instance of the MyObject
Packit ae235b
 * type.
Packit ae235b
 *
Packit ae235b
 * G_DEFINE_TYPE_* macros will automatically create a private function
Packit ae235b
 * based on the arguments to this macro, which can be used to safely
Packit ae235b
 * retrieve the private data from an instance of the type; for instance:
Packit ae235b
 *
Packit ae235b
 * |[
Packit ae235b
 *   gint
Packit ae235b
 *   my_object_get_foo (MyObject *obj)
Packit ae235b
 *   {
Packit ae235b
 *     MyObjectPrivate *priv = my_object_get_instance_private (obj);
Packit ae235b
 *
Packit ae235b
 *     g_return_val_if_fail (MY_IS_OBJECT (obj), 0);
Packit ae235b
 *
Packit ae235b
 *     return priv->foo;
Packit ae235b
 *   }
Packit ae235b
 *
Packit ae235b
 *   void
Packit ae235b
 *   my_object_set_bar (MyObject *obj,
Packit ae235b
 *                      gint      bar)
Packit ae235b
 *   {
Packit ae235b
 *     MyObjectPrivate *priv = my_object_get_instance_private (obj);
Packit ae235b
 *
Packit ae235b
 *     g_return_if_fail (MY_IS_OBJECT (obj));
Packit ae235b
 *
Packit ae235b
 *     if (priv->bar != bar)
Packit ae235b
 *       priv->bar = bar;
Packit ae235b
 *   }
Packit ae235b
 * ]|
Packit ae235b
 *
Packit ae235b
 * Note that this macro can only be used together with the G_DEFINE_TYPE_*
Packit ae235b
 * macros, since it depends on variable names from those macros.
Packit ae235b
 *
Packit ae235b
 * Also note that private structs added with these macros must have a struct
Packit ae235b
 * name of the form `TypeNamePrivate`.
Packit ae235b
 *
Packit ae235b
 * It is safe to call _get_instance_private on %NULL or invalid object since
Packit ae235b
 * it's only adding an offset to the instance pointer. In that case the returned
Packit ae235b
 * pointer must not be dereferenced.
Packit ae235b
 *
Packit ae235b
 * Since: 2.38
Packit ae235b
 */
Packit ae235b
#define G_ADD_PRIVATE(TypeName) { \
Packit ae235b
  TypeName##_private_offset = \
Packit ae235b
    g_type_add_instance_private (g_define_type_id, sizeof (TypeName##Private)); \
Packit ae235b
}
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * G_PRIVATE_OFFSET:
Packit ae235b
 * @TypeName: the name of the type in CamelCase
Packit ae235b
 * @field: the name of the field in the private data structure
Packit ae235b
 *
Packit ae235b
 * Evaluates to the offset of the @field inside the instance private data
Packit ae235b
 * structure for @TypeName.
Packit ae235b
 *
Packit ae235b
 * Note that this macro can only be used together with the G_DEFINE_TYPE_*
Packit ae235b
 * and G_ADD_PRIVATE() macros, since it depends on variable names from
Packit ae235b
 * those macros.
Packit ae235b
 *
Packit ae235b
 * Since: 2.38
Packit ae235b
 */
Packit ae235b
#define G_PRIVATE_OFFSET(TypeName, field) \
Packit ae235b
  (TypeName##_private_offset + (G_STRUCT_OFFSET (TypeName##Private, field)))
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * G_PRIVATE_FIELD_P:
Packit ae235b
 * @TypeName: the name of the type in CamelCase
Packit ae235b
 * @inst: the instance of @TypeName you wish to access
Packit ae235b
 * @field_name: the name of the field in the private data structure
Packit ae235b
 *
Packit ae235b
 * Evaluates to a pointer to the @field_name inside the @inst private data
Packit ae235b
 * structure for @TypeName.
Packit ae235b
 *
Packit ae235b
 * Note that this macro can only be used together with the G_DEFINE_TYPE_*
Packit ae235b
 * and G_ADD_PRIVATE() macros, since it depends on variable names from
Packit ae235b
 * those macros.
Packit ae235b
 *
Packit ae235b
 * Since: 2.38
Packit ae235b
 */
Packit ae235b
#define G_PRIVATE_FIELD_P(TypeName, inst, field_name) \
Packit ae235b
  G_STRUCT_MEMBER_P (inst, G_PRIVATE_OFFSET (TypeName, field_name))
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * G_PRIVATE_FIELD:
Packit ae235b
 * @TypeName: the name of the type in CamelCase
Packit ae235b
 * @inst: the instance of @TypeName you wish to access
Packit ae235b
 * @field_type: the type of the field in the private data structure
Packit ae235b
 * @field_name: the name of the field in the private data structure
Packit ae235b
 *
Packit ae235b
 * Evaluates to the @field_name inside the @inst private data
Packit ae235b
 * structure for @TypeName.
Packit ae235b
 *
Packit ae235b
 * Note that this macro can only be used together with the G_DEFINE_TYPE_*
Packit ae235b
 * and G_ADD_PRIVATE() macros, since it depends on variable names from
Packit ae235b
 * those macros.
Packit ae235b
 *
Packit ae235b
 * Since: 2.38
Packit ae235b
 */
Packit ae235b
#define G_PRIVATE_FIELD(TypeName, inst, field_type, field_name) \
Packit ae235b
  G_STRUCT_MEMBER (field_type, inst, G_PRIVATE_OFFSET (TypeName, field_name))
Packit ae235b
Packit ae235b
/* we need to have this macro under conditional expansion, as it references
Packit ae235b
 * a function that has been added in 2.38. see bug:
Packit ae235b
 * https://bugzilla.gnome.org/show_bug.cgi?id=703191
Packit ae235b
 */
Packit ae235b
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
Packit ae235b
#define _G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \
Packit ae235b
static void     type_name##_class_intern_init (gpointer klass) \
Packit ae235b
{ \
Packit ae235b
  type_name##_parent_class = g_type_class_peek_parent (klass); \
Packit ae235b
  if (TypeName##_private_offset != 0) \
Packit ae235b
    g_type_class_adjust_private_offset (klass, &TypeName##_private_offset); \
Packit ae235b
  type_name##_class_init ((TypeName##Class*) klass); \
Packit ae235b
}
Packit ae235b
Packit ae235b
#else
Packit ae235b
#define _G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \
Packit ae235b
static void     type_name##_class_intern_init (gpointer klass) \
Packit ae235b
{ \
Packit ae235b
  type_name##_parent_class = g_type_class_peek_parent (klass); \
Packit ae235b
  type_name##_class_init ((TypeName##Class*) klass); \
Packit ae235b
}
Packit ae235b
#endif /* GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 */
Packit ae235b
Packit ae235b
/* Added for _G_DEFINE_TYPE_EXTENDED_WITH_PRELUDE */
Packit ae235b
#define _G_DEFINE_TYPE_EXTENDED_BEGIN_PRE(TypeName, type_name, TYPE_PARENT) \
Packit ae235b
\
Packit ae235b
static void     type_name##_init              (TypeName        *self); \
Packit ae235b
static void     type_name##_class_init        (TypeName##Class *klass); \
Packit ae235b
static gpointer type_name##_parent_class = NULL; \
Packit ae235b
static gint     TypeName##_private_offset; \
Packit ae235b
\
Packit ae235b
_G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \
Packit ae235b
\
Packit ae235b
G_GNUC_UNUSED \
Packit ae235b
static inline gpointer \
Packit ae235b
type_name##_get_instance_private (TypeName *self) \
Packit ae235b
{ \
Packit ae235b
  return (G_STRUCT_MEMBER_P (self, TypeName##_private_offset)); \
Packit ae235b
} \
Packit ae235b
\
Packit ae235b
GType \
Packit ae235b
type_name##_get_type (void) \
Packit ae235b
{ \
Packit ae235b
  static volatile gsize g_define_type_id__volatile = 0;
Packit ae235b
  /* Prelude goes here */
Packit ae235b
Packit ae235b
/* Added for _G_DEFINE_TYPE_EXTENDED_WITH_PRELUDE */
Packit ae235b
#define _G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER(TypeName, type_name, TYPE_PARENT, flags) \
Packit ae235b
  if (g_once_init_enter (&g_define_type_id__volatile))  \
Packit ae235b
    { \
Packit ae235b
      GType g_define_type_id = \
Packit ae235b
        g_type_register_static_simple (TYPE_PARENT, \
Packit ae235b
                                       g_intern_static_string (#TypeName), \
Packit ae235b
                                       sizeof (TypeName##Class), \
Packit ae235b
                                       (GClassInitFunc)(void (*)(void)) type_name##_class_intern_init, \
Packit ae235b
                                       sizeof (TypeName), \
Packit ae235b
                                       (GInstanceInitFunc)(void (*)(void)) type_name##_init, \
Packit ae235b
                                       (GTypeFlags) flags); \
Packit ae235b
      { /* custom code follows */
Packit ae235b
#define _G_DEFINE_TYPE_EXTENDED_END()	\
Packit ae235b
        /* following custom code */	\
Packit ae235b
      }					\
Packit ae235b
      g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); \
Packit ae235b
    }					\
Packit ae235b
  return g_define_type_id__volatile;	\
Packit ae235b
} /* closes type_name##_get_type() */
Packit ae235b
Packit ae235b
/* This was defined before we had G_DEFINE_TYPE_WITH_CODE_AND_PRELUDE, it's simplest
Packit ae235b
 * to keep it.
Packit ae235b
 */
Packit ae235b
#define _G_DEFINE_TYPE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PARENT, flags) \
Packit ae235b
  _G_DEFINE_TYPE_EXTENDED_BEGIN_PRE(TypeName, type_name, TYPE_PARENT) \
Packit ae235b
  _G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER(TypeName, type_name, TYPE_PARENT, flags) \
Packit ae235b
Packit ae235b
#define _G_DEFINE_INTERFACE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PREREQ) \
Packit ae235b
\
Packit ae235b
static void     type_name##_default_init        (TypeName##Interface *klass); \
Packit ae235b
\
Packit ae235b
GType \
Packit ae235b
type_name##_get_type (void) \
Packit ae235b
{ \
Packit ae235b
  static volatile gsize g_define_type_id__volatile = 0; \
Packit ae235b
  if (g_once_init_enter (&g_define_type_id__volatile))  \
Packit ae235b
    { \
Packit ae235b
      GType g_define_type_id = \
Packit ae235b
        g_type_register_static_simple (G_TYPE_INTERFACE, \
Packit ae235b
                                       g_intern_static_string (#TypeName), \
Packit ae235b
                                       sizeof (TypeName##Interface), \
Packit ae235b
                                       (GClassInitFunc)(void (*)(void)) type_name##_default_init, \
Packit ae235b
                                       0, \
Packit ae235b
                                       (GInstanceInitFunc)NULL, \
Packit ae235b
                                       (GTypeFlags) 0); \
Packit ae235b
      if (TYPE_PREREQ) \
Packit ae235b
        g_type_interface_add_prerequisite (g_define_type_id, TYPE_PREREQ); \
Packit ae235b
      { /* custom code follows */
Packit ae235b
#define _G_DEFINE_INTERFACE_EXTENDED_END()	\
Packit ae235b
        /* following custom code */		\
Packit ae235b
      }						\
Packit ae235b
      g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); \
Packit ae235b
    }						\
Packit ae235b
  return g_define_type_id__volatile;			\
Packit ae235b
} /* closes type_name##_get_type() */
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * G_DEFINE_BOXED_TYPE:
Packit ae235b
 * @TypeName: The name of the new type, in Camel case
Packit ae235b
 * @type_name: The name of the new type, in lowercase, with words
Packit ae235b
 *  separated by '_'
Packit ae235b
 * @copy_func: the #GBoxedCopyFunc for the new type
Packit ae235b
 * @free_func: the #GBoxedFreeFunc for the new type
Packit ae235b
 *
Packit ae235b
 * A convenience macro for boxed type implementations, which defines a
Packit ae235b
 * type_name_get_type() function registering the boxed type.
Packit ae235b
 *
Packit ae235b
 * Since: 2.26
Packit ae235b
 */
Packit ae235b
#define G_DEFINE_BOXED_TYPE(TypeName, type_name, copy_func, free_func) G_DEFINE_BOXED_TYPE_WITH_CODE (TypeName, type_name, copy_func, free_func, {})
Packit ae235b
/**
Packit ae235b
 * G_DEFINE_BOXED_TYPE_WITH_CODE:
Packit ae235b
 * @TypeName: The name of the new type, in Camel case
Packit ae235b
 * @type_name: The name of the new type, in lowercase, with words
Packit ae235b
 *  separated by '_'
Packit ae235b
 * @copy_func: the #GBoxedCopyFunc for the new type
Packit ae235b
 * @free_func: the #GBoxedFreeFunc for the new type
Packit ae235b
 * @_C_: Custom code that gets inserted in the *_get_type() function
Packit ae235b
 *
Packit ae235b
 * A convenience macro for boxed type implementations.
Packit ae235b
 * Similar to G_DEFINE_BOXED_TYPE(), but allows to insert custom code into the
Packit ae235b
 * type_name_get_type() function, e.g. to register value transformations with
Packit ae235b
 * g_value_register_transform_func(), for instance:
Packit ae235b
 *
Packit ae235b
 * |[
Packit ae235b
 * G_DEFINE_BOXED_TYPE_WITH_CODE (GdkRectangle, gdk_rectangle,
Packit ae235b
 *                                gdk_rectangle_copy,
Packit ae235b
 *                                gdk_rectangle_free,
Packit ae235b
 *                                register_rectangle_transform_funcs (g_define_type_id))
Packit ae235b
 * ]|
Packit ae235b
 *
Packit ae235b
 * Similarly to the %G_DEFINE_TYPE family of macros, the #GType of the newly
Packit ae235b
 * defined boxed type is exposed in the `g_define_type_id` variable.
Packit ae235b
 *
Packit ae235b
 * Since: 2.26
Packit ae235b
 */
Packit ae235b
#define G_DEFINE_BOXED_TYPE_WITH_CODE(TypeName, type_name, copy_func, free_func, _C_) _G_DEFINE_BOXED_TYPE_BEGIN (TypeName, type_name, copy_func, free_func) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
Packit ae235b
Packit ae235b
/* Only use this in non-C++ on GCC >= 2.7, except for Darwin/ppc64.
Packit ae235b
 * See https://bugzilla.gnome.org/show_bug.cgi?id=647145
Packit ae235b
 */
Packit ae235b
#if !defined (__cplusplus) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) && !(defined (__APPLE__) && defined (__ppc64__))
Packit ae235b
#define _G_DEFINE_BOXED_TYPE_BEGIN(TypeName, type_name, copy_func, free_func) \
Packit ae235b
GType \
Packit ae235b
type_name##_get_type (void) \
Packit ae235b
{ \
Packit ae235b
  static volatile gsize g_define_type_id__volatile = 0; \
Packit ae235b
  if (g_once_init_enter (&g_define_type_id__volatile))  \
Packit ae235b
    { \
Packit ae235b
      GType (* _g_register_boxed) \
Packit ae235b
        (const gchar *, \
Packit ae235b
         union \
Packit ae235b
           { \
Packit ae235b
             TypeName * (*do_copy_type) (TypeName *); \
Packit ae235b
             TypeName * (*do_const_copy_type) (const TypeName *); \
Packit ae235b
             GBoxedCopyFunc do_copy_boxed; \
Packit ae235b
           } __attribute__((__transparent_union__)), \
Packit ae235b
         union \
Packit ae235b
           { \
Packit ae235b
             void (* do_free_type) (TypeName *); \
Packit ae235b
             GBoxedFreeFunc do_free_boxed; \
Packit ae235b
           } __attribute__((__transparent_union__)) \
Packit ae235b
        ) = g_boxed_type_register_static; \
Packit ae235b
      GType g_define_type_id = \
Packit ae235b
        _g_register_boxed (g_intern_static_string (#TypeName), copy_func, free_func); \
Packit ae235b
      { /* custom code follows */
Packit ae235b
#else
Packit ae235b
#define _G_DEFINE_BOXED_TYPE_BEGIN(TypeName, type_name, copy_func, free_func) \
Packit ae235b
GType \
Packit ae235b
type_name##_get_type (void) \
Packit ae235b
{ \
Packit ae235b
  static volatile gsize g_define_type_id__volatile = 0; \
Packit ae235b
  if (g_once_init_enter (&g_define_type_id__volatile))  \
Packit ae235b
    { \
Packit ae235b
      GType g_define_type_id = \
Packit ae235b
        g_boxed_type_register_static (g_intern_static_string (#TypeName), \
Packit ae235b
                                      (GBoxedCopyFunc) copy_func, \
Packit ae235b
                                      (GBoxedFreeFunc) free_func); \
Packit ae235b
      { /* custom code follows */
Packit ae235b
#endif /* __GNUC__ */
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * G_DEFINE_POINTER_TYPE:
Packit ae235b
 * @TypeName: The name of the new type, in Camel case
Packit ae235b
 * @type_name: The name of the new type, in lowercase, with words
Packit ae235b
 *  separated by '_'
Packit ae235b
 *
Packit ae235b
 * A convenience macro for pointer type implementations, which defines a
Packit ae235b
 * type_name_get_type() function registering the pointer type.
Packit ae235b
 *
Packit ae235b
 * Since: 2.26
Packit ae235b
 */
Packit ae235b
#define G_DEFINE_POINTER_TYPE(TypeName, type_name) G_DEFINE_POINTER_TYPE_WITH_CODE (TypeName, type_name, {})
Packit ae235b
/**
Packit ae235b
 * G_DEFINE_POINTER_TYPE_WITH_CODE:
Packit ae235b
 * @TypeName: The name of the new type, in Camel case
Packit ae235b
 * @type_name: The name of the new type, in lowercase, with words
Packit ae235b
 *  separated by '_'
Packit ae235b
 * @_C_: Custom code that gets inserted in the *_get_type() function
Packit ae235b
 *
Packit ae235b
 * A convenience macro for pointer type implementations.
Packit ae235b
 * Similar to G_DEFINE_POINTER_TYPE(), but allows to insert
Packit ae235b
 * custom code into the type_name_get_type() function.
Packit ae235b
 *
Packit ae235b
 * Since: 2.26
Packit ae235b
 */
Packit ae235b
#define G_DEFINE_POINTER_TYPE_WITH_CODE(TypeName, type_name, _C_) _G_DEFINE_POINTER_TYPE_BEGIN (TypeName, type_name) {_C_;} _G_DEFINE_TYPE_EXTENDED_END()
Packit ae235b
Packit ae235b
#define _G_DEFINE_POINTER_TYPE_BEGIN(TypeName, type_name) \
Packit ae235b
GType \
Packit ae235b
type_name##_get_type (void) \
Packit ae235b
{ \
Packit ae235b
  static volatile gsize g_define_type_id__volatile = 0; \
Packit ae235b
  if (g_once_init_enter (&g_define_type_id__volatile))  \
Packit ae235b
    { \
Packit ae235b
      GType g_define_type_id = \
Packit ae235b
        g_pointer_type_register_static (g_intern_static_string (#TypeName)); \
Packit ae235b
      { /* custom code follows */
Packit ae235b
Packit ae235b
/* --- protected (for fundamental type implementations) --- */
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GTypePlugin*	 g_type_get_plugin		(GType		     type);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GTypePlugin*	 g_type_interface_get_plugin	(GType		     instance_type,
Packit ae235b
						 GType               interface_type);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GType		 g_type_fundamental_next	(void);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GType		 g_type_fundamental		(GType		     type_id);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GTypeInstance*   g_type_create_instance         (GType               type);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void             g_type_free_instance           (GTypeInstance      *instance);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void		 g_type_add_class_cache_func    (gpointer	     cache_data,
Packit ae235b
						 GTypeClassCacheFunc cache_func);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void		 g_type_remove_class_cache_func (gpointer	     cache_data,
Packit ae235b
						 GTypeClassCacheFunc cache_func);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void             g_type_class_unref_uncached    (gpointer            g_class);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void             g_type_add_interface_check     (gpointer	         check_data,
Packit ae235b
						 GTypeInterfaceCheckFunc check_func);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void             g_type_remove_interface_check  (gpointer	         check_data,
Packit ae235b
						 GTypeInterfaceCheckFunc check_func);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GTypeValueTable* g_type_value_table_peek        (GType		     type);
Packit ae235b
Packit ae235b
Packit ae235b
/*< private >*/
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean	 g_type_check_instance          (GTypeInstance      *instance) G_GNUC_PURE;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GTypeInstance*   g_type_check_instance_cast     (GTypeInstance      *instance,
Packit ae235b
						 GType               iface_type);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean         g_type_check_instance_is_a	(GTypeInstance      *instance,
Packit ae235b
						 GType               iface_type) G_GNUC_PURE;
Packit ae235b
GLIB_AVAILABLE_IN_2_42
Packit ae235b
gboolean         g_type_check_instance_is_fundamentally_a (GTypeInstance *instance,
Packit ae235b
                                                           GType          fundamental_type) G_GNUC_PURE;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GTypeClass*      g_type_check_class_cast        (GTypeClass         *g_class,
Packit ae235b
						 GType               is_a_type);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean         g_type_check_class_is_a        (GTypeClass         *g_class,
Packit ae235b
						 GType               is_a_type) G_GNUC_PURE;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean	 g_type_check_is_value_type     (GType		     type) G_GNUC_CONST;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean	 g_type_check_value             (const GValue       *value) G_GNUC_PURE;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean	 g_type_check_value_holds	(const GValue	    *value,
Packit ae235b
						 GType		     type) G_GNUC_PURE;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean         g_type_test_flags              (GType               type,
Packit ae235b
						 guint               flags) G_GNUC_CONST;
Packit ae235b
Packit ae235b
Packit ae235b
/* --- debugging functions --- */
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
const gchar *    g_type_name_from_instance      (GTypeInstance	*instance);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
const gchar *    g_type_name_from_class         (GTypeClass	*g_class);
Packit ae235b
Packit ae235b
Packit ae235b
/* --- implementation bits --- */
Packit ae235b
#ifndef G_DISABLE_CAST_CHECKS
Packit ae235b
#  define _G_TYPE_CIC(ip, gt, ct) \
Packit ae235b
    ((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt))
Packit ae235b
#  define _G_TYPE_CCC(cp, gt, ct) \
Packit ae235b
    ((ct*) g_type_check_class_cast ((GTypeClass*) cp, gt))
Packit ae235b
#else /* G_DISABLE_CAST_CHECKS */
Packit ae235b
#  define _G_TYPE_CIC(ip, gt, ct)       ((ct*) ip)
Packit ae235b
#  define _G_TYPE_CCC(cp, gt, ct)       ((ct*) cp)
Packit ae235b
#endif /* G_DISABLE_CAST_CHECKS */
Packit ae235b
#define _G_TYPE_CHI(ip)			(g_type_check_instance ((GTypeInstance*) ip))
Packit ae235b
#define _G_TYPE_CHV(vl)			(g_type_check_value ((GValue*) vl))
Packit ae235b
#define _G_TYPE_IGC(ip, gt, ct)         ((ct*) (((GTypeInstance*) ip)->g_class))
Packit ae235b
#define _G_TYPE_IGI(ip, gt, ct)         ((ct*) g_type_interface_peek (((GTypeInstance*) ip)->g_class, gt))
Packit ae235b
#define _G_TYPE_CIFT(ip, ft)            (g_type_check_instance_is_fundamentally_a ((GTypeInstance*) ip, ft))
Packit ae235b
#ifdef	__GNUC__
Packit ae235b
#  define _G_TYPE_CIT(ip, gt)             (G_GNUC_EXTENSION ({ \
Packit ae235b
  GTypeInstance *__inst = (GTypeInstance*) ip; GType __t = gt; gboolean __r; \
Packit ae235b
  if (!__inst) \
Packit ae235b
    __r = FALSE; \
Packit ae235b
  else if (__inst->g_class && __inst->g_class->g_type == __t) \
Packit ae235b
    __r = TRUE; \
Packit ae235b
  else \
Packit ae235b
    __r = g_type_check_instance_is_a (__inst, __t); \
Packit ae235b
  __r; \
Packit ae235b
}))
Packit ae235b
#  define _G_TYPE_CCT(cp, gt)             (G_GNUC_EXTENSION ({ \
Packit ae235b
  GTypeClass *__class = (GTypeClass*) cp; GType __t = gt; gboolean __r; \
Packit ae235b
  if (!__class) \
Packit ae235b
    __r = FALSE; \
Packit ae235b
  else if (__class->g_type == __t) \
Packit ae235b
    __r = TRUE; \
Packit ae235b
  else \
Packit ae235b
    __r = g_type_check_class_is_a (__class, __t); \
Packit ae235b
  __r; \
Packit ae235b
}))
Packit ae235b
#  define _G_TYPE_CVH(vl, gt)             (G_GNUC_EXTENSION ({ \
Packit ae235b
  const GValue *__val = (const GValue*) vl; GType __t = gt; gboolean __r; \
Packit ae235b
  if (!__val) \
Packit ae235b
    __r = FALSE; \
Packit ae235b
  else if (__val->g_type == __t)		\
Packit ae235b
    __r = TRUE; \
Packit ae235b
  else \
Packit ae235b
    __r = g_type_check_value_holds (__val, __t); \
Packit ae235b
  __r; \
Packit ae235b
}))
Packit ae235b
#else  /* !__GNUC__ */
Packit ae235b
#  define _G_TYPE_CIT(ip, gt)             (g_type_check_instance_is_a ((GTypeInstance*) ip, gt))
Packit ae235b
#  define _G_TYPE_CCT(cp, gt)             (g_type_check_class_is_a ((GTypeClass*) cp, gt))
Packit ae235b
#  define _G_TYPE_CVH(vl, gt)             (g_type_check_value_holds ((const GValue*) vl, gt))
Packit ae235b
#endif /* !__GNUC__ */
Packit ae235b
/**
Packit ae235b
 * G_TYPE_FLAG_RESERVED_ID_BIT:
Packit ae235b
 * 
Packit ae235b
 * A bit in the type number that's supposed to be left untouched.
Packit ae235b
 */
Packit ae235b
#define	G_TYPE_FLAG_RESERVED_ID_BIT	((GType) (1 << 0))
Packit ae235b
Packit ae235b
G_END_DECLS
Packit ae235b
Packit ae235b
#endif /* __G_TYPE_H__ */