📄 gtype.h
字号:
/* GObject - GLib Type, Object, Parameter and Signal Library * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. */#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)#error "Only <glib-object.h> can be included directly."#endif#ifndef __G_TYPE_H__#define __G_TYPE_H__#include <glib.h>G_BEGIN_DECLS/* Basic Type Macros *//** * G_TYPE_FUNDAMENTAL: * @type: A #GType value. * * The fundamental type which is the ancestor of @type. * Fundamental types are types that serve as ultimate bases for the derived types, * thus they are the roots of distinct inheritance hierarchies. */#define G_TYPE_FUNDAMENTAL(type) (g_type_fundamental (type))/** * G_TYPE_FUNDAMENTAL_MAX: * * An integer constant that represents the number of identifiers reserved * for types that are assigned at compile-time. */#define G_TYPE_FUNDAMENTAL_MAX (255 << G_TYPE_FUNDAMENTAL_SHIFT)/* Constant fundamental types, * introduced by g_type_init(). *//** * G_TYPE_INVALID: * * An invalid #GType used as error return value in some functions which return * a #GType. */#define G_TYPE_INVALID G_TYPE_MAKE_FUNDAMENTAL (0)/** * G_TYPE_NONE: * * A fundamental type which is used as a replacement for the C * <literal>void</literal> return type. */#define G_TYPE_NONE G_TYPE_MAKE_FUNDAMENTAL (1)/** * G_TYPE_INTERFACE: * * The fundamental type from which all interfaces are derived. */#define G_TYPE_INTERFACE G_TYPE_MAKE_FUNDAMENTAL (2)/** * G_TYPE_CHAR: * * The fundamental type corresponding to #gchar. * The type designated by G_TYPE_CHAR is unconditionally an 8-bit signed integer. * This may or may not be the same type a the C type "gchar". */#define G_TYPE_CHAR G_TYPE_MAKE_FUNDAMENTAL (3)/** * G_TYPE_UCHAR: * * The fundamental type corresponding to #guchar. */#define G_TYPE_UCHAR G_TYPE_MAKE_FUNDAMENTAL (4)/** * G_TYPE_BOOLEAN: * * The fundamental type corresponding to #gboolean. */#define G_TYPE_BOOLEAN G_TYPE_MAKE_FUNDAMENTAL (5)/** * G_TYPE_INT: * * The fundamental type corresponding to #gint. */#define G_TYPE_INT G_TYPE_MAKE_FUNDAMENTAL (6)/** * G_TYPE_UINT: * * The fundamental type corresponding to #guint. */#define G_TYPE_UINT G_TYPE_MAKE_FUNDAMENTAL (7)/** * G_TYPE_LONG: * * The fundamental type corresponding to #glong. */#define G_TYPE_LONG G_TYPE_MAKE_FUNDAMENTAL (8)/** * G_TYPE_ULONG: * * The fundamental type corresponding to #gulong. */#define G_TYPE_ULONG G_TYPE_MAKE_FUNDAMENTAL (9)/** * G_TYPE_INT64: * * The fundamental type corresponding to #gint64. */#define G_TYPE_INT64 G_TYPE_MAKE_FUNDAMENTAL (10)/** * G_TYPE_UINT64: * * The fundamental type corresponding to #guint64. */#define G_TYPE_UINT64 G_TYPE_MAKE_FUNDAMENTAL (11)/** * G_TYPE_ENUM: * * The fundamental type from which all enumeration types are derived. */#define G_TYPE_ENUM G_TYPE_MAKE_FUNDAMENTAL (12)/** * G_TYPE_FLAGS: * * The fundamental type from which all flags types are derived. */#define G_TYPE_FLAGS G_TYPE_MAKE_FUNDAMENTAL (13)/** * G_TYPE_FLOAT: * * The fundamental type corresponding to #gfloat. */#define G_TYPE_FLOAT G_TYPE_MAKE_FUNDAMENTAL (14)/** * G_TYPE_DOUBLE: * * The fundamental type corresponding to #gdouble. */#define G_TYPE_DOUBLE G_TYPE_MAKE_FUNDAMENTAL (15)/** * G_TYPE_STRING: * * The fundamental type corresponding to nul-terminated C strings. */#define G_TYPE_STRING G_TYPE_MAKE_FUNDAMENTAL (16)/** * G_TYPE_POINTER: * * The fundamental type corresponding to #gpointer. */#define G_TYPE_POINTER G_TYPE_MAKE_FUNDAMENTAL (17)/** * G_TYPE_BOXED: * * The fundamental type from which all boxed types are derived. */#define G_TYPE_BOXED G_TYPE_MAKE_FUNDAMENTAL (18)/** * G_TYPE_PARAM: * * The fundamental type from which all #GParamSpec types are derived. */#define G_TYPE_PARAM G_TYPE_MAKE_FUNDAMENTAL (19)/** * G_TYPE_OBJECT: * * The fundamental type for #GObject. */#define G_TYPE_OBJECT G_TYPE_MAKE_FUNDAMENTAL (20)/* Reserved fundamental type numbers to create new fundamental * type IDs with G_TYPE_MAKE_FUNDAMENTAL(). * Send email to gtk-devel-list@gnome.org for reservations. *//** * G_TYPE_FUNDAMENTAL_SHIFT: * * Shift value used in converting numbers to type IDs. */#define G_TYPE_FUNDAMENTAL_SHIFT (2)/** * G_TYPE_MAKE_FUNDAMENTAL: * @x: the fundamental type number. * * Get the type ID for the fundamental type number @x. * Use g_type_fundamental_next() instead of this macro to create new fundamental * types. * * Returns: the GType */#define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT))/** * G_TYPE_RESERVED_GLIB_FIRST: * * First fundamental type number to create a new fundamental type id with * G_TYPE_MAKE_FUNDAMENTAL() reserved for GLib. */#define G_TYPE_RESERVED_GLIB_FIRST (21)/** * G_TYPE_RESERVED_GLIB_LAST: * * Last fundamental type number reserved for GLib. */#define G_TYPE_RESERVED_GLIB_LAST (31)/** * G_TYPE_RESERVED_BSE_FIRST: * * First fundamental type number to create a new fundamental type id with * G_TYPE_MAKE_FUNDAMENTAL() reserved for BSE. */#define G_TYPE_RESERVED_BSE_FIRST (32)/** * G_TYPE_RESERVED_BSE_LAST: * * Last fundamental type number reserved for BSE. */#define G_TYPE_RESERVED_BSE_LAST (48)/** * G_TYPE_RESERVED_USER_FIRST: * * First available fundamental type number to create new fundamental * type id with G_TYPE_MAKE_FUNDAMENTAL(). */#define G_TYPE_RESERVED_USER_FIRST (49)/* Type Checking Macros *//** * G_TYPE_IS_FUNDAMENTAL: * @type: A #GType value. * * Checks if @type is a fundamental type. * * Returns: %TRUE on success. */#define G_TYPE_IS_FUNDAMENTAL(type) ((type) <= G_TYPE_FUNDAMENTAL_MAX)/** * G_TYPE_IS_DERIVED: * @type: A #GType value. * * Checks if @type is derived (or in object-oriented terminology: * inherited) from another type (this holds true for all non-fundamental * types). * * Returns: %TRUE on success. */#define G_TYPE_IS_DERIVED(type) ((type) > G_TYPE_FUNDAMENTAL_MAX)/** * G_TYPE_IS_INTERFACE: * @type: A #GType value. * * Checks if @type is an interface type. * An interface type provides a pure API, the implementation * of which is provided by another type (which is then said to conform * to the interface). GLib interfaces are somewhat analogous to Java * interfaces and C++ classes containing only pure virtual functions, * with the difference that GType interfaces are not derivable (but see * g_type_interface_add_prerequisite() for an alternative). * * Returns: %TRUE on success. */#define G_TYPE_IS_INTERFACE(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_INTERFACE)/** * G_TYPE_IS_CLASSED: * @type: A #GType value. * * Checks if @type is a classed type. * * Returns: %TRUE on success. */#define G_TYPE_IS_CLASSED(type) (g_type_test_flags ((type), G_TYPE_FLAG_CLASSED))/** * G_TYPE_IS_INSTANTIATABLE: * @type: A #GType value. * * Checks if @type can be instantiated. Instantiation is the * process of creating an instance (object) of this type. * * Returns: %TRUE on success. */#define G_TYPE_IS_INSTANTIATABLE(type) (g_type_test_flags ((type), G_TYPE_FLAG_INSTANTIATABLE))/** * G_TYPE_IS_DERIVABLE: * @type: A #GType value. * * Checks if @type is a derivable type. A derivable type can * be used as the base class of a flat (single-level) class hierarchy. * * Returns: %TRUE on success. */#define G_TYPE_IS_DERIVABLE(type) (g_type_test_flags ((type), G_TYPE_FLAG_DERIVABLE))/** * G_TYPE_IS_DEEP_DERIVABLE: * @type: A #GType value. * * Checks if @type is a deep derivable type. A deep derivable type * can be used as the base class of a deep (multi-level) class hierarchy. * * Returns: %TRUE on success. */#define G_TYPE_IS_DEEP_DERIVABLE(type) (g_type_test_flags ((type), G_TYPE_FLAG_DEEP_DERIVABLE))/** * G_TYPE_IS_ABSTRACT: * @type: A #GType value. * * Checks if @type is an abstract type. An abstract type can not be * instantiated and is normally used as an abstract base class for * derived classes. * * Returns: %TRUE on success. */#define G_TYPE_IS_ABSTRACT(type) (g_type_test_flags ((type), G_TYPE_FLAG_ABSTRACT))/** * G_TYPE_IS_VALUE_ABSTRACT: * @type: A #GType value. * * Checks if @type is an abstract value type. An abstract value type introduces * a value table, but can't be used for g_value_init() and is normally used as * an abstract base type for derived value types. * * Returns: %TRUE on success. */#define G_TYPE_IS_VALUE_ABSTRACT(type) (g_type_test_flags ((type), G_TYPE_FLAG_VALUE_ABSTRACT))/** * G_TYPE_IS_VALUE_TYPE: * @type: A #GType value. * * Checks if @type is a value type and can be used with g_value_init(). * * Returns: %TRUE on success. */#define G_TYPE_IS_VALUE_TYPE(type) (g_type_check_is_value_type (type))/** * G_TYPE_HAS_VALUE_TABLE: * @type: A #GType value. * * Checks if @type has a #GTypeValueTable. * * Returns: %TRUE on success. */#define G_TYPE_HAS_VALUE_TABLE(type) (g_type_value_table_peek (type) != NULL)/* Typedefs *//** * GType: * * A numerical value which represents the unique identifier of a registered * type. */#if GLIB_SIZEOF_SIZE_T != GLIB_SIZEOF_LONG || !defined __cplusplustypedef gsize GType;#else /* for historic reasons, C++ links against gulong GTypes */typedef gulong GType;#endiftypedef struct _GValue GValue;typedef union _GTypeCValue GTypeCValue;typedef struct _GTypePlugin GTypePlugin;typedef struct _GTypeClass GTypeClass;typedef struct _GTypeInterface GTypeInterface;typedef struct _GTypeInstance GTypeInstance;typedef struct _GTypeInfo GTypeInfo;typedef struct _GTypeFundamentalInfo GTypeFundamentalInfo;typedef struct _GInterfaceInfo GInterfaceInfo;typedef struct _GTypeValueTable GTypeValueTable;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -