Re: How to test object type and do casting in G::O::I
- From: "Torsten Schönfeld" <torsten schoenfeld gmx de>
- To: gtk-perl-list gnome org
- Subject: Re: How to test object type and do casting in G::O::I
- Date: Tue, 8 Aug 2017 09:18:13 +0200
"Robin Lee" <robinlee sysu gmail com>:
I am playing GIRepository with G::O::I.
I get a GIRepository::BaseInfo object from gir get_info funtion.
One question is how to test whether this object is a GIRepository::CallableInfo.
And another question is how to cast this object to a GIRepository::CallableInfo.
For a normal GObject-based library, the C hierarchy would be mapped to Perl package hierarchy so that you
could use $object->isa('Package') and so that casting wouldn't be necessary.
But GIRepository is not a GObject-based library, so you're basically in uncharted territory here
Glib::Object::Introspection has not been written and tested with this application in mind. But try calling
->get_type() on the GIRepository::BaseInfo object. Once you know the type, try calling child class methods
fully-qualified, for example:
GIRepository::Struct::find_method ($base_info_which_is_struct_info, $name)
Also, have a look at what 'perli11ndoc' presents for GIRepository to maybe get a better idea of what is
possible. (The calling syntax presented might, however, not be correct, because 'perli11ndoc' also assumes
GObject semantics.)
Might I ask what you are trying to accomplish with the information from GIRepository?
-Torsten
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]