1Glib::Flags(3) User Contributed Perl Documentation Glib::Flags(3)
2
3
4
6 Glib::Flags
7
9 Glib maps flag and enum values to the nicknames strings provided by the
10 underlying C libraries. Representing flags this way in Perl is an
11 interesting problem, which Glib solves by using some cool overloaded
12 operators.
13
14 The functions described here actually do the work of those overloaded
15 operators. See the description of the flags operators in the "This Is
16 Now That" section of Glib for more info.
17
19 Glib::Flags
20
22 scalar = $class->new ($a)
23 · $a (scalar)
24
25 Create a new flags object with given bits. This is for use from a
26 subclass, it's not possible to create a "Glib::Flags" object as such.
27 For example,
28
29 my $f1 = Glib::ParamFlags->new ('readable');
30 my $f2 = Glib::ParamFlags->new (['readable','writable']);
31
32 An object like this can then be used with the overloaded operators.
33
34 scalar = $a->all ($b, $swap)
35 · $b (scalar)
36
37 · $swap (scalar)
38
39 ref = $a->as_arrayref
40 integer = $a->bool ($b, $swap)
41 · $b (scalar)
42
43 · $swap (integer)
44
45 integer = $a->eq ($b, $swap)
46 · $b (scalar)
47
48 · $swap (integer)
49
50 integer = $a->ge ($b, $swap)
51 · $b (scalar)
52
53 · $swap (integer)
54
55 scalar = $a->intersect ($b, $swap)
56 · $b (scalar)
57
58 · $swap (scalar)
59
60 integer = $a->ne ($b, $swap)
61 · $b (scalar)
62
63 · $swap (integer)
64
65 scalar = $a->sub ($b, $swap)
66 · $b (scalar)
67
68 · $swap (scalar)
69
70 scalar = $a->union ($b, $swap)
71 · $b (scalar)
72
73 · $swap (scalar)
74
75 scalar = $a->xor ($b, $swap)
76 · $b (scalar)
77
78 · $swap (scalar)
79
81 Glib
82
84 Copyright (C) 2003-2009 by the gtk2-perl team.
85
86 This software is licensed under the LGPL. See Glib for a full notice.
87
88
89
90perl v5.12.1 2010-07-07 Glib::Flags(3)