Bitset

class Bitset(pointer: <Error class: unknown class><<Error class: unknown class>>)

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 struct@Gtk.BitsetIter.

The main use case for GtkBitset is implementing complex selections for iface@Gtk.SelectionModel.

Constructors

Link copied to clipboard
constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val gtkBitsetPointer: <Error class: unknown class><<Error class: unknown class>>

Functions

Link copied to clipboard
fun add(value: <Error class: unknown class>): Boolean

Adds @value to @self if it wasn't part of it before.

Link copied to clipboard
fun addRange(start: <Error class: unknown class>, nItems: <Error class: unknown class>)

Adds all values from @start (inclusive) to @start + @n_items (exclusive) in @self.

Link copied to clipboard
fun addRangeClosed(first: <Error class: unknown class>, last: <Error class: unknown class>)

Adds the closed range @first, @last, so @first, @last and all values in between. @first must be smaller than @last.

Link copied to clipboard
fun addRectangle(start: <Error class: unknown class>, width: <Error class: unknown class>, height: <Error class: unknown class>, stride: <Error class: unknown class>)

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.

Link copied to clipboard
fun contains(value: <Error class: unknown class>): Boolean

Checks if the given @value has been added to @self

Link copied to clipboard
fun copy(): Bitset

Creates a copy of @self.

Link copied to clipboard
fun difference(other: Bitset)

Sets @self to be the symmetric difference of @self and @other.

Link copied to clipboard
fun equals(other: Bitset): Boolean

Returns true if @self and @other contain the same values.

Link copied to clipboard
fun getMaximum(): <Error class: unknown class>

Returns the largest value in @self.

Link copied to clipboard
fun getMinimum(): <Error class: unknown class>

Returns the smallest value in @self.

Link copied to clipboard
fun getNth(nth: <Error class: unknown class>): <Error class: unknown class>

Returns the value of the @nth item in self.

Link copied to clipboard
fun getSize(): <Error class: unknown class>

Gets the number of values that were added to the set.

Link copied to clipboard
fun getSizeInRange(first: <Error class: unknown class>, last: <Error class: unknown class>): <Error class: unknown class>

Gets the number of values that are part of the set from @first to @last (inclusive).

Link copied to clipboard
fun intersect(other: Bitset)

Sets @self to be the intersection of @self and @other.

Link copied to clipboard

Check if no value is contained in bitset.

Link copied to clipboard
fun ref(): Bitset

Acquires a reference on the given GtkBitset.

Link copied to clipboard
fun remove(value: <Error class: unknown class>): Boolean

Removes @value from @self if it was part of it before.

Link copied to clipboard
fun removeAll()

Removes all values from the bitset so that it is empty again.

Link copied to clipboard
fun removeRange(start: <Error class: unknown class>, nItems: <Error class: unknown class>)

Removes all values from @start (inclusive) to @start + @n_items (exclusive) in @self.

Link copied to clipboard
fun removeRangeClosed(first: <Error class: unknown class>, last: <Error class: unknown class>)

Removes the closed range @first, @last, so @first, @last and all values in between. @first must be smaller than @last.

Link copied to clipboard
fun removeRectangle(start: <Error class: unknown class>, width: <Error class: unknown class>, height: <Error class: unknown class>, stride: <Error class: unknown class>)

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.

Link copied to clipboard
fun shiftLeft(amount: <Error class: unknown class>)

Shifts all values in @self to the left by @amount.

Link copied to clipboard
fun shiftRight(amount: <Error class: unknown class>)

Shifts all values in @self to the right by @amount.

Link copied to clipboard
fun splice(position: <Error class: unknown class>, removed: <Error class: unknown class>, added: <Error class: unknown class>)

This is a support function for GListModel handling, by mirroring the GlistModel::items-changed signal.

Link copied to clipboard
fun subtract(other: Bitset)

Sets @self to be the subtraction of @other from @self.

Link copied to clipboard
fun union(other: Bitset)

Sets @self to be the union of @self and @other.

Link copied to clipboard
fun unref()

Releases a reference on the given GtkBitset.