255 lines
5.3 KiB
HTML
255 lines
5.3 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of Glib::Flags</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>Glib::Flags</H1>
|
|
Section: User Contributed Perl Documentation (3pm)<BR>Updated: 2020-02-18<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
Glib::Flags - methods and overloaded operators for flags
|
|
<A NAME="lbAC"> </A>
|
|
<H2>HIERARCHY</H2>
|
|
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
Glib::Flags
|
|
|
|
</PRE>
|
|
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
|
|
|
|
Glib maps flag and enum values to the nicknames strings provided by the
|
|
underlying C libraries. Representing flags this way in Perl is an interesting
|
|
problem, which Glib solves by using some cool overloaded operators.
|
|
<P>
|
|
|
|
The functions described here actually do the work of those overloaded
|
|
operators. See the description of the flags operators in the ``This Is
|
|
Now That'' section of Glib for more info.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>METHODS</H2>
|
|
|
|
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H3>scalar = $class-><B>new</B> ($a)</H3>
|
|
|
|
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="1">•<DD>
|
|
<TT>$a</TT> (scalar)
|
|
</DL>
|
|
<P>
|
|
|
|
Create a new flags object with given bits. This is for use from a
|
|
subclass, it's not possible to create a <TT>"Glib::Flags"</TT> object as such.
|
|
For example,
|
|
<P>
|
|
|
|
|
|
|
|
<PRE>
|
|
my $f1 = Glib::ParamFlags->new ('readable');
|
|
my $f2 = Glib::ParamFlags->new (['readable','writable']);
|
|
|
|
</PRE>
|
|
|
|
|
|
<P>
|
|
|
|
An object like this can then be used with the overloaded operators.
|
|
<A NAME="lbAG"> </A>
|
|
<H3>scalar = $a-><B>all</B> ($b, $swap)</H3>
|
|
|
|
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="2">•<DD>
|
|
<TT>$b</TT> (scalar)
|
|
<DT id="3">•<DD>
|
|
<TT>$swap</TT> (scalar)
|
|
</DL>
|
|
<A NAME="lbAH"> </A>
|
|
<H3>aref = $f-><B>as_arrayref</B></H3>
|
|
|
|
|
|
|
|
|
|
|
|
Return the bits of <TT>$f</TT> as a reference to an array of strings, like
|
|
['flagbit1','flagbit2']. This is the overload function for <TT>"@{}"</TT>,
|
|
ie. arrayizing <TT>$f</TT>. You can call it directly as a method too.
|
|
<P>
|
|
|
|
Note that @$f gives the bits as a list, but as_arrayref gives an arrayref.
|
|
If an arrayref is what you want then the method style
|
|
<B>somefunc()</B>->as_arrayref can be more readable than [@{<B>somefunc()</B>}].
|
|
<A NAME="lbAI"> </A>
|
|
<H3>bool = $f-><B>bool</B></H3>
|
|
|
|
|
|
|
|
|
|
|
|
Return 1 if any bits are set in <TT>$f</TT>, or 0 if none are set. This is the
|
|
overload for <TT>$f</TT> in boolean context (like <TT>"if"</TT>, etc). You can call it
|
|
as a method to get a true/false directly too.
|
|
<A NAME="lbAJ"> </A>
|
|
<H3>integer = $a-><B>eq</B> ($b, $swap)</H3>
|
|
|
|
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="4">•<DD>
|
|
<TT>$b</TT> (scalar)
|
|
<DT id="5">•<DD>
|
|
<TT>$swap</TT> (integer)
|
|
</DL>
|
|
<A NAME="lbAK"> </A>
|
|
<H3>integer = $a-><B>ge</B> ($b, $swap)</H3>
|
|
|
|
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="6">•<DD>
|
|
<TT>$b</TT> (scalar)
|
|
<DT id="7">•<DD>
|
|
<TT>$swap</TT> (integer)
|
|
</DL>
|
|
<A NAME="lbAL"> </A>
|
|
<H3>scalar = $a-><B>intersect</B> ($b, $swap)</H3>
|
|
|
|
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="8">•<DD>
|
|
<TT>$b</TT> (scalar)
|
|
<DT id="9">•<DD>
|
|
<TT>$swap</TT> (scalar)
|
|
</DL>
|
|
<A NAME="lbAM"> </A>
|
|
<H3>integer = $a-><B>ne</B> ($b, $swap)</H3>
|
|
|
|
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="10">•<DD>
|
|
<TT>$b</TT> (scalar)
|
|
<DT id="11">•<DD>
|
|
<TT>$swap</TT> (integer)
|
|
</DL>
|
|
<A NAME="lbAN"> </A>
|
|
<H3>scalar = $a-><B>sub</B> ($b, $swap)</H3>
|
|
|
|
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="12">•<DD>
|
|
<TT>$b</TT> (scalar)
|
|
<DT id="13">•<DD>
|
|
<TT>$swap</TT> (scalar)
|
|
</DL>
|
|
<A NAME="lbAO"> </A>
|
|
<H3>scalar = $a-><B>union</B> ($b, $swap)</H3>
|
|
|
|
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="14">•<DD>
|
|
<TT>$b</TT> (scalar)
|
|
<DT id="15">•<DD>
|
|
<TT>$swap</TT> (scalar)
|
|
</DL>
|
|
<A NAME="lbAP"> </A>
|
|
<H3>scalar = $a-><B>xor</B> ($b, $swap)</H3>
|
|
|
|
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="16">•<DD>
|
|
<TT>$b</TT> (scalar)
|
|
<DT id="17">•<DD>
|
|
<TT>$swap</TT> (scalar)
|
|
</DL>
|
|
<A NAME="lbAQ"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
|
|
|
|
Glib
|
|
<A NAME="lbAR"> </A>
|
|
<H2>COPYRIGHT</H2>
|
|
|
|
|
|
|
|
Copyright (C) 2003-2011 by the gtk2-perl team.
|
|
<P>
|
|
|
|
This software is licensed under the <FONT SIZE="-1">LGPL.</FONT> See Glib for a full notice.
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="18"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="19"><A HREF="#lbAC">HIERARCHY</A><DD>
|
|
<DT id="20"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="21"><A HREF="#lbAE">METHODS</A><DD>
|
|
<DL>
|
|
<DT id="22"><A HREF="#lbAF">scalar = $class-><B>new</B> ($a)</A><DD>
|
|
<DT id="23"><A HREF="#lbAG">scalar = $a-><B>all</B> ($b, $swap)</A><DD>
|
|
<DT id="24"><A HREF="#lbAH">aref = $f-><B>as_arrayref</B></A><DD>
|
|
<DT id="25"><A HREF="#lbAI">bool = $f-><B>bool</B></A><DD>
|
|
<DT id="26"><A HREF="#lbAJ">integer = $a-><B>eq</B> ($b, $swap)</A><DD>
|
|
<DT id="27"><A HREF="#lbAK">integer = $a-><B>ge</B> ($b, $swap)</A><DD>
|
|
<DT id="28"><A HREF="#lbAL">scalar = $a-><B>intersect</B> ($b, $swap)</A><DD>
|
|
<DT id="29"><A HREF="#lbAM">integer = $a-><B>ne</B> ($b, $swap)</A><DD>
|
|
<DT id="30"><A HREF="#lbAN">scalar = $a-><B>sub</B> ($b, $swap)</A><DD>
|
|
<DT id="31"><A HREF="#lbAO">scalar = $a-><B>union</B> ($b, $swap)</A><DD>
|
|
<DT id="32"><A HREF="#lbAP">scalar = $a-><B>xor</B> ($b, $swap)</A><DD>
|
|
</DL>
|
|
<DT id="33"><A HREF="#lbAQ">SEE ALSO</A><DD>
|
|
<DT id="34"><A HREF="#lbAR">COPYRIGHT</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:44 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|