1 /* GObject - GLib Type, Object, Parameter and Signal Library
2 * Copyright (C) 1998, 1999, 2000 Tim Janik and Red Hat, Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General
15 * Public License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
17 * Boston, MA 02111-1307, USA.
22 #include <gobject/gtype.h>
27 #endif /* __cplusplus */
30 /* --- type macros --- */
31 #define G_TYPE_IS_ENUM(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_ENUM)
32 #define G_ENUM_TYPE(class) (G_TYPE_FROM_CLASS (class))
33 #define G_ENUM_NAME(class) (g_type_name (G_ENUM_TYPE (class)))
34 #define G_ENUM_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_ENUM, GEnumClass))
35 #define G_IS_ENUM_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_ENUM))
36 #define G_TYPE_IS_FLAGS(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_FLAGS)
37 #define G_FLAGS_TYPE(class) (G_TYPE_FROM_CLASS (class))
38 #define G_FLAGS_NAME(class) (g_type_name (G_FLAGS_TYPE (class)))
39 #define G_FLAGS_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_FLAGS, GFlagsClass))
40 #define G_IS_FLAGS_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_FLAGS))
43 /* --- enum/flag values & classes --- */
44 typedef struct _GEnumClass GEnumClass;
45 typedef struct _GFlagsClass GFlagsClass;
46 typedef struct _GEnumValue GEnumValue;
47 typedef struct _GFlagsValue GFlagsValue;
50 GTypeClass g_type_class;
59 GTypeClass g_type_class;
79 /* --- prototypes --- */
80 GEnumValue* g_enum_get_value (GEnumClass *enum_class,
82 GEnumValue* g_enum_get_value_by_name (GEnumClass *enum_class,
84 GEnumValue* g_enum_get_value_by_nick (GEnumClass *enum_class,
86 GFlagsValue* g_flags_get_first_value (GFlagsClass *flags_class,
88 GFlagsValue* g_flags_get_value_by_name (GFlagsClass *flags_class,
90 GFlagsValue* g_flags_get_value_by_nick (GFlagsClass *flags_class,
94 /* --- registration functions --- */
95 /* const_static_values is a NULL terminated array of enum/flags
96 * values that is taken over!
98 GType g_enum_register_static (const gchar *name,
99 const GEnumValue *const_static_values);
100 GType g_flags_register_static (const gchar *name,
101 const GFlagsValue *const_static_values);
102 /* functions to complete the type information
103 * for enums/flags implemented by plugins
105 void g_enum_complete_type_info (GType g_enum_type,
107 const GEnumValue *const_values);
108 void g_flags_complete_type_info (GType g_flags_type,
110 const GFlagsValue *const_values);
116 #endif /* __cplusplus */
118 #endif /* __G_ENUMS_H__ */