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 * @Short_description: Struct representing a GObject
32 * @Title: GIObjectInfo
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
537 * Returns: Info for the signal with name @name in @info, or %NULL on failure.
540 g_object_info_find_signal (GIObjectInfo *info,
546 n_signals = g_object_info_get_n_signals (info);
547 for (i = 0; i < n_signals; i++)
549 GISignalInfo *siginfo = g_object_info_get_signal (info, i);
551 if (g_strcmp0 (g_base_info_get_name (siginfo), name) != 0)
553 g_base_info_unref ((GIBaseInfo*)siginfo);
564 * g_object_info_get_n_vfuncs:
565 * @info: a #GIObjectInfo
567 * Obtain the number of virtual functions that this object type has.
569 * Returns: number of virtual functions
572 g_object_info_get_n_vfuncs (GIObjectInfo *info)
574 GIRealInfo *rinfo = (GIRealInfo *)info;
577 g_return_val_if_fail (info != NULL, 0);
578 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), 0);
580 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
582 return blob->n_vfuncs;
586 * g_object_info_get_vfunc:
587 * @info: a #GIObjectInfo
588 * @n: index of virtual function to get
590 * Obtain an object type virtual function at index @n.
592 * Returns: (transfer full): the #GIVFuncInfo. Free the struct by calling
593 * g_base_info_unref() when done.
596 g_object_info_get_vfunc (GIObjectInfo *info,
600 GIRealInfo *rinfo = (GIRealInfo *)info;
604 g_return_val_if_fail (info != NULL, NULL);
605 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
607 header = (Header *)rinfo->typelib->data;
608 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
610 offset = rinfo->offset + header->object_blob_size
611 + (blob->n_interfaces + blob->n_interfaces % 2) * 2
612 + blob->n_fields * header->field_blob_size
613 + blob->n_properties * header->property_blob_size
614 + blob->n_methods * header->function_blob_size
615 + blob->n_signals * header->signal_blob_size
616 + n * header->vfunc_blob_size;
618 return (GIVFuncInfo *) g_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*)info,
619 rinfo->typelib, offset);
623 * g_object_info_find_vfunc:
624 * @info: a #GIObjectInfo
625 * @name: The name of a virtual function to find.
627 * Locate a virtual function slot with name @name. Note that the namespace
628 * for virtuals is distinct from that of methods; there may or may not be
629 * a concrete method associated for a virtual. If there is one, it may
630 * be retrieved using g_vfunc_info_get_invoker(), otherwise %NULL will be
632 * See the documentation for g_vfunc_info_get_invoker() for more
633 * information on invoking virtuals.
635 * Returns: (transfer full): the #GIVFuncInfo, or %NULL. Free it with
636 * g_base_info_unref() when done.
639 g_object_info_find_vfunc (GIObjectInfo *info,
643 GIRealInfo *rinfo = (GIRealInfo *)info;
647 g_return_val_if_fail (info != NULL, NULL);
648 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
650 header = (Header *)rinfo->typelib->data;
651 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
653 offset = rinfo->offset + header->object_blob_size
654 + (blob->n_interfaces + blob->n_interfaces % 2) * 2
655 + blob->n_fields * header->field_blob_size
656 + blob->n_properties * header->property_blob_size
657 + blob->n_methods * header->function_blob_size
658 + blob->n_signals * header->signal_blob_size;
660 return _g_base_info_find_vfunc (rinfo, offset, blob->n_vfuncs, name);
664 * g_object_info_find_vfunc_using_interfaces:
665 * @info: a #GIObjectInfo
666 * @name: name of method to obtain
667 * @implementor: (out) (transfer full): The implementor of the interface
669 * Locate a virtual function slot with name @name, searching both the object
670 * @info and any interfaces it implements. Note that the namespace for
671 * virtuals is distinct from that of methods; there may or may not be a
672 * concrete method associated for a virtual. If there is one, it may be
673 * retrieved using g_vfunc_info_get_invoker(), otherwise %NULL will be
676 * Note that this function does *not* search parent classes; you will have
677 * to chain up if that's desired.
679 * Returns: (transfer full): the #GIFunctionInfo. Free the struct by calling
680 * g_base_info_unref() when done.
683 g_object_info_find_vfunc_using_interfaces (GIObjectInfo *info,
685 GIObjectInfo **implementor)
687 GIVFuncInfo *result = NULL;
688 GIObjectInfo *implementor_result = NULL;
690 result = g_object_info_find_vfunc (info, name);
692 implementor_result = g_base_info_ref ((GIBaseInfo*) info);
699 n_interfaces = g_object_info_get_n_interfaces (info);
700 for (i = 0; i < n_interfaces; ++i)
702 GIInterfaceInfo *iface_info;
704 iface_info = g_object_info_get_interface (info, i);
706 result = g_interface_info_find_vfunc (iface_info, name);
710 implementor_result = iface_info;
713 g_base_info_unref ((GIBaseInfo*) iface_info);
717 *implementor = implementor_result;
718 else if (implementor_result != NULL)
719 g_base_info_unref ((GIBaseInfo*) implementor_result);
724 * g_object_info_get_n_constants:
725 * @info: a #GIObjectInfo
727 * Obtain the number of constants that this object type has.
729 * Returns: number of constants
732 g_object_info_get_n_constants (GIObjectInfo *info)
734 GIRealInfo *rinfo = (GIRealInfo *)info;
737 g_return_val_if_fail (info != NULL, 0);
738 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), 0);
740 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
742 return blob->n_constants;
746 * g_object_info_get_constant:
747 * @info: a #GIObjectInfo
748 * @n: index of constant to get
750 * Obtain an object type constant at index @n.
752 * Returns: (transfer full): the #GIConstantInfo. Free the struct by calling
753 * g_base_info_unref() when done.
756 g_object_info_get_constant (GIObjectInfo *info,
760 GIRealInfo *rinfo = (GIRealInfo *)info;
764 g_return_val_if_fail (info != NULL, NULL);
765 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
767 header = (Header *)rinfo->typelib->data;
768 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
770 offset = rinfo->offset + header->object_blob_size
771 + (blob->n_interfaces + blob->n_interfaces % 2) * 2
772 + blob->n_fields * header->field_blob_size
773 + blob->n_properties * header->property_blob_size
774 + blob->n_methods * header->function_blob_size
775 + blob->n_signals * header->signal_blob_size
776 + blob->n_vfuncs * header->vfunc_blob_size
777 + n * header->constant_blob_size;
779 return (GIConstantInfo *) g_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
780 rinfo->typelib, offset);
784 * g_object_info_get_class_struct:
785 * @info: a #GIObjectInfo
787 * Every #GObject has two structures; an instance structure and a class
788 * structure. This function returns the metadata for the class structure.
790 * Returns: (transfer full): the #GIStructInfo or %NULL. Free with
791 * g_base_info_unref() when done.
794 g_object_info_get_class_struct (GIObjectInfo *info)
796 GIRealInfo *rinfo = (GIRealInfo *)info;
799 g_return_val_if_fail (info != NULL, NULL);
800 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
802 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
804 if (blob->gtype_struct)
805 return (GIStructInfo *) _g_info_from_entry (rinfo->repository,
806 rinfo->typelib, blob->gtype_struct);
811 typedef const char* (*SymbolGetter) (GIObjectInfo *info);
814 _get_func(GIObjectInfo *info,
818 GSList *parents = NULL, *l;
819 GIObjectInfo *parent_info;
820 gpointer func = NULL;
822 parent_info = g_base_info_ref (info);
823 while (parent_info != NULL)
825 parents = g_slist_prepend (parents, parent_info);
826 parent_info = g_object_info_get_parent (parent_info);
829 for (l = parents; l; l = l->next)
831 parent_info = l->data;
832 symbol = getter (parent_info);
836 g_typelib_symbol (((GIRealInfo *)parent_info)->typelib, symbol, (gpointer*) &func);
841 g_slist_free_full (parents, (GDestroyNotify) g_base_info_unref);
846 * g_object_info_get_ref_function:
847 * @info: a #GIObjectInfo
849 * Obtain the symbol name of the function that should be called to ref this
850 * object type. It's mainly used fundamental types. The type signature for
851 * the symbol is %GIObjectInfoRefFunction, to fetch the function pointer
852 * see g_object_info_get_ref_function().
854 * Returns: the symbol or %NULL
857 g_object_info_get_ref_function (GIObjectInfo *info)
859 GIRealInfo *rinfo = (GIRealInfo *)info;
862 g_return_val_if_fail (info != NULL, NULL);
863 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
865 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
868 return g_typelib_get_string (rinfo->typelib, blob->ref_func);
874 * g_object_info_get_ref_function_pointer: (skip)
875 * @info: a #GIObjectInfo
877 * Obtain a pointer to a function which can be used to
878 * increase the reference count an instance of this object type.
879 * This takes derivation into account and will reversely traverse
880 * the base classes of this type, starting at the top type.
882 * Returns: the function pointer or %NULL
884 GIObjectInfoRefFunction
885 g_object_info_get_ref_function_pointer (GIObjectInfo *info)
887 g_return_val_if_fail (info != NULL, NULL);
888 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
890 return (GIObjectInfoRefFunction)_get_func(info, (SymbolGetter)g_object_info_get_ref_function);
894 * g_object_info_get_unref_function:
895 * @info: a #GIObjectInfo
897 * Obtain the symbol name of the function that should be called to unref this
898 * object type. It's mainly used fundamental types. The type signature for
899 * the symbol is %GIObjectInfoUnrefFunction, to fetch the function pointer
900 * see g_object_info_get_unref_function().
902 * Returns: the symbol or %NULL
905 g_object_info_get_unref_function (GIObjectInfo *info)
907 GIRealInfo *rinfo = (GIRealInfo *)info;
910 g_return_val_if_fail (info != NULL, NULL);
911 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
913 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
915 if (blob->unref_func)
916 return g_typelib_get_string (rinfo->typelib, blob->unref_func);
922 * g_object_info_get_unref_function_pointer: (skip)
923 * @info: a #GIObjectInfo
925 * Obtain a pointer to a function which can be used to
926 * decrease the reference count an instance of this object type.
927 * This takes derivation into account and will reversely traverse
928 * the base classes of this type, starting at the top type.
930 * Returns: the function pointer or %NULL
932 GIObjectInfoUnrefFunction
933 g_object_info_get_unref_function_pointer (GIObjectInfo *info)
935 g_return_val_if_fail (info != NULL, NULL);
936 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
938 return (GIObjectInfoUnrefFunction)_get_func(info, (SymbolGetter)g_object_info_get_unref_function);
942 * g_object_info_get_set_value_function:
943 * @info: a #GIObjectInfo
945 * Obtain the symbol name of the function that should be called to convert
946 * set a GValue giving an object instance pointer of this object type.
947 * I's mainly used fundamental types. The type signature for the symbol
948 * is %GIObjectInfoSetValueFunction, to fetch the function pointer
949 * see g_object_info_get_set_value_function().
951 * Returns: the symbol or %NULL
954 g_object_info_get_set_value_function (GIObjectInfo *info)
956 GIRealInfo *rinfo = (GIRealInfo *)info;
959 g_return_val_if_fail (info != NULL, NULL);
960 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
962 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
964 if (blob->set_value_func)
965 return g_typelib_get_string (rinfo->typelib, blob->set_value_func);
971 * g_object_info_get_set_value_function_pointer: (skip)
972 * @info: a #GIObjectInfo
974 * Obtain a pointer to a function which can be used to
975 * set a GValue given an instance of this object type.
976 * This takes derivation into account and will reversely traverse
977 * the base classes of this type, starting at the top type.
979 * Returns: the function pointer or %NULL
981 GIObjectInfoSetValueFunction
982 g_object_info_get_set_value_function_pointer (GIObjectInfo *info)
984 g_return_val_if_fail (info != NULL, NULL);
985 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
987 return (GIObjectInfoSetValueFunction)_get_func(info, (SymbolGetter)g_object_info_get_set_value_function);
991 * g_object_info_get_get_value_function:
992 * @info: a #GIObjectInfo
994 * Obtain the symbol name of the function that should be called to convert
995 * an object instance pointer of this object type to a GValue.
996 * I's mainly used fundamental types. The type signature for the symbol
997 * is %GIObjectInfoGetValueFunction, to fetch the function pointer
998 * see g_object_info_get_get_value_function().
1000 * Returns: the symbol or %NULL
1003 g_object_info_get_get_value_function (GIObjectInfo *info)
1005 GIRealInfo *rinfo = (GIRealInfo *)info;
1008 g_return_val_if_fail (info != NULL, NULL);
1009 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
1011 blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
1013 if (blob->get_value_func)
1014 return g_typelib_get_string (rinfo->typelib, blob->get_value_func);
1020 * g_object_info_get_get_value_function_pointer: (skip)
1021 * @info: a #GIObjectInfo
1023 * Obtain a pointer to a function which can be used to
1024 * extract an instance of this object type out of a GValue.
1025 * This takes derivation into account and will reversely traverse
1026 * the base classes of this type, starting at the top type.
1028 * Returns: the function pointer or %NULL
1030 GIObjectInfoGetValueFunction
1031 g_object_info_get_get_value_function_pointer (GIObjectInfo *info)
1033 g_return_val_if_fail (info != NULL, NULL);
1034 g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
1036 return (GIObjectInfoGetValueFunction)_get_func(info, (SymbolGetter)g_object_info_get_get_value_function);