[girepository] Move GIRegisteredTypeInfo out of ginfo.ch
authorJohan Dahlin <johan@gnome.org>
Sun, 6 Jun 2010 22:28:35 +0000 (19:28 -0300)
committerJohan Dahlin <johan@gnome.org>
Sun, 6 Jun 2010 22:28:35 +0000 (19:28 -0300)
girepository/Makefile.am
girepository/ginfo.c
girepository/giregisteredtypeinfo.c [new file with mode: 0644]
girepository/giregisteredtypeinfo.h [new file with mode: 0644]
girepository/girepository.h

index 8fccc93..34cdfab 100644 (file)
@@ -7,6 +7,7 @@ girepo_HEADERS =                                \
     gierrordomaininfo.h                                \
     gifieldinfo.h                              \
     gifunctioninfo.h                           \
+    giregisteredtypeinfo.h                     \
     girepository.h                             \
     girffi.h                                   \
     gitypeinfo.h                               \
@@ -27,15 +28,16 @@ libgirepository_1_0_la_SOURCES =            \
        gifunctioninfo.c                        \
        ginfo.c                                 \
        ginvoke.c                               \
+       giregisteredtypeinfo.c                  \
        girepository.c                          \
        girepository-private.h                  \
        girffi.c                                \
        girffi.h                                \
        girffi-private.h                        \
-       glib-compat.h                           \
        gitypeinfo.c                            \
        gitypelib.c                             \
-       gitypelib-internal.h
+       gitypelib-internal.h                    \
+       glib-compat.h
 
 libgirepository_1_0_la_CPPFLAGS = $(GIREPO_CFLAGS)
 libgirepository_1_0_la_LIBADD = $(GIREPO_LIBS)
index 825ad5d..5048431 100644 (file)
 #include "gitypelib-internal.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 */
 gint
 g_struct_info_get_n_fields (GIStructInfo *info)
diff --git a/girepository/giregisteredtypeinfo.c b/girepository/giregisteredtypeinfo.c
new file mode 100644 (file)
index 0000000..944444f
--- /dev/null
@@ -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) ();
+}
+
diff --git a/girepository/giregisteredtypeinfo.h b/girepository/giregisteredtypeinfo.h
new file mode 100644 (file)
index 0000000..8a63321
--- /dev/null
@@ -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__ */
+
index d038459..47d02b5 100644 (file)
@@ -33,6 +33,7 @@
 #include <gierrordomaininfo.h>
 #include <gifieldinfo.h>
 #include <gifunctioninfo.h>
+#include <giregisteredtypeinfo.h>
 #include <gitypeinfo.h>
 #include <gitypelib.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_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 */
 
 #define GI_IS_OBJECT_INFO(info) \