gtk.bitset

Module for [Bitset] class

class Bitset

Types 1

A gtk.bitset.Bitset 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. gtk.bitset.Bitset 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 gtk.bitset_iter.BitsetIter.

The main use case for gtk.bitset.Bitset is implementing complex selections for gtk.selection_model.SelectionModel.

Methods
void * _cPtr(Flag!"Dup" dup = No.Dup) nothrow
GType _getGType() static nothrow
GType _gType() @property nothrow
Bitset self() nothrowReturns `this`, for use in `with` statements.
gtk.bitset.Bitset newEmpty() static nothrowCreates a new empty bitset. Returns: A new empty bitset
gtk.bitset.Bitset newRange(uint start, uint nItems) static nothrowCreates a bitset with the given range set.
bool add(uint value) nothrowAdds value to self if it wasn't part of it before.
void addRange(uint start, uint nItems) nothrowAdds all values from start (inclusive) to start + n_items (exclusive) in self.
void addRangeClosed(uint first, uint last) nothrowAdds the closed range [first, last], so first, last and all values in between. first must be smaller than last.
void addRectangle(uint start, uint width, uint height, uint stride) nothrowInterprets 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.
bool contains(uint value) nothrowChecks if the given value has been added to self
gtk.bitset.Bitset copy() nothrowCreates a copy of self. Returns: A new bitset that contains the same values as self
void difference(gtk.bitset.Bitset other) nothrowSets self to be the symmetric difference of self and other.
bool equals(gtk.bitset.Bitset other) nothrowReturns true if self and other contain the same values.
uint getMaximum() nothrowReturns the largest value in self.
uint getMinimum() nothrowReturns the smallest value in self.
uint getNth(uint nth) nothrowReturns the value of the nth item in self.
ulong getSize() nothrowGets the number of values that were added to the set.
ulong getSizeInRange(uint first, uint last) nothrowGets the number of values that are part of the set from first to last (inclusive).
void intersect(gtk.bitset.Bitset other) nothrowSets self to be the intersection of self and other.
bool isEmpty() nothrowCheck if no value is contained in bitset. Returns: true if self is empty
bool remove(uint value) nothrowRemoves value from self if it was part of it before.
void removeAll() nothrowRemoves all values from the bitset so that it is empty again.
void removeRange(uint start, uint nItems) nothrowRemoves all values from start (inclusive) to start + n_items (exclusive) in self.
void removeRangeClosed(uint first, uint last) nothrowRemoves the closed range [first, last], so first, last and all values in between. first must be smaller than last.
void removeRectangle(uint start, uint width, uint height, uint stride) nothrowInterprets 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.
void shiftLeft(uint amount) nothrowShifts all values in self to the left by amount.
void shiftRight(uint amount) nothrowShifts all values in self to the right by amount.
void splice(uint position, uint removed, uint added) nothrowThis is a support function for [gio.list_model.ListModel] handling, by mirroring the `GlistModel::items-changed` signal.
void subtract(gtk.bitset.Bitset other) nothrowSets self to be the subtraction of other from self.
void union_(gtk.bitset.Bitset other) nothrowSets self to be the union of self and other.
Constructors
this(void * ptr, Flag!"Take" take)