1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
2 * GObject introspection: Object implementation
4 * Copyright (C) 2005 Matthias Clasen
5 * Copyright (C) 2008,2009 Red Hat, Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
25 #include <girepository.h>
26 #include "girepository-private.h"
27 #include "gitypelib-internal.h"
30 * SECTION:giobjectinfo
31 * @title: GIObjectInfo
32 * @short_description: Struct representing a GObject
34 * GIObjectInfo represents a #GObject. This doesn't represent a specific
35 * instance of a GObject, instead this represent the object type (eg class).
37 * A GObject has methods, fields, properties, signals, interfaces, constants
38 * and virtual functions.
40 * <refsect1 id="gi-giobjectinfo.struct-hierarchy" role="struct_hierarchy">
41 * <title role="struct_hierarchy.title">Struct hierarchy</title>
43 * <link linkend="gi-GIBaseInfo">GIBaseInfo</link>
44 * +----<link linkend="gi-GIRegisteredTypeInfo">GIRegisteredTypeInfo</link>
51 * g_object_info_get_parent:
52 * @info: a #GIObjectInfo
54 * Obtain the parent of the object type.
56 * Returns: (transfer full): the #GIObjectInfo. Free the struct by calling
57 * g_base_info_unref() when done.
60 g_object_info_get_parent (GIObjectInfo *info)
62 GIRealInfo *rinfo = (GIRealInfo *)info;
65 g_return_val_if_fail (info != NULL, NULL);
66 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
68 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
71 return (GIObjectInfo *) _g_info_from_entry (rinfo->repository,
72 rinfo->typelib, blob->parent);
78 * g_object_info_get_abstract:
79 * @info: a #GIObjectInfo
81 * Obtain if the object type is an abstract type, eg if it cannot be
84 * Returns: %TRUE if the object type is abstract
87 g_object_info_get_abstract (GIObjectInfo *info)
89 GIRealInfo *rinfo = (GIRealInfo *)info;
92 g_return_val_if_fail (info != NULL, FALSE);
93 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), FALSE);
95 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
97 return blob->abstract != 0;
101 * g_object_info_get_fundamental:
102 * @info: a #GIObjectInfo
104 * Obtain if the object type is of a fundamental type which is not
105 * G_TYPE_OBJECT. This is mostly for supporting GstMiniObject.
107 * Returns: %TRUE if the object type is a fundamental type
110 g_object_info_get_fundamental (GIObjectInfo *info)
112 GIRealInfo *rinfo = (GIRealInfo *)info;
115 g_return_val_if_fail (info != NULL, FALSE);
116 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), FALSE);
118 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
120 return blob->fundamental != 0;
124 * g_object_info_get_type_name:
125 * @info: a #GIObjectInfo
127 * Obtain the name of the objects class/type.
129 * Returns: name of the objects type
132 g_object_info_get_type_name (GIObjectInfo *info)
134 GIRealInfo *rinfo = (GIRealInfo *)info;
137 g_return_val_if_fail (info != NULL, NULL);
138 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
140 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
142 return g_typelib_get_string (rinfo->typelib, blob->gtype_name);
146 * g_object_info_get_type_init:
147 * @info: a #GIObjectInfo
149 * Obtain the function which when called will return the GType
150 * function for which this object type is registered.
152 * Returns: the type init function
155 g_object_info_get_type_init (GIObjectInfo *info)
157 GIRealInfo *rinfo = (GIRealInfo *)info;
160 g_return_val_if_fail (info != NULL, NULL);
161 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
163 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
165 return g_typelib_get_string (rinfo->typelib, blob->gtype_init);
169 * g_object_info_get_n_interfaces:
170 * @info: a #GIObjectInfo
172 * Obtain the number of interfaces that this object type has.
174 * Returns: number of interfaces
177 g_object_info_get_n_interfaces (GIObjectInfo *info)
179 GIRealInfo *rinfo = (GIRealInfo *)info;
182 g_return_val_if_fail (info != NULL, 0);
183 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), 0);
185 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
187 return blob->n_interfaces;
191 * g_object_info_get_interface:
192 * @info: a #GIObjectInfo
193 * @n: index of interface to get
195 * Obtain an object type interface at index @n.
197 * Returns: (transfer full): the #GIInterfaceInfo. Free the struct by calling
198 * g_base_info_unref() when done.
201 g_object_info_get_interface (GIObjectInfo *info,
204 GIRealInfo *rinfo = (GIRealInfo *)info;
207 g_return_val_if_fail (info != NULL, NULL);
208 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
210 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
212 return (GIInterfaceInfo *) _g_info_from_entry (rinfo->repository,
213 rinfo->typelib, blob->interfaces[n]);
217 * g_object_info_get_n_fields:
218 * @info: a #GIObjectInfo
220 * Obtain the number of fields that this object type has.
222 * Returns: number of fields
225 g_object_info_get_n_fields (GIObjectInfo *info)
227 GIRealInfo *rinfo = (GIRealInfo *)info;
230 g_return_val_if_fail (info != NULL, 0);
231 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), 0);
233 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
235 return blob->n_fields;
239 * g_object_info_get_field:
240 * @info: a #GIObjectInfo
241 * @n: index of field to get
243 * Obtain an object type field at index @n.
245 * Returns: (transfer full): the #GIFieldInfo. Free the struct by calling
246 * g_base_info_unref() when done.
249 g_object_info_get_field (GIObjectInfo *info,
253 GIRealInfo *rinfo = (GIRealInfo *)info;
257 g_return_val_if_fail (info != NULL, NULL);
258 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
260 header = (Header *)rinfo->typelib->data;
261 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
263 offset = rinfo->offset + header->object_blob_size
264 + (blob->n_interfaces + blob->n_interfaces % 2) * 2
265 + n * header->field_blob_size;
267 return (GIFieldInfo *) g_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib, offset);
271 * g_object_info_get_n_properties:
272 * @info: a #GIObjectInfo
274 * Obtain the number of properties that this object type has.
276 * Returns: number of properties
279 g_object_info_get_n_properties (GIObjectInfo *info)
281 GIRealInfo *rinfo = (GIRealInfo *)info;
284 g_return_val_if_fail (info != NULL, 0);
285 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), 0);
287 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
288 return blob->n_properties;
292 * g_object_info_get_property:
293 * @info: a #GIObjectInfo
294 * @n: index of property to get
296 * Obtain an object type property at index @n.
298 * Returns: (transfer full): the #GIPropertyInfo. Free the struct by calling
299 * g_base_info_unref() when done.
302 g_object_info_get_property (GIObjectInfo *info,
306 GIRealInfo *rinfo = (GIRealInfo *)info;
310 g_return_val_if_fail (info != NULL, NULL);
311 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
313 header = (Header *)rinfo->typelib->data;
314 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
316 offset = rinfo->offset + header->object_blob_size
317 + (blob->n_interfaces + blob->n_interfaces % 2) * 2
318 + blob->n_fields * header->field_blob_size
319 + n * header->property_blob_size;
321 return (GIPropertyInfo *) g_info_new (GI_INFO_TYPE_PROPERTY, (GIBaseInfo*)info,
322 rinfo->typelib, offset);
326 * g_object_info_get_n_methods:
327 * @info: a #GIObjectInfo
329 * Obtain the number of methods that this object type has.
331 * Returns: number of methods
334 g_object_info_get_n_methods (GIObjectInfo *info)
336 GIRealInfo *rinfo = (GIRealInfo *)info;
339 g_return_val_if_fail (info != NULL, 0);
340 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), 0);
342 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
344 return blob->n_methods;
348 * g_object_info_get_method:
349 * @info: a #GIObjectInfo
350 * @n: index of method to get
352 * Obtain an object type method at index @n.
354 * Returns: (transfer full): the #GIFunctionInfo. Free the struct by calling
355 * g_base_info_unref() when done.
358 g_object_info_get_method (GIObjectInfo *info,
362 GIRealInfo *rinfo = (GIRealInfo *)info;
366 g_return_val_if_fail (info != NULL, NULL);
367 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
369 header = (Header *)rinfo->typelib->data;
370 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
373 offset = rinfo->offset + header->object_blob_size
374 + (blob->n_interfaces + blob->n_interfaces % 2) * 2
375 + blob->n_fields * header->field_blob_size
376 + blob->n_properties * header->property_blob_size
377 + n * header->function_blob_size;
379 return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
380 rinfo->typelib, offset);
384 * g_object_info_find_method:
385 * @info: a #GIObjectInfo
386 * @name: name of method to obtain
388 * Obtain a method of the object type given a @name. %NULL will be
389 * returned if there's no method available with that name.
391 * Returns: (transfer full): the #GIFunctionInfo. Free the struct by calling
392 * g_base_info_unref() when done.
395 g_object_info_find_method (GIObjectInfo *info,
399 GIRealInfo *rinfo = (GIRealInfo *)info;
403 g_return_val_if_fail (info != NULL, 0);
404 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), 0);
406 header = (Header *)rinfo->typelib->data;
407 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
409 offset = rinfo->offset + header->object_blob_size
410 + (blob->n_interfaces + blob->n_interfaces % 2) * 2
411 + blob->n_fields * header->field_blob_size +
412 + blob->n_properties * header->property_blob_size;
414 return _g_base_info_find_method ((GIBaseInfo*)info, offset, blob->n_methods, name);
418 * g_object_info_find_method_using_interfaces:
419 * @info: a #GIObjectInfo
420 * @name: name of method to obtain
421 * @implementor: (out) (transfer full): The implementor of the interface
423 * Obtain a method of the object given a @name, searching both the
424 * object @info and any interfaces it implements. %NULL will be
425 * returned if there's no method available with that name.
427 * Note that this function does *not* search parent classes; you will have
428 * to chain up if that's desired.
430 * Returns: (transfer full): the #GIFunctionInfo. Free the struct by calling
431 * g_base_info_unref() when done.
434 g_object_info_find_method_using_interfaces (GIObjectInfo *info,
436 GIObjectInfo **implementor)
438 GIFunctionInfo *result = NULL;
439 GIObjectInfo *implementor_result = NULL;
441 result = g_object_info_find_method (info, name);
443 implementor_result = g_base_info_ref ((GIBaseInfo*) info);
450 n_interfaces = g_object_info_get_n_interfaces (info);
451 for (i = 0; i < n_interfaces; ++i)
453 GIInterfaceInfo *iface_info;
455 iface_info = g_object_info_get_interface (info, i);
457 result = g_interface_info_find_method (iface_info, name);
461 implementor_result = iface_info;
464 g_base_info_unref ((GIBaseInfo*) iface_info);
468 *implementor = implementor_result;
469 else if (implementor_result != NULL)
470 g_base_info_unref ((GIBaseInfo*) implementor_result);
475 * g_object_info_get_n_signals:
476 * @info: a #GIObjectInfo
478 * Obtain the number of signals that this object type has.
480 * Returns: number of signals
483 g_object_info_get_n_signals (GIObjectInfo *info)
485 GIRealInfo *rinfo = (GIRealInfo *)info;
488 g_return_val_if_fail (info != NULL, 0);
489 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), 0);
491 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
493 return blob->n_signals;
497 * g_object_info_get_signal:
498 * @info: a #GIObjectInfo
499 * @n: index of signal to get
501 * Obtain an object type signal at index @n.
503 * Returns: (transfer full): the #GISignalInfo. Free the struct by calling
504 * g_base_info_unref() when done.
507 g_object_info_get_signal (GIObjectInfo *info,
511 GIRealInfo *rinfo = (GIRealInfo *)info;
515 g_return_val_if_fail (info != NULL, NULL);
516 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
518 header = (Header *)rinfo->typelib->data;
519 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
521 offset = rinfo->offset + header->object_blob_size
522 + (blob->n_interfaces + blob->n_interfaces % 2) * 2
523 + blob->n_fields * header->field_blob_size
524 + blob->n_properties * header->property_blob_size
525 + blob->n_methods * header->function_blob_size
526 + n * header->signal_blob_size;
528 return (GISignalInfo *) g_info_new (GI_INFO_TYPE_SIGNAL, (GIBaseInfo*)info,
529 rinfo->typelib, offset);
533 * g_object_info_find_signal:
534 * @info: a #GIObjectInfo
535 * @name: Name of signal
539 * Returns: Info for the signal with name @name in @info, or %NULL on failure.
542 g_object_info_find_signal (GIObjectInfo *info,
548 n_signals = g_object_info_get_n_signals (info);
549 for (i = 0; i < n_signals; i++)
551 GISignalInfo *siginfo = g_object_info_get_signal (info, i);
553 if (g_strcmp0 (g_base_info_get_name (siginfo), name) != 0)
555 g_base_info_unref ((GIBaseInfo*)siginfo);
566 * g_object_info_get_n_vfuncs:
567 * @info: a #GIObjectInfo
569 * Obtain the number of virtual functions that this object type has.
571 * Returns: number of virtual functions
574 g_object_info_get_n_vfuncs (GIObjectInfo *info)
576 GIRealInfo *rinfo = (GIRealInfo *)info;
579 g_return_val_if_fail (info != NULL, 0);
580 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), 0);
582 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
584 return blob->n_vfuncs;
588 * g_object_info_get_vfunc:
589 * @info: a #GIObjectInfo
590 * @n: index of virtual function to get
592 * Obtain an object type virtual function at index @n.
594 * Returns: (transfer full): the #GIVFuncInfo. Free the struct by calling
595 * g_base_info_unref() when done.
598 g_object_info_get_vfunc (GIObjectInfo *info,
602 GIRealInfo *rinfo = (GIRealInfo *)info;
606 g_return_val_if_fail (info != NULL, NULL);
607 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
609 header = (Header *)rinfo->typelib->data;
610 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
612 offset = rinfo->offset + header->object_blob_size
613 + (blob->n_interfaces + blob->n_interfaces % 2) * 2
614 + blob->n_fields * header->field_blob_size
615 + blob->n_properties * header->property_blob_size
616 + blob->n_methods * header->function_blob_size
617 + blob->n_signals * header->signal_blob_size
618 + n * header->vfunc_blob_size;
620 return (GIVFuncInfo *) g_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*)info,
621 rinfo->typelib, offset);
625 * g_object_info_find_vfunc:
626 * @info: a #GIObjectInfo
627 * @name: The name of a virtual function to find.
629 * Locate a virtual function slot with name @name. Note that the namespace
630 * for virtuals is distinct from that of methods; there may or may not be
631 * a concrete method associated for a virtual. If there is one, it may
632 * be retrieved using g_vfunc_info_get_invoker(), otherwise %NULL will be
634 * See the documentation for g_vfunc_info_get_invoker() for more
635 * information on invoking virtuals.
637 * Returns: (transfer full): the #GIVFuncInfo, or %NULL. Free it with
638 * g_base_info_unref() when done.
641 g_object_info_find_vfunc (GIObjectInfo *info,
645 GIRealInfo *rinfo = (GIRealInfo *)info;
649 g_return_val_if_fail (info != NULL, NULL);
650 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
652 header = (Header *)rinfo->typelib->data;
653 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
655 offset = rinfo->offset + header->object_blob_size
656 + (blob->n_interfaces + blob->n_interfaces % 2) * 2
657 + blob->n_fields * header->field_blob_size
658 + blob->n_properties * header->property_blob_size
659 + blob->n_methods * header->function_blob_size
660 + blob->n_signals * header->signal_blob_size;
662 return _g_base_info_find_vfunc (rinfo, offset, blob->n_vfuncs, name);
666 * g_object_info_find_vfunc_using_interfaces:
667 * @info: a #GIObjectInfo
668 * @name: name of method to obtain
669 * @implementor: (out) (transfer full): The implementor of the interface
671 * Locate a virtual function slot with name @name, searching both the object
672 * @info and any interfaces it implements. Note that the namespace for
673 * virtuals is distinct from that of methods; there may or may not be a
674 * concrete method associated for a virtual. If there is one, it may be
675 * retrieved using g_vfunc_info_get_invoker(), otherwise %NULL will be
678 * Note that this function does *not* search parent classes; you will have
679 * to chain up if that's desired.
681 * Returns: (transfer full): the #GIFunctionInfo. Free the struct by calling
682 * g_base_info_unref() when done.
685 g_object_info_find_vfunc_using_interfaces (GIObjectInfo *info,
687 GIObjectInfo **implementor)
689 GIVFuncInfo *result = NULL;
690 GIObjectInfo *implementor_result = NULL;
692 result = g_object_info_find_vfunc (info, name);
694 implementor_result = g_base_info_ref ((GIBaseInfo*) info);
701 n_interfaces = g_object_info_get_n_interfaces (info);
702 for (i = 0; i < n_interfaces; ++i)
704 GIInterfaceInfo *iface_info;
706 iface_info = g_object_info_get_interface (info, i);
708 result = g_interface_info_find_vfunc (iface_info, name);
712 implementor_result = iface_info;
715 g_base_info_unref ((GIBaseInfo*) iface_info);
719 *implementor = implementor_result;
720 else if (implementor_result != NULL)
721 g_base_info_unref ((GIBaseInfo*) implementor_result);
726 * g_object_info_get_n_constants:
727 * @info: a #GIObjectInfo
729 * Obtain the number of constants that this object type has.
731 * Returns: number of constants
734 g_object_info_get_n_constants (GIObjectInfo *info)
736 GIRealInfo *rinfo = (GIRealInfo *)info;
739 g_return_val_if_fail (info != NULL, 0);
740 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), 0);
742 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
744 return blob->n_constants;
748 * g_object_info_get_constant:
749 * @info: a #GIObjectInfo
750 * @n: index of constant to get
752 * Obtain an object type constant at index @n.
754 * Returns: (transfer full): the #GIConstantInfo. Free the struct by calling
755 * g_base_info_unref() when done.
758 g_object_info_get_constant (GIObjectInfo *info,
762 GIRealInfo *rinfo = (GIRealInfo *)info;
766 g_return_val_if_fail (info != NULL, NULL);
767 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
769 header = (Header *)rinfo->typelib->data;
770 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
772 offset = rinfo->offset + header->object_blob_size
773 + (blob->n_interfaces + blob->n_interfaces % 2) * 2
774 + blob->n_fields * header->field_blob_size
775 + blob->n_properties * header->property_blob_size
776 + blob->n_methods * header->function_blob_size
777 + blob->n_signals * header->signal_blob_size
778 + blob->n_vfuncs * header->vfunc_blob_size
779 + n * header->constant_blob_size;
781 return (GIConstantInfo *) g_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
782 rinfo->typelib, offset);
786 * g_object_info_get_class_struct:
787 * @info: a #GIObjectInfo
789 * Every #GObject has two structures; an instance structure and a class
790 * structure. This function returns the metadata for the class structure.
792 * Returns: (transfer full): the #GIStructInfo or %NULL. Free with
793 * g_base_info_unref() when done.
796 g_object_info_get_class_struct (GIObjectInfo *info)
798 GIRealInfo *rinfo = (GIRealInfo *)info;
801 g_return_val_if_fail (info != NULL, NULL);
802 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
804 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
806 if (blob->gtype_struct)
807 return (GIStructInfo *) _g_info_from_entry (rinfo->repository,
808 rinfo->typelib, blob->gtype_struct);
813 typedef const char* (*SymbolGetter) (GIObjectInfo *info);
816 _get_func(GIObjectInfo *info,
820 GSList *parents = NULL, *l;
821 GIObjectInfo *parent_info;
822 gpointer func = NULL;
824 parent_info = g_base_info_ref (info);
825 while (parent_info != NULL)
827 parents = g_slist_prepend (parents, parent_info);
828 parent_info = g_object_info_get_parent (parent_info);
831 for (l = parents; l; l = l->next)
833 parent_info = l->data;
834 symbol = getter (parent_info);
838 g_typelib_symbol (((GIRealInfo *)parent_info)->typelib, symbol, (gpointer*) &func);
843 g_slist_free_full (parents, (GDestroyNotify) g_base_info_unref);
848 * g_object_info_get_ref_function:
849 * @info: a #GIObjectInfo
851 * Obtain the symbol name of the function that should be called to ref this
852 * object type. It's mainly used fundamental types. The type signature for
853 * the symbol is %GIObjectInfoRefFunction, to fetch the function pointer
854 * see g_object_info_get_ref_function().
856 * Returns: the symbol or %NULL
859 g_object_info_get_ref_function (GIObjectInfo *info)
861 GIRealInfo *rinfo = (GIRealInfo *)info;
864 g_return_val_if_fail (info != NULL, NULL);
865 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
867 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
870 return g_typelib_get_string (rinfo->typelib, blob->ref_func);
876 * g_object_info_get_ref_function_pointer: (skip)
877 * @info: a #GIObjectInfo
879 * Obtain a pointer to a function which can be used to
880 * increase the reference count an instance of this object type.
881 * This takes derivation into account and will reversely traverse
882 * the base classes of this type, starting at the top type.
884 * Returns: the function pointer or %NULL
886 GIObjectInfoRefFunction
887 g_object_info_get_ref_function_pointer (GIObjectInfo *info)
889 g_return_val_if_fail (info != NULL, NULL);
890 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
892 return (GIObjectInfoRefFunction)_get_func(info, (SymbolGetter)g_object_info_get_ref_function);
896 * g_object_info_get_unref_function:
897 * @info: a #GIObjectInfo
899 * Obtain the symbol name of the function that should be called to unref this
900 * object type. It's mainly used fundamental types. The type signature for
901 * the symbol is %GIObjectInfoUnrefFunction, to fetch the function pointer
902 * see g_object_info_get_unref_function().
904 * Returns: the symbol or %NULL
907 g_object_info_get_unref_function (GIObjectInfo *info)
909 GIRealInfo *rinfo = (GIRealInfo *)info;
912 g_return_val_if_fail (info != NULL, NULL);
913 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
915 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
917 if (blob->unref_func)
918 return g_typelib_get_string (rinfo->typelib, blob->unref_func);
924 * g_object_info_get_unref_function_pointer: (skip)
925 * @info: a #GIObjectInfo
927 * Obtain a pointer to a function which can be used to
928 * decrease the reference count an instance of this object type.
929 * This takes derivation into account and will reversely traverse
930 * the base classes of this type, starting at the top type.
932 * Returns: the function pointer or %NULL
934 GIObjectInfoUnrefFunction
935 g_object_info_get_unref_function_pointer (GIObjectInfo *info)
937 g_return_val_if_fail (info != NULL, NULL);
938 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
940 return (GIObjectInfoUnrefFunction)_get_func(info, (SymbolGetter)g_object_info_get_unref_function);
944 * g_object_info_get_set_value_function:
945 * @info: a #GIObjectInfo
947 * Obtain the symbol name of the function that should be called to convert
948 * set a GValue giving an object instance pointer of this object type.
949 * I's mainly used fundamental types. The type signature for the symbol
950 * is %GIObjectInfoSetValueFunction, to fetch the function pointer
951 * see g_object_info_get_set_value_function().
953 * Returns: the symbol or %NULL
956 g_object_info_get_set_value_function (GIObjectInfo *info)
958 GIRealInfo *rinfo = (GIRealInfo *)info;
961 g_return_val_if_fail (info != NULL, NULL);
962 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
964 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
966 if (blob->set_value_func)
967 return g_typelib_get_string (rinfo->typelib, blob->set_value_func);
973 * g_object_info_get_set_value_function_pointer: (skip)
974 * @info: a #GIObjectInfo
976 * Obtain a pointer to a function which can be used to
977 * set a GValue given an instance of this object type.
978 * This takes derivation into account and will reversely traverse
979 * the base classes of this type, starting at the top type.
981 * Returns: the function pointer or %NULL
983 GIObjectInfoSetValueFunction
984 g_object_info_get_set_value_function_pointer (GIObjectInfo *info)
986 g_return_val_if_fail (info != NULL, NULL);
987 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
989 return (GIObjectInfoSetValueFunction)_get_func(info, (SymbolGetter)g_object_info_get_set_value_function);
993 * g_object_info_get_get_value_function:
994 * @info: a #GIObjectInfo
996 * Obtain the symbol name of the function that should be called to convert
997 * an object instance pointer of this object type to a GValue.
998 * I's mainly used fundamental types. The type signature for the symbol
999 * is %GIObjectInfoGetValueFunction, to fetch the function pointer
1000 * see g_object_info_get_get_value_function().
1002 * Returns: the symbol or %NULL
1005 g_object_info_get_get_value_function (GIObjectInfo *info)
1007 GIRealInfo *rinfo = (GIRealInfo *)info;
1010 g_return_val_if_fail (info != NULL, NULL);
1011 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
1013 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
1015 if (blob->get_value_func)
1016 return g_typelib_get_string (rinfo->typelib, blob->get_value_func);
1022 * g_object_info_get_get_value_function_pointer: (skip)
1023 * @info: a #GIObjectInfo
1025 * Obtain a pointer to a function which can be used to
1026 * extract an instance of this object type out of a GValue.
1027 * This takes derivation into account and will reversely traverse
1028 * the base classes of this type, starting at the top type.
1030 * Returns: the function pointer or %NULL
1032 GIObjectInfoGetValueFunction
1033 g_object_info_get_get_value_function_pointer (GIObjectInfo *info)
1035 g_return_val_if_fail (info != NULL, NULL);
1036 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
1038 return (GIObjectInfoGetValueFunction)_get_func(info, (SymbolGetter)g_object_info_get_get_value_function);