class Gtk::Bitset

Overview

A Gtk::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 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::BitsetIter.

The main use case for Gtk::Bitset is implementing complex selections for Gtk::SelectionModel.

Defined in:

lib/gi-crystal/src/auto/gtk-4.0/bitset.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(pointer : Pointer(Void), transfer : GICrystal::Transfer) #

def self.new_range(start : UInt32, n_items : UInt32) : self #

Class Method Detail

def self.g_type : UInt64 #

Returns the type id (GType) registered in GLib type system.


Instance Method Detail

def add(value : UInt32) : Bool #

def add_range(start : UInt32, n_items : UInt32) : Nil #

def add_range_closed(first : UInt32, last : UInt32) : Nil #

def add_rectangle(start : UInt32, width : UInt32, height : UInt32, stride : UInt32) : Nil #

def contains(value : UInt32) : Bool #

def copy : Gtk::Bitset #

def difference(other : Gtk::Bitset) : Nil #

def equals(other : Gtk::Bitset) : Bool #

def finalize #

def intersect(other : Gtk::Bitset) : Nil #

def is_empty : Bool #

def maximum : UInt32 #

def minimum : UInt32 #

def nth(nth : UInt32) : UInt32 #

def ref : Gtk::Bitset #

def remove(value : UInt32) : Bool #

def remove_all : Nil #

def remove_range(start : UInt32, n_items : UInt32) : Nil #

def remove_range_closed(first : UInt32, last : UInt32) : Nil #

def remove_rectangle(start : UInt32, width : UInt32, height : UInt32, stride : UInt32) : Nil #

def shift_left(amount : UInt32) : Nil #

def shift_right(amount : UInt32) : Nil #

def size : UInt64 #

def size_in_range(first : UInt32, last : UInt32) : UInt64 #

def splice(position : UInt32, removed : UInt32, added : UInt32) : Nil #

def subtract(other : Gtk::Bitset) : Nil #

def to_unsafe : Pointer(Void) #

def union(other : Gtk::Bitset) : Nil #

def unref : Nil #