1
/* GObject introspection: Object implementation
3
* Copyright (C) 2005 Matthias Clasen
4
* Copyright (C) 2008,2009 Red Hat, Inc.
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Lesser General Public
8
* License as published by the Free Software Foundation; either
9
* version 2 of the License, or (at your option) any later version.
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this library; if not, write to the
18
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19
* Boston, MA 02111-1307, USA.
24
#include <girepository.h>
25
#include "girepository-private.h"
26
#include "gitypelib-internal.h"
29
* SECTION:giobjectinfo
30
* @Short_description: Struct representing a GObject
31
* @Title: GIObjectInfo
33
* GIObjectInfo represents a #GObject. This doesn't represent a specific
34
* instance of a GObject, instead this represent the object type (eg class).
36
* A GObject has methods, fields, properties, signals, interfaces, constants
37
* and virtual functions.
39
* <refsect1 id="gi-giobjectinfo.struct-hierarchy" role="struct_hierarchy">
40
* <title role="struct_hierarchy.title">Struct hierarchy</title>
42
* <link linkend="gi-GIBaseInfo">GIBaseInfo</link>
43
* +----<link linkend="gi-GIRegisteredTypeInfo">GIRegisteredTypeInfo</link>
50
* g_object_info_get_parent:
51
* @info: a #GIObjectInfo
53
* Obtain the parent of the object type.
55
* Returns: (transfer full): the #GIObjectInfo. Free the struct by calling
56
* g_base_info_unref() when done.
59
g_object_info_get_parent (GIObjectInfo *info)
61
GIRealInfo *rinfo = (GIRealInfo *)info;
64
g_return_val_if_fail (info != NULL, NULL);
65
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
67
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
70
return (GIObjectInfo *) _g_info_from_entry (rinfo->repository,
71
rinfo->typelib, blob->parent);
77
* g_object_info_get_abstract:
78
* @info: a #GIObjectInfo
80
* Obtain if the object type is an abstract type, eg if it cannot be
83
* Returns: %TRUE if the object type is abstract
86
g_object_info_get_abstract (GIObjectInfo *info)
88
GIRealInfo *rinfo = (GIRealInfo *)info;
91
g_return_val_if_fail (info != NULL, FALSE);
92
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), FALSE);
94
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
96
return blob->abstract != 0;
100
* g_object_info_get_fundamental:
101
* @info: a #GIObjectInfo
103
* Obtain if the object type is of a fundamental type which is not
104
* G_TYPE_OBJECT. This is mostly for supporting GstMiniObject.
106
* Returns: %TRUE if the object type is a fundamental type
109
g_object_info_get_fundamental (GIObjectInfo *info)
111
GIRealInfo *rinfo = (GIRealInfo *)info;
114
g_return_val_if_fail (info != NULL, FALSE);
115
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), FALSE);
117
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
119
return blob->fundamental != 0;
123
* g_object_info_get_type_name:
124
* @info: a #GIObjectInfo
126
* Obtain the name of the objects class/type.
128
* Returns: name of the objects type
131
g_object_info_get_type_name (GIObjectInfo *info)
133
GIRealInfo *rinfo = (GIRealInfo *)info;
136
g_return_val_if_fail (info != NULL, NULL);
137
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
139
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
141
return g_typelib_get_string (rinfo->typelib, blob->gtype_name);
145
* g_object_info_get_type_init:
146
* @info: a #GIObjectInfo
148
* Obtain the function which when called will return the GType
149
* function for which this object type is registered.
151
* Returns: the type init function
154
g_object_info_get_type_init (GIObjectInfo *info)
156
GIRealInfo *rinfo = (GIRealInfo *)info;
159
g_return_val_if_fail (info != NULL, NULL);
160
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
162
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
164
return g_typelib_get_string (rinfo->typelib, blob->gtype_init);
168
* g_object_info_get_n_interfaces:
169
* @info: a #GIObjectInfo
171
* Obtain the number of interfaces that this object type has.
173
* Returns: number of interfaces
176
g_object_info_get_n_interfaces (GIObjectInfo *info)
178
GIRealInfo *rinfo = (GIRealInfo *)info;
181
g_return_val_if_fail (info != NULL, 0);
182
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), 0);
184
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
186
return blob->n_interfaces;
190
* g_object_info_get_interface:
191
* @info: a #GIObjectInfo
192
* @n: index of interface to get
194
* Obtain an object type interface at index @n.
196
* Returns: (transfer full): the #GIInterfaceInfo. Free the struct by calling
197
* g_base_info_unref() when done.
200
g_object_info_get_interface (GIObjectInfo *info,
203
GIRealInfo *rinfo = (GIRealInfo *)info;
206
g_return_val_if_fail (info != NULL, NULL);
207
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
209
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
211
return (GIInterfaceInfo *) _g_info_from_entry (rinfo->repository,
212
rinfo->typelib, blob->interfaces[n]);
216
* g_object_info_get_n_fields:
217
* @info: a #GIObjectInfo
219
* Obtain the number of fields that this object type has.
221
* Returns: number of fields
224
g_object_info_get_n_fields (GIObjectInfo *info)
226
GIRealInfo *rinfo = (GIRealInfo *)info;
229
g_return_val_if_fail (info != NULL, 0);
230
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), 0);
232
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
234
return blob->n_fields;
238
* g_object_info_get_field:
239
* @info: a #GIObjectInfo
240
* @n: index of field to get
242
* Obtain an object type field at index @n.
244
* Returns: (transfer full): the #GIFieldInfo. Free the struct by calling
245
* g_base_info_unref() when done.
248
g_object_info_get_field (GIObjectInfo *info,
252
GIRealInfo *rinfo = (GIRealInfo *)info;
256
g_return_val_if_fail (info != NULL, NULL);
257
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
259
header = (Header *)rinfo->typelib->data;
260
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
262
offset = rinfo->offset + header->object_blob_size
263
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
264
+ n * header->field_blob_size;
266
return (GIFieldInfo *) g_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib, offset);
270
* g_object_info_get_n_properties:
271
* @info: a #GIObjectInfo
273
* Obtain the number of properties that this object type has.
275
* Returns: number of properties
278
g_object_info_get_n_properties (GIObjectInfo *info)
280
GIRealInfo *rinfo = (GIRealInfo *)info;
283
g_return_val_if_fail (info != NULL, 0);
284
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), 0);
286
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
287
return blob->n_properties;
291
* g_object_info_get_property:
292
* @info: a #GIObjectInfo
293
* @n: index of property to get
295
* Obtain an object type property at index @n.
297
* Returns: (transfer full): the #GIPropertyInfo. Free the struct by calling
298
* g_base_info_unref() when done.
301
g_object_info_get_property (GIObjectInfo *info,
305
GIRealInfo *rinfo = (GIRealInfo *)info;
309
g_return_val_if_fail (info != NULL, NULL);
310
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
312
header = (Header *)rinfo->typelib->data;
313
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
315
offset = rinfo->offset + header->object_blob_size
316
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
317
+ blob->n_fields * header->field_blob_size
318
+ n * header->property_blob_size;
320
return (GIPropertyInfo *) g_info_new (GI_INFO_TYPE_PROPERTY, (GIBaseInfo*)info,
321
rinfo->typelib, offset);
325
* g_object_info_get_n_methods:
326
* @info: a #GIObjectInfo
328
* Obtain the number of methods that this object type has.
330
* Returns: number of methods
333
g_object_info_get_n_methods (GIObjectInfo *info)
335
GIRealInfo *rinfo = (GIRealInfo *)info;
338
g_return_val_if_fail (info != NULL, 0);
339
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), 0);
341
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
343
return blob->n_methods;
347
* g_object_info_get_method:
348
* @info: a #GIObjectInfo
349
* @n: index of method to get
351
* Obtain an object type method at index @n.
353
* Returns: (transfer full): the #GIFunctionInfo. Free the struct by calling
354
* g_base_info_unref() when done.
357
g_object_info_get_method (GIObjectInfo *info,
361
GIRealInfo *rinfo = (GIRealInfo *)info;
365
g_return_val_if_fail (info != NULL, NULL);
366
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
368
header = (Header *)rinfo->typelib->data;
369
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
372
offset = rinfo->offset + header->object_blob_size
373
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
374
+ blob->n_fields * header->field_blob_size
375
+ blob->n_properties * header->property_blob_size
376
+ n * header->function_blob_size;
378
return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
379
rinfo->typelib, offset);
383
* g_object_info_find_method:
384
* @info: a #GIObjectInfo
385
* @name: name of method to obtain
387
* Obtain a method of the object type given a @name. %NULL will be
388
* returned if there's no method available with that name.
390
* Returns: (transfer full): the #GIFunctionInfo. Free the struct by calling
391
* g_base_info_unref() when done.
394
g_object_info_find_method (GIObjectInfo *info,
398
GIRealInfo *rinfo = (GIRealInfo *)info;
402
g_return_val_if_fail (info != NULL, 0);
403
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), 0);
405
header = (Header *)rinfo->typelib->data;
406
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
408
offset = rinfo->offset + header->object_blob_size
409
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
410
+ blob->n_fields * header->field_blob_size +
411
+ blob->n_properties * header->property_blob_size;
413
return _g_base_info_find_method ((GIBaseInfo*)info, offset, blob->n_methods, name);
417
* g_object_info_find_method_using_interfaces:
418
* @info: a #GIObjectInfo
419
* @name: name of method to obtain
420
* @implementor: (out) (transfer full): The implementor of the interface
422
* Obtain a method of the object given a @name, searching both the
423
* object @info and any interfaces it implements. %NULL will be
424
* returned if there's no method available with that name.
426
* Note that this function does *not* search parent classes; you will have
427
* to chain up if that's desired.
429
* Returns: (transfer full): the #GIFunctionInfo. Free the struct by calling
430
* g_base_info_unref() when done.
433
g_object_info_find_method_using_interfaces (GIObjectInfo *info,
435
GIObjectInfo **implementor)
437
GIFunctionInfo *result = NULL;
438
GIObjectInfo *implementor_result = NULL;
440
result = g_object_info_find_method (info, name);
442
implementor_result = g_base_info_ref ((GIBaseInfo*) info);
449
n_interfaces = g_object_info_get_n_interfaces (info);
450
for (i = 0; i < n_interfaces; ++i)
452
GIInterfaceInfo *iface_info;
454
iface_info = g_object_info_get_interface (info, i);
456
result = g_interface_info_find_method (iface_info, name);
460
implementor_result = iface_info;
463
g_base_info_unref ((GIBaseInfo*) iface_info);
467
*implementor = implementor_result;
468
else if (implementor_result != NULL)
469
g_base_info_unref ((GIBaseInfo*) implementor_result);
474
* g_object_info_get_n_signals:
475
* @info: a #GIObjectInfo
477
* Obtain the number of signals that this object type has.
479
* Returns: number of signals
482
g_object_info_get_n_signals (GIObjectInfo *info)
484
GIRealInfo *rinfo = (GIRealInfo *)info;
487
g_return_val_if_fail (info != NULL, 0);
488
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), 0);
490
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
492
return blob->n_signals;
496
* g_object_info_get_signal:
497
* @info: a #GIObjectInfo
498
* @n: index of signal to get
500
* Obtain an object type signal at index @n.
502
* Returns: (transfer full): the #GISignalInfo. Free the struct by calling
503
* g_base_info_unref() when done.
506
g_object_info_get_signal (GIObjectInfo *info,
510
GIRealInfo *rinfo = (GIRealInfo *)info;
514
g_return_val_if_fail (info != NULL, NULL);
515
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
517
header = (Header *)rinfo->typelib->data;
518
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
520
offset = rinfo->offset + header->object_blob_size
521
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
522
+ blob->n_fields * header->field_blob_size
523
+ blob->n_properties * header->property_blob_size
524
+ blob->n_methods * header->function_blob_size
525
+ n * header->signal_blob_size;
527
return (GISignalInfo *) g_info_new (GI_INFO_TYPE_SIGNAL, (GIBaseInfo*)info,
528
rinfo->typelib, offset);
532
* g_object_info_find_signal:
533
* @info: a #GIObjectInfo
534
* @name: Name of signal
536
* Returns: Info for the signal with name @name in @info, or %NULL on failure.
539
g_object_info_find_signal (GIObjectInfo *info,
545
n_signals = g_object_info_get_n_signals (info);
546
for (i = 0; i < n_signals; i++)
548
GISignalInfo *siginfo = g_object_info_get_signal (info, i);
550
if (g_strcmp0 (g_base_info_get_name (siginfo), name) != 0)
552
g_base_info_unref ((GIBaseInfo*)siginfo);
563
* g_object_info_get_n_vfuncs:
564
* @info: a #GIObjectInfo
566
* Obtain the number of virtual functions that this object type has.
568
* Returns: number of virtual functions
571
g_object_info_get_n_vfuncs (GIObjectInfo *info)
573
GIRealInfo *rinfo = (GIRealInfo *)info;
576
g_return_val_if_fail (info != NULL, 0);
577
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), 0);
579
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
581
return blob->n_vfuncs;
585
* g_object_info_get_vfunc:
586
* @info: a #GIObjectInfo
587
* @n: index of virtual function to get
589
* Obtain an object type virtual function at index @n.
591
* Returns: (transfer full): the #GIVFuncInfo. Free the struct by calling
592
* g_base_info_unref() when done.
595
g_object_info_get_vfunc (GIObjectInfo *info,
599
GIRealInfo *rinfo = (GIRealInfo *)info;
603
g_return_val_if_fail (info != NULL, NULL);
604
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
606
header = (Header *)rinfo->typelib->data;
607
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
609
offset = rinfo->offset + header->object_blob_size
610
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
611
+ blob->n_fields * header->field_blob_size
612
+ blob->n_properties * header->property_blob_size
613
+ blob->n_methods * header->function_blob_size
614
+ blob->n_signals * header->signal_blob_size
615
+ n * header->vfunc_blob_size;
617
return (GIVFuncInfo *) g_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*)info,
618
rinfo->typelib, offset);
622
* g_object_info_find_vfunc:
623
* @info: a #GIObjectInfo
624
* @name: The name of a virtual function to find.
626
* Locate a virtual function slot with name @name. Note that the namespace
627
* for virtuals is distinct from that of methods; there may or may not be
628
* a concrete method associated for a virtual. If there is one, it may
629
* be retrieved using g_vfunc_info_get_invoker(), otherwise %NULL will be
631
* See the documentation for g_vfunc_info_get_invoker() for more
632
* information on invoking virtuals.
634
* Returns: (transfer full): the #GIVFuncInfo, or %NULL. Free it with
635
* g_base_info_unref() when done.
638
g_object_info_find_vfunc (GIObjectInfo *info,
642
GIRealInfo *rinfo = (GIRealInfo *)info;
646
g_return_val_if_fail (info != NULL, NULL);
647
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
649
header = (Header *)rinfo->typelib->data;
650
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
652
offset = rinfo->offset + header->object_blob_size
653
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
654
+ blob->n_fields * header->field_blob_size
655
+ blob->n_properties * header->property_blob_size
656
+ blob->n_methods * header->function_blob_size
657
+ blob->n_signals * header->signal_blob_size;
659
return _g_base_info_find_vfunc (rinfo, offset, blob->n_vfuncs, name);
663
* g_object_info_get_n_constants:
664
* @info: a #GIObjectInfo
666
* Obtain the number of constants that this object type has.
668
* Returns: number of constants
671
g_object_info_get_n_constants (GIObjectInfo *info)
673
GIRealInfo *rinfo = (GIRealInfo *)info;
676
g_return_val_if_fail (info != NULL, 0);
677
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), 0);
679
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
681
return blob->n_constants;
685
* g_object_info_get_constant:
686
* @info: a #GIObjectInfo
687
* @n: index of constant to get
689
* Obtain an object type constant at index @n.
691
* Returns: (transfer full): the #GIConstantInfo. Free the struct by calling
692
* g_base_info_unref() when done.
695
g_object_info_get_constant (GIObjectInfo *info,
699
GIRealInfo *rinfo = (GIRealInfo *)info;
703
g_return_val_if_fail (info != NULL, NULL);
704
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
706
header = (Header *)rinfo->typelib->data;
707
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
709
offset = rinfo->offset + header->object_blob_size
710
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2
711
+ blob->n_fields * header->field_blob_size
712
+ blob->n_properties * header->property_blob_size
713
+ blob->n_methods * header->function_blob_size
714
+ blob->n_signals * header->signal_blob_size
715
+ blob->n_vfuncs * header->vfunc_blob_size
716
+ n * header->constant_blob_size;
718
return (GIConstantInfo *) g_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
719
rinfo->typelib, offset);
723
* g_object_info_get_class_struct:
724
* @info: a #GIObjectInfo
726
* Every #GObject has two structures; an instance structure and a class
727
* structure. This function returns the metadata for the class structure.
729
* Returns: (transfer full): the #GIStructInfo or %NULL. Free with
730
* g_base_info_unref() when done.
733
g_object_info_get_class_struct (GIObjectInfo *info)
735
GIRealInfo *rinfo = (GIRealInfo *)info;
738
g_return_val_if_fail (info != NULL, NULL);
739
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
741
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
743
if (blob->gtype_struct)
744
return (GIStructInfo *) _g_info_from_entry (rinfo->repository,
745
rinfo->typelib, blob->gtype_struct);
750
typedef const char* (*SymbolGetter) (GIObjectInfo *info);
753
_get_func(GIObjectInfo *info,
757
GSList *parents = NULL, *l;
758
GIObjectInfo *parent_info;
761
while (parent_info != NULL) {
762
parents = g_slist_prepend(parents, parent_info);
763
parent_info = g_object_info_get_parent(parent_info);
766
for (l = parents; l; l = l->next) {
767
GIObjectInfoRefFunction func;
768
parent_info = l->data;
769
symbol = getter(parent_info);
772
if (g_typelib_symbol (((GIRealInfo *)parent_info)->typelib, symbol, (void**) &func)) {
773
g_slist_free(parents);
778
g_slist_free(parents);
784
* g_object_info_get_ref_function:
785
* @info: a #GIObjectInfo
787
* Obtain the symbol name of the function that should be called to ref this
788
* object type. It's mainly used fundamental types. The type signature for
789
* the symbol is %GIObjectInfoRefFunction, to fetch the function pointer
790
* see g_object_info_get_ref_function().
792
* Returns: the symbol or %NULL
795
g_object_info_get_ref_function (GIObjectInfo *info)
797
GIRealInfo *rinfo = (GIRealInfo *)info;
800
g_return_val_if_fail (info != NULL, NULL);
801
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
803
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
806
return g_typelib_get_string (rinfo->typelib, blob->ref_func);
812
* g_object_info_get_ref_function_pointer: (skip)
813
* @info: a #GIObjectInfo
815
* Obtain a pointer to a function which can be used to
816
* increase the reference count an instance of this object type.
817
* This takes derivation into account and will reversely traverse
818
* the base classes of this type, starting at the top type.
820
* Returns: the function pointer or %NULL
822
GIObjectInfoRefFunction
823
g_object_info_get_ref_function_pointer (GIObjectInfo *info)
825
g_return_val_if_fail (info != NULL, NULL);
826
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
828
return (GIObjectInfoRefFunction)_get_func(info, (SymbolGetter)g_object_info_get_ref_function);
832
* g_object_info_get_unref_function:
833
* @info: a #GIObjectInfo
835
* Obtain the symbol name of the function that should be called to unref this
836
* object type. It's mainly used fundamental types. The type signature for
837
* the symbol is %GIObjectInfoUnrefFunction, to fetch the function pointer
838
* see g_object_info_get_unref_function().
840
* Returns: the symbol or %NULL
843
g_object_info_get_unref_function (GIObjectInfo *info)
845
GIRealInfo *rinfo = (GIRealInfo *)info;
848
g_return_val_if_fail (info != NULL, NULL);
849
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
851
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
853
if (blob->unref_func)
854
return g_typelib_get_string (rinfo->typelib, blob->unref_func);
860
* g_object_info_get_unref_function_pointer: (skip)
861
* @info: a #GIObjectInfo
863
* Obtain a pointer to a function which can be used to
864
* decrease the reference count an instance of this object type.
865
* This takes derivation into account and will reversely traverse
866
* the base classes of this type, starting at the top type.
868
* Returns: the function pointer or %NULL
870
GIObjectInfoUnrefFunction
871
g_object_info_get_unref_function_pointer (GIObjectInfo *info)
873
g_return_val_if_fail (info != NULL, NULL);
874
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
876
return (GIObjectInfoUnrefFunction)_get_func(info, (SymbolGetter)g_object_info_get_unref_function);
880
* g_object_info_get_set_value_function:
881
* @info: a #GIObjectInfo
883
* Obtain the symbol name of the function that should be called to convert
884
* set a GValue giving an object instance pointer of this object type.
885
* I's mainly used fundamental types. The type signature for the symbol
886
* is %GIObjectInfoSetValueFunction, to fetch the function pointer
887
* see g_object_info_get_set_value_function().
889
* Returns: the symbol or %NULL
892
g_object_info_get_set_value_function (GIObjectInfo *info)
894
GIRealInfo *rinfo = (GIRealInfo *)info;
897
g_return_val_if_fail (info != NULL, NULL);
898
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
900
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
902
if (blob->set_value_func)
903
return g_typelib_get_string (rinfo->typelib, blob->set_value_func);
909
* g_object_info_get_set_value_function_pointer: (skip)
910
* @info: a #GIObjectInfo
912
* Obtain a pointer to a function which can be used to
913
* set a GValue given an instance of this object type.
914
* This takes derivation into account and will reversely traverse
915
* the base classes of this type, starting at the top type.
917
* Returns: the function pointer or %NULL
919
GIObjectInfoSetValueFunction
920
g_object_info_get_set_value_function_pointer (GIObjectInfo *info)
922
g_return_val_if_fail (info != NULL, NULL);
923
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
925
return (GIObjectInfoSetValueFunction)_get_func(info, (SymbolGetter)g_object_info_get_set_value_function);
929
* g_object_info_get_get_value_function:
930
* @info: a #GIObjectInfo
932
* Obtain the symbol name of the function that should be called to convert
933
* an object instance pointer of this object type to a GValue.
934
* I's mainly used fundamental types. The type signature for the symbol
935
* is %GIObjectInfoGetValueFunction, to fetch the function pointer
936
* see g_object_info_get_get_value_function().
938
* Returns: the symbol or %NULL
941
g_object_info_get_get_value_function (GIObjectInfo *info)
943
GIRealInfo *rinfo = (GIRealInfo *)info;
946
g_return_val_if_fail (info != NULL, NULL);
947
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
949
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
951
if (blob->get_value_func)
952
return g_typelib_get_string (rinfo->typelib, blob->get_value_func);
958
* g_object_info_get_get_value_function_pointer: (skip)
959
* @info: a #GIObjectInfo
961
* Obtain a pointer to a function which can be used to
962
* extract an instance of this object type out of a GValue.
963
* This takes derivation into account and will reversely traverse
964
* the base classes of this type, starting at the top type.
966
* Returns: the function pointer or %NULL
968
GIObjectInfoGetValueFunction
969
g_object_info_get_get_value_function_pointer (GIObjectInfo *info)
971
g_return_val_if_fail (info != NULL, NULL);
972
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
974
return (GIObjectInfoGetValueFunction)_get_func(info, (SymbolGetter)g_object_info_get_get_value_function);