Bitset
Object Hierarchy:
Gtk.Bitset
Gtk.Bitset
Gtk.Bitset
Description:
[ CCode ( ref_function = "gtk_bitset_ref" , type_id = "gtk_bitset_get_type ()" , unref_function = "gtk_bitset_unref" ) ] [ Compact ]public class Bitset
A `GtkBitset` represents a set of unsigned integers.
Another name for this data structure is "bitmap".
The current implementation is based on roaring bitmaps .
A bitset allows adding a set of integers and provides support for set operations like unions, intersections and checks for equality or if
a value is contained in the set. `GtkBitset` also contains various functions to query metadata about the bitset, such as the minimum or
maximum values or its size.
The fastest way to iterate values in a bitset is [[email protected] ].
The main use case for `GtkBitset` is implementing complex selections for [[email protected] ].
Content:
Creation methods:
Methods:
public unowned Bitset @ref ()
Acquires a reference on the given `GtkBitset`.
public bool add (uint value)
Adds value
to this if
it wasn't part of it before.
public void add_range (uint start, uint n_items)
Adds all values from start
(inclusive) to start
+ n_items
(exclusive) in this .
public void add_range_closed (uint first, uint last)
Adds the closed range [first
, last
], so
first
, last
and all values in between.
public void add_rectangle (uint start, uint width, uint height, uint stride)
Interprets the values as a 2-dimensional boolean grid with the given
stride
and inside that grid, adds a rectangle with the given width
and height
.
public bool contains (uint value)
Checks if the given value
has been added to
this
public Bitset copy ()
Creates a copy of this .
public void difference (Bitset other)
Sets this to be the symmetric
difference of this and other
.
public bool equals (Bitset other)
Returns true if
this and other
contain the same values.
public uint get_maximum ()
Returns the largest value in this .
public uint get_minimum ()
Returns the smallest value in this .
public uint get_nth (uint nth)
Returns the value of the nth
item in self.
public uint64 get_size ()
Gets the number of values that were added to the set.
public uint64 get_size_in_range (uint first, uint last)
Gets the number of values that are part of the set from first
to last
(inclusive).
public void intersect (Bitset other)
Sets this to be the intersection of
this and other
.
public bool is_empty ()
Check if no value is contained in bitset.
public bool remove (uint value)
Removes value
from this
if it was part of it before.
public void remove_all ()
Removes all values from the bitset so that it is empty again.
public void remove_range (uint start, uint n_items)
Removes all values from start
(inclusive) to start
+ n_items
(exclusive) in this .
public void remove_range_closed (uint first, uint last)
Removes the closed range [first
, last
], so
first
, last
and all values in between.
public void remove_rectangle (uint start, uint width, uint height, uint stride)
Interprets the values as a 2-dimensional boolean grid with the given
stride
and inside that grid, removes a rectangle with the given width
and height
.
public void shift_left (uint amount)
Shifts all values in this to the
left by amount
.
public void shift_right (uint amount)
Shifts all values in this to the
right by amount
.
public void splice (uint position, uint removed, uint added)
This is a support function for `GListModel` handling, by mirroring the
`GlistModel:GtkBitset:items-changed
` signal.
public void subtract (Bitset other)
Sets this to be the subtraction of
other
from this .
public void union (Bitset other)
Sets this to be the union of
this and other
.
public void unref ()
Releases a reference on the given `GtkBitset`.