[gobject-introspection] [girepository] Move GIFieldInfo out of ginfo.ch



commit 378983df54a52c7cd6c1addea9c2f9536298c542
Author: Johan Dahlin <johan gnome org>
Date:   Sun Jun 6 13:11:23 2010 -0300

    [girepository] Move GIFieldInfo out of ginfo.ch

 girepository/Makefile.am    |    2 +
 girepository/gifieldinfo.c  |   98 +++++++++++++++++++++++++++++++++++++++++++
 girepository/gifieldinfo.h  |   52 +++++++++++++++++++++++
 girepository/ginfo.c        |   73 --------------------------------
 girepository/girepository.h |   19 +--------
 5 files changed, 153 insertions(+), 91 deletions(-)
---
diff --git a/girepository/Makefile.am b/girepository/Makefile.am
index 836f28a..24457c9 100644
--- a/girepository/Makefile.am
+++ b/girepository/Makefile.am
@@ -5,6 +5,7 @@ girepo_HEADERS =				\
     gicallableinfo.h				\
     gienuminfo.h				\
     gierrordomaininfo.h				\
+    gifieldinfo.h				\
     gifunctioninfo.h				\
     girepository.h				\
     girffi.h					\
@@ -23,6 +24,7 @@ libgirepository_1_0_la_SOURCES =		\
 	gicallableinfo.c			\
 	gienuminfo.c				\
 	gierrordomaininfo.c			\
+	gifieldinfo.c				\
 	gifunctioninfo.c			\
 	ginfo.c                                 \
 	ginvoke.c				\
diff --git a/girepository/gifieldinfo.c b/girepository/gifieldinfo.c
new file mode 100644
index 0000000..a04124a
--- /dev/null
+++ b/girepository/gifieldinfo.c
@@ -0,0 +1,98 @@
+/* GObject introspection: Field 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"
+
+/**
+ * SECTION:gifieldinfo
+ * @Short_description: Struct representing a struct or union field
+ * @Title: GIFieldInfo
+ *
+ * A GIFieldInfo struct represents a field of a struct (see #GIStructInfo),
+ * union (see #GIUnionInfo) or an object (see #GIObjectInfo). The GIFieldInfo
+ * is fetched by calling g_struct_info_get_field(), g_union_info_get_field()
+ * or g_object_info_get_value().
+ * A field has a size, type and a struct offset asssociated and a set of flags,
+ * which is currently #GI_FIELD_IS_READABLE or #GI_FIELD_IS_WRITABLE.
+ */
+
+GIFieldInfoFlags
+g_field_info_get_flags (GIFieldInfo *info)
+{
+  GIFieldInfoFlags flags;
+
+  GIRealInfo *rinfo = (GIRealInfo *)info;
+  FieldBlob *blob = (FieldBlob *)&rinfo->typelib->data[rinfo->offset];
+
+  flags = 0;
+
+  if (blob->readable)
+    flags = flags | GI_FIELD_IS_READABLE;
+
+  if (blob->writable)
+    flags = flags | GI_FIELD_IS_WRITABLE;
+
+  return flags;
+}
+
+gint
+g_field_info_get_size (GIFieldInfo *info)
+{
+  GIRealInfo *rinfo = (GIRealInfo *)info;
+  FieldBlob *blob = (FieldBlob *)&rinfo->typelib->data[rinfo->offset];
+
+  return blob->bits;
+}
+
+gint
+g_field_info_get_offset (GIFieldInfo *info)
+{
+  GIRealInfo *rinfo = (GIRealInfo *)info;
+  FieldBlob *blob = (FieldBlob *)&rinfo->typelib->data[rinfo->offset];
+
+  return blob->struct_offset;
+}
+
+GITypeInfo *
+g_field_info_get_type (GIFieldInfo *info)
+{
+  GIRealInfo *rinfo = (GIRealInfo *)info;
+  Header *header = (Header *)rinfo->typelib->data;
+  FieldBlob *blob = (FieldBlob *)&rinfo->typelib->data[rinfo->offset];
+  GIRealInfo *type_info;
+
+  if (blob->has_embedded_type)
+    {
+      type_info = (GIRealInfo *) g_info_new (GI_INFO_TYPE_TYPE,
+                                                (GIBaseInfo*)info, rinfo->typelib,
+                                                rinfo->offset + header->field_blob_size);
+      type_info->type_is_embedded = TRUE;
+    }
+  else
+    return _g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (FieldBlob, type));
+
+  return (GIBaseInfo*)type_info;
+}
+
diff --git a/girepository/gifieldinfo.h b/girepository/gifieldinfo.h
new file mode 100644
index 0000000..5d5970b
--- /dev/null
+++ b/girepository/gifieldinfo.h
@@ -0,0 +1,52 @@
+/* GObject introspection: Field and Field values
+ *
+ * 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 __GIFIELDINFO_H__
+#define __GIFIELDINFO_H__
+
+#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
+#error "Only <girepository.h> can be included directly."
+#endif
+
+#include <gitypes.h>
+
+G_BEGIN_DECLS
+
+#define GI_IS_FIELD_INFO(info) \
+    (g_base_info_get_type((GIBaseInfo*)info) ==  GI_INFO_TYPE_FIELD)
+
+GIFieldInfoFlags       g_field_info_get_flags      (GIFieldInfo *info);
+gint                   g_field_info_get_size       (GIFieldInfo *info);
+gint                   g_field_info_get_offset     (GIFieldInfo *info);
+GITypeInfo *           g_field_info_get_type       (GIFieldInfo *info);
+
+gboolean g_field_info_get_field (GIFieldInfo     *field_info,
+				 gpointer         mem,
+				 GArgument       *value);
+gboolean g_field_info_set_field (GIFieldInfo     *field_info,
+				 gpointer         mem,
+				 const GArgument *value);
+
+G_END_DECLS
+
+
+#endif  /* __GIFIELDINFO_H__ */
+
diff --git a/girepository/ginfo.c b/girepository/ginfo.c
index 5c5d0e4..825ad5d 100644
--- a/girepository/ginfo.c
+++ b/girepository/ginfo.c
@@ -28,79 +28,6 @@
 #include "gitypelib-internal.h"
 #include "girepository-private.h"
 
-/* GIFieldInfo functions */
-
-/**
- * SECTION:gifieldinfo
- * @Short_description: Struct representing a struct or union field
- * @Title: GIFieldInfo
- *
- * A GIFieldInfo struct represents a field of a struct (see #GIStructInfo),
- * union (see #GIUnionInfo) or an object (see #GIObjectInfo). The GIFieldInfo
- * is fetched by calling g_struct_info_get_field(), g_union_info_get_field()
- * or g_object_info_get_value().
- * A field has a size, type and a struct offset asssociated and a set of flags,
- * which is currently #GI_FIELD_IS_READABLE or #GI_FIELD_IS_WRITABLE.
- */
-
-GIFieldInfoFlags
-g_field_info_get_flags (GIFieldInfo *info)
-{
-  GIFieldInfoFlags flags;
-
-  GIRealInfo *rinfo = (GIRealInfo *)info;
-  FieldBlob *blob = (FieldBlob *)&rinfo->typelib->data[rinfo->offset];
-
-  flags = 0;
-
-  if (blob->readable)
-    flags = flags | GI_FIELD_IS_READABLE;
-
-  if (blob->writable)
-    flags = flags | GI_FIELD_IS_WRITABLE;
-
-  return flags;
-}
-
-gint
-g_field_info_get_size (GIFieldInfo *info)
-{
-  GIRealInfo *rinfo = (GIRealInfo *)info;
-  FieldBlob *blob = (FieldBlob *)&rinfo->typelib->data[rinfo->offset];
-
-  return blob->bits;
-}
-
-gint
-g_field_info_get_offset (GIFieldInfo *info)
-{
-  GIRealInfo *rinfo = (GIRealInfo *)info;
-  FieldBlob *blob = (FieldBlob *)&rinfo->typelib->data[rinfo->offset];
-
-  return blob->struct_offset;
-}
-
-GITypeInfo *
-g_field_info_get_type (GIFieldInfo *info)
-{
-  GIRealInfo *rinfo = (GIRealInfo *)info;
-  Header *header = (Header *)rinfo->typelib->data;
-  FieldBlob *blob = (FieldBlob *)&rinfo->typelib->data[rinfo->offset];
-  GIRealInfo *type_info;
-
-  if (blob->has_embedded_type)
-    {
-      type_info = (GIRealInfo *) g_info_new (GI_INFO_TYPE_TYPE,
-                                                (GIBaseInfo*)info, rinfo->typelib,
-                                                rinfo->offset + header->field_blob_size);
-      type_info->type_is_embedded = TRUE;
-    }
-  else
-    return _g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (FieldBlob, type));
-
-  return (GIBaseInfo*)type_info;
-}
-
 /* GIRegisteredTypeInfo functions */
 const gchar *
 g_registered_type_info_get_type_name (GIRegisteredTypeInfo *info)
diff --git a/girepository/girepository.h b/girepository/girepository.h
index c9ebca6..d038459 100644
--- a/girepository/girepository.h
+++ b/girepository/girepository.h
@@ -31,6 +31,7 @@
 #include <gicallableinfo.h>
 #include <gienuminfo.h>
 #include <gierrordomaininfo.h>
+#include <gifieldinfo.h>
 #include <gifunctioninfo.h>
 #include <gitypeinfo.h>
 #include <gitypelib.h>
@@ -150,24 +151,6 @@ void gi_cclosure_marshal_generic (GClosure       *closure,
                                   gpointer        invocation_hint,
                                   gpointer        marshal_data);
 
-
-/* GIFieldInfo */
-
-#define GI_IS_FIELD_INFO(info) \
-    (g_base_info_get_type((GIBaseInfo*)info) ==  GI_INFO_TYPE_FIELD)
-
-GIFieldInfoFlags       g_field_info_get_flags      (GIFieldInfo *info);
-gint                   g_field_info_get_size       (GIFieldInfo *info);
-gint                   g_field_info_get_offset     (GIFieldInfo *info);
-GITypeInfo *           g_field_info_get_type       (GIFieldInfo *info);
-
-gboolean g_field_info_get_field (GIFieldInfo     *field_info,
-				 gpointer         mem,
-				 GArgument       *value);
-gboolean g_field_info_set_field (GIFieldInfo     *field_info,
-				 gpointer         mem,
-				 const GArgument *value);
-
 /* GIUnionInfo */
 
 #define GI_IS_UNION_INFO(info) \



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]