Add g_type_module_register_enum() and g_type_module_register_flags().

Tue Jul  6 00:54:38 2004  Matthias Clasen  <maclas@gmx.de>

	* gobject/gobject-sections.txt:
	* gobject/tmpl/gtypemodule.sgml: Add g_type_module_register_enum()
	and g_type_module_register_flags().
This commit is contained in:
Matthias Clasen 2004-07-06 04:56:36 +00:00 committed by Matthias Clasen
parent b3b1c3b3eb
commit 8414d97c5b
6 changed files with 112 additions and 15 deletions

View File

@ -1,3 +1,9 @@
Tue Jul 6 00:54:38 2004 Matthias Clasen <maclas@gmx.de>
* gobject/gobject-sections.txt:
* gobject/tmpl/gtypemodule.sgml: Add g_type_module_register_enum()
and g_type_module_register_flags().
Mon Jul 5 18:49:56 2004 Matthias Clasen <maclas@gmx.de>
* glib/tmpl/messages.sgml:

View File

@ -185,6 +185,8 @@ g_type_module_unuse
g_type_module_set_name
g_type_module_register_type
g_type_module_add_interface
g_type_module_register_enum
g_type_module_register_flags
<SUBSECTION Standard>
G_TYPE_MODULE
G_IS_TYPE_MODULE

View File

@ -145,3 +145,42 @@ not be unloaded.
@interface_info: type information structure
<!-- ##### FUNCTION g_type_module_register_enum ##### -->
<para>
Looks up or registers an enumeration that is implemented with a particular
type plugin. If a type with name @type_name was previously registered,
the #GType identifier for the type is returned, otherwise the type
is newly registered, and the resulting #GType identifier returned.
</para>
<para>
As long as any instances of the type exist, the type plugin will
not be unloaded.
</para>
@module: a #GTypeModule
@name: name for the type
@const_static_values: an array of #GEnumValue structs for the possible
enumeration values. The array is terminated by a struct with all
members being 0.
@Returns: the new or existing type ID
@Since: 2.6
<!-- ##### FUNCTION g_type_module_register_flags ##### -->
<para>
Looks up or registers a flags type that is implemented with a particular
type plugin. If a type with name @type_name was previously registered,
the #GType identifier for the type is returned, otherwise the type
is newly registered, and the resulting #GType identifier returned.
</para>
<para>
As long as any instances of the type exist, the type plugin will
not be unloaded.
</para>
@module: a #GTypeModule
@name: name for the type
@const_static_values: an array of #GFlagsValue structs for the possible
flags values. The array is terminated by a struct with all
members being 0.
@Returns: the new or existing type ID
@Since: 2.6

View File

@ -1,7 +1,15 @@
Tue Jul 6 00:46:43 2004 Matthias Clasen <maclas@gmx.de>
* gtypemodule.h:
* gtypemodule.c (g_type_module_register_flags):
* gtypemodule.c (g_type_module_register_enum): New
functions to register enum and flags types from a
GTypeModule. (#145396, Sven Neumann)
Wed Jun 23 12:55:34 2004 Matthias Clasen <maclas@gmx.de>
* gtype.h (G_DEFINE_TYPE_EXTENDED): Add an initializer for
the g_define_type_info.value_table. (#144678,Mariano
the g_define_type_info.value_table. (#144678, Mariano
Suárez-Alvarez)
Tue Jun 22 21:50:47 2004 Matthias Clasen <maclas@gmx.de>

View File

@ -387,3 +387,39 @@ g_type_module_add_interface (GTypeModule *module,
module_interface_info->loaded = TRUE;
module_interface_info->info = *interface_info;
}
void
g_type_module_register_enum (GTypeModule *module,
const gchar *name,
const GEnumValue *const_static_values)
{
GTypeInfo enum_type_info = { 0, };
g_return_val_if_fail (G_IS_TYPE_MODULE (module), 0);
g_return_val_if_fail (name != NULL, 0);
g_return_val_if_fail (const_static_values != NULL, 0);
g_enum_complete_type_info (G_TYPE_ENUM,
&enum_type_info, const_static_values);
return g_type_module_register_type (G_TYPE_MODULE (module),
G_TYPE_ENUM, name, &enum_type_info, 0);
}
void
g_type_module_register_flags (GTypeModule *module,
const gchar *name,
const GFlagsValue *const_static_values)
{
GTypeInfo flags_type_info = { 0, };
g_return_val_if_fail (G_IS_TYPE_MODULE (module), 0);
g_return_val_if_fail (name != NULL, 0);
g_return_val_if_fail (const_static_values != NULL, 0);
g_flags_complete_type_info (G_TYPE_FLAGS,
&flags_type_info, const_static_values);
return g_type_module_register_type (G_TYPE_MODULE (module),
G_TYPE_FLAGS, name, &flags_type_info, 0);
}

View File

@ -65,20 +65,26 @@ struct _GTypeModuleClass
void (*reserved4) (void);
};
GType g_type_module_get_type (void);
gboolean g_type_module_use (GTypeModule *module);
void g_type_module_unuse (GTypeModule *module);
void g_type_module_set_name (GTypeModule *module,
const gchar *name);
GType g_type_module_register_type (GTypeModule *module,
GType parent_type,
const gchar *type_name,
const GTypeInfo *type_info,
GTypeFlags flags);
void g_type_module_add_interface (GTypeModule *module,
GType instance_type,
GType interface_type,
const GInterfaceInfo *interface_info);
GType g_type_module_get_type (void);
gboolean g_type_module_use (GTypeModule *module);
void g_type_module_unuse (GTypeModule *module);
void g_type_module_set_name (GTypeModule *module,
const gchar *name);
GType g_type_module_register_type (GTypeModule *module,
GType parent_type,
const gchar *type_name,
const GTypeInfo *type_info,
GTypeFlags flags);
void g_type_module_add_interface (GTypeModule *module,
GType instance_type,
GType interface_type,
const GInterfaceInfo *interface_info);
void g_type_module_register_enum (GTypeModule *module,
const gchar *name,
const GEnumValue *const_static_values);
void g_type_module_register_flags (GTypeModule *module,
const gchar *name,
const GFlagsValue *const_static_values);
G_END_DECLS