mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-17 19:21:58 +02:00
[girepository] Move GIRegisteredTypeInfo out of ginfo.ch
This commit is contained in:
parent
94d52d910c
commit
baf36f793e
@ -7,6 +7,7 @@ girepo_HEADERS = \
|
|||||||
gierrordomaininfo.h \
|
gierrordomaininfo.h \
|
||||||
gifieldinfo.h \
|
gifieldinfo.h \
|
||||||
gifunctioninfo.h \
|
gifunctioninfo.h \
|
||||||
|
giregisteredtypeinfo.h \
|
||||||
girepository.h \
|
girepository.h \
|
||||||
girffi.h \
|
girffi.h \
|
||||||
gitypeinfo.h \
|
gitypeinfo.h \
|
||||||
@ -27,15 +28,16 @@ libgirepository_1_0_la_SOURCES = \
|
|||||||
gifunctioninfo.c \
|
gifunctioninfo.c \
|
||||||
ginfo.c \
|
ginfo.c \
|
||||||
ginvoke.c \
|
ginvoke.c \
|
||||||
|
giregisteredtypeinfo.c \
|
||||||
girepository.c \
|
girepository.c \
|
||||||
girepository-private.h \
|
girepository-private.h \
|
||||||
girffi.c \
|
girffi.c \
|
||||||
girffi.h \
|
girffi.h \
|
||||||
girffi-private.h \
|
girffi-private.h \
|
||||||
glib-compat.h \
|
|
||||||
gitypeinfo.c \
|
gitypeinfo.c \
|
||||||
gitypelib.c \
|
gitypelib.c \
|
||||||
gitypelib-internal.h
|
gitypelib-internal.h \
|
||||||
|
glib-compat.h
|
||||||
|
|
||||||
libgirepository_1_0_la_CPPFLAGS = $(GIREPO_CFLAGS)
|
libgirepository_1_0_la_CPPFLAGS = $(GIREPO_CFLAGS)
|
||||||
libgirepository_1_0_la_LIBADD = $(GIREPO_LIBS)
|
libgirepository_1_0_la_LIBADD = $(GIREPO_LIBS)
|
||||||
|
48
ginfo.c
48
ginfo.c
@ -28,54 +28,6 @@
|
|||||||
#include "gitypelib-internal.h"
|
#include "gitypelib-internal.h"
|
||||||
#include "girepository-private.h"
|
#include "girepository-private.h"
|
||||||
|
|
||||||
/* GIRegisteredTypeInfo functions */
|
|
||||||
const gchar *
|
|
||||||
g_registered_type_info_get_type_name (GIRegisteredTypeInfo *info)
|
|
||||||
{
|
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
|
||||||
RegisteredTypeBlob *blob = (RegisteredTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
||||||
|
|
||||||
if (blob->gtype_name)
|
|
||||||
return g_typelib_get_string (rinfo->typelib, blob->gtype_name);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
const gchar *
|
|
||||||
g_registered_type_info_get_type_init (GIRegisteredTypeInfo *info)
|
|
||||||
{
|
|
||||||
GIRealInfo *rinfo = (GIRealInfo *)info;
|
|
||||||
RegisteredTypeBlob *blob = (RegisteredTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
||||||
|
|
||||||
if (blob->gtype_init)
|
|
||||||
return g_typelib_get_string (rinfo->typelib, blob->gtype_init);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
GType
|
|
||||||
g_registered_type_info_get_g_type (GIRegisteredTypeInfo *info)
|
|
||||||
{
|
|
||||||
const char *type_init;
|
|
||||||
GType (* get_type_func) (void);
|
|
||||||
GIRealInfo *rinfo = (GIRealInfo*)info;
|
|
||||||
|
|
||||||
type_init = g_registered_type_info_get_type_init (info);
|
|
||||||
|
|
||||||
if (type_init == NULL)
|
|
||||||
return G_TYPE_NONE;
|
|
||||||
else if (!strcmp (type_init, "intern"))
|
|
||||||
return G_TYPE_OBJECT;
|
|
||||||
|
|
||||||
get_type_func = NULL;
|
|
||||||
if (!g_typelib_symbol (rinfo->typelib,
|
|
||||||
type_init,
|
|
||||||
(void**) &get_type_func))
|
|
||||||
return G_TYPE_NONE;
|
|
||||||
|
|
||||||
return (* get_type_func) ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* GIStructInfo functions */
|
/* GIStructInfo functions */
|
||||||
gint
|
gint
|
||||||
g_struct_info_get_n_fields (GIStructInfo *info)
|
g_struct_info_get_n_fields (GIStructInfo *info)
|
||||||
|
75
giregisteredtypeinfo.c
Normal file
75
giregisteredtypeinfo.c
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
/* GObject introspection: Registered Type implementation
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005 Matthias Clasen
|
||||||
|
* Copyright (C) 2008,2009 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
#include <girepository.h>
|
||||||
|
#include "girepository-private.h"
|
||||||
|
#include "gitypelib-internal.h"
|
||||||
|
#include "girffi.h"
|
||||||
|
|
||||||
|
const gchar *
|
||||||
|
g_registered_type_info_get_type_name (GIRegisteredTypeInfo *info)
|
||||||
|
{
|
||||||
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
|
RegisteredTypeBlob *blob = (RegisteredTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
|
if (blob->gtype_name)
|
||||||
|
return g_typelib_get_string (rinfo->typelib, blob->gtype_name);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const gchar *
|
||||||
|
g_registered_type_info_get_type_init (GIRegisteredTypeInfo *info)
|
||||||
|
{
|
||||||
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
||||||
|
RegisteredTypeBlob *blob = (RegisteredTypeBlob *)&rinfo->typelib->data[rinfo->offset];
|
||||||
|
|
||||||
|
if (blob->gtype_init)
|
||||||
|
return g_typelib_get_string (rinfo->typelib, blob->gtype_init);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
GType
|
||||||
|
g_registered_type_info_get_g_type (GIRegisteredTypeInfo *info)
|
||||||
|
{
|
||||||
|
const char *type_init;
|
||||||
|
GType (* get_type_func) (void);
|
||||||
|
GIRealInfo *rinfo = (GIRealInfo*)info;
|
||||||
|
|
||||||
|
type_init = g_registered_type_info_get_type_init (info);
|
||||||
|
|
||||||
|
if (type_init == NULL)
|
||||||
|
return G_TYPE_NONE;
|
||||||
|
else if (!strcmp (type_init, "intern"))
|
||||||
|
return G_TYPE_OBJECT;
|
||||||
|
|
||||||
|
get_type_func = NULL;
|
||||||
|
if (!g_typelib_symbol (rinfo->typelib,
|
||||||
|
type_init,
|
||||||
|
(void**) &get_type_func))
|
||||||
|
return G_TYPE_NONE;
|
||||||
|
|
||||||
|
return (* get_type_func) ();
|
||||||
|
}
|
||||||
|
|
51
giregisteredtypeinfo.h
Normal file
51
giregisteredtypeinfo.h
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/* GObject introspection: Registered Type
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005 Matthias Clasen
|
||||||
|
* Copyright (C) 2008,2009 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GIREGISTEREDTYPEINFO_H__
|
||||||
|
#define __GIREGISTEREDTYPEINFO_H__
|
||||||
|
|
||||||
|
#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
|
||||||
|
#error "Only <girepository.h> can be included directly."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <glib-object.h>
|
||||||
|
#include <gitypes.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
/* GIRegisteredTypeInfo */
|
||||||
|
|
||||||
|
#define GI_IS_REGISTERED_TYPE_INFO(info) \
|
||||||
|
((g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_ENUM) || \
|
||||||
|
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_INTERFACE) || \
|
||||||
|
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_OBJECT) || \
|
||||||
|
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_STRUCT) || \
|
||||||
|
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_UNION))
|
||||||
|
|
||||||
|
const gchar * g_registered_type_info_get_type_name (GIRegisteredTypeInfo *info);
|
||||||
|
const gchar * g_registered_type_info_get_type_init (GIRegisteredTypeInfo *info);
|
||||||
|
GType g_registered_type_info_get_g_type (GIRegisteredTypeInfo *info);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __GIREGISTEREDTYPEINFO_H__ */
|
||||||
|
|
@ -33,6 +33,7 @@
|
|||||||
#include <gierrordomaininfo.h>
|
#include <gierrordomaininfo.h>
|
||||||
#include <gifieldinfo.h>
|
#include <gifieldinfo.h>
|
||||||
#include <gifunctioninfo.h>
|
#include <gifunctioninfo.h>
|
||||||
|
#include <giregisteredtypeinfo.h>
|
||||||
#include <gitypeinfo.h>
|
#include <gitypeinfo.h>
|
||||||
#include <gitypelib.h>
|
#include <gitypelib.h>
|
||||||
#include <gitypes.h>
|
#include <gitypes.h>
|
||||||
@ -191,19 +192,6 @@ gsize g_struct_info_get_alignment (GIStructInfo *info);
|
|||||||
gboolean g_struct_info_is_gtype_struct (GIStructInfo *info);
|
gboolean g_struct_info_is_gtype_struct (GIStructInfo *info);
|
||||||
gboolean g_struct_info_is_foreign (GIStructInfo *info);
|
gboolean g_struct_info_is_foreign (GIStructInfo *info);
|
||||||
|
|
||||||
/* GIRegisteredTypeInfo */
|
|
||||||
|
|
||||||
#define GI_IS_REGISTERED_TYPE_INFO(info) \
|
|
||||||
((g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_ENUM) || \
|
|
||||||
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_INTERFACE) || \
|
|
||||||
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_OBJECT) || \
|
|
||||||
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_STRUCT) || \
|
|
||||||
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_UNION))
|
|
||||||
|
|
||||||
const gchar * g_registered_type_info_get_type_name (GIRegisteredTypeInfo *info);
|
|
||||||
const gchar * g_registered_type_info_get_type_init (GIRegisteredTypeInfo *info);
|
|
||||||
GType g_registered_type_info_get_g_type (GIRegisteredTypeInfo *info);
|
|
||||||
|
|
||||||
/* GIObjectInfo */
|
/* GIObjectInfo */
|
||||||
|
|
||||||
#define GI_IS_OBJECT_INFO(info) \
|
#define GI_IS_OBJECT_INFO(info) \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user