Skip to content

Gtk.BitsetIter

record (struct)

Iterates over the elements of a Bitset.

`GtkBitSetIter is an opaque, stack-allocated struct.

Before a GtkBitsetIter can be used, it needs to be initialized with BitsetIter.init_first, BitsetIter.init_last or BitsetIter.init_at.

Methods

get_value

def get_value(self) -> int

Gets the current value that iter points to.

If iter is not valid and BitsetIter.is_valid returns False, this function returns 0.

is_valid

def is_valid(self) -> bool

Checks if iter points to a valid value.

next

def next(self) -> tuple[bool, int]

Moves iter to the next value in the set.

If it was already pointing to the last value in the set, False is returned and iter is invalidated.

previous

def previous(self) -> tuple[bool, int]

Moves iter to the previous value in the set.

If it was already pointing to the first value in the set, False is returned and iter is invalidated.

Static functions

init_at

@staticmethod
def init_at(set: Bitset, target: int) -> tuple[bool, BitsetIter, int]

Initializes iter to point to target.

If target is not found, finds the next value after it. If no value >= target exists in set, this function returns False.

Parameters:

  • set — a GtkBitset
  • target — target value to start iterating at

init_first

@staticmethod
def init_first(set: Bitset) -> tuple[bool, BitsetIter, int]

Initializes an iterator for set and points it to the first value in set.

If set is empty, False is returned and value is set to G_MAXUINT.

Parameters:

  • set — a GtkBitset

init_last

@staticmethod
def init_last(set: Bitset) -> tuple[bool, BitsetIter, int]

Initializes an iterator for set and points it to the last value in set.

If set is empty, False is returned.

Parameters:

  • set — a GtkBitset

Properties

private_data

private_data: list[int]  # read/write