Commit 15c0b512 authored by Torsten Schönfeld's avatar Torsten Schönfeld

Add functions for handling raw flags values

Glib::Object::Introspection->convert_flags_to_sv and
Glib::Object::Introspection->convert_sv_to_flags.
parent d1fe752a
......@@ -1019,6 +1019,26 @@ convert_enum_to_sv (class, const gchar *package, gint n)
OUTPUT:
RETVAL
gint
convert_sv_to_flags (class, const gchar *package, SV *sv)
PREINIT:
GType gtype;
CODE:
gtype = gperl_type_from_package (package);
RETVAL = gperl_convert_flags (gtype, sv);
OUTPUT:
RETVAL
SV *
convert_flags_to_sv (class, const gchar *package, gint n)
PREINIT:
GType gtype;
CODE:
gtype = gperl_type_from_package (package);
RETVAL = gperl_convert_back_flags (gtype, n);
OUTPUT:
RETVAL
# --------------------------------------------------------------------------- #
MODULE = Glib::Object::Introspection PACKAGE = Glib::Object::Introspection::GValueWrapper
......
......@@ -688,18 +688,23 @@ For example:
$box->child_get_property ($label, 'expand', $gvalue);
my $value = $gvalue->get_value
=head2 Handling extendable enumerations
If you need to handle extendable enumerations for which more than the
pre-defined values might be valid, then use C<<
Glib::Object::Introspection->convert_enum_to_sv >> and C<<
Glib::Object::Introspection->convert_sv_to_enum >>. They will raise an
=head2 Handling raw enumerations and flags
If you need to handle raw enumerations/flags or extendable enumerations for
which more than the pre-defined values might be valid, then use C<<
Glib::Object::Introspection->convert_enum_to_sv >>, C<<
Glib::Object::Introspection->convert_sv_to_enum >>, C<<
Glib::Object::Introspection->convert_flags_to_sv >> and C<<
Glib::Object::Introspection->convert_sv_to_flags >>. They will raise an
exception on unknown values; catching it then allows you to implement fallback
behavior.
Glib::Object::Introspection->convert_enum_to_sv (package, enum_value)
Glib::Object::Introspection->convert_sv_to_enum (package, sv)
Glib::Object::Introspection->convert_flags_to_sv (package, flags_value)
Glib::Object::Introspection->convert_sv_to_flags (package, sv)
=head1 SEE ALSO
=over
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment