Gfls.BytesRegion

Fields

None

Methods

free ()

iter_free (iter)

iter_get_sub_region (iter)

iter_is_end (iter)

iter_next (iter)

match_bytes (bytes)

to_string ()

Details

class Gfls.BytesRegion
free()

Frees self.

Added in version 0.4.

iter_free(iter)
Parameters:

iter (Gfls.BytesRegionIter or None) – a Gfls.BytesRegionIter.

Frees iter.

Added in version 0.4.

iter_get_sub_region(iter)
Parameters:

iter (Gfls.BytesRegionIter) – a Gfls.BytesRegionIter. It must not be the end iterator.

Returns:

sub_region_size:

the sub-region size.

offset:

the offset to the start of the sub-region.

is_part_of_region:

whether the sub-region is part of the region.

Return type:

(sub_region_size: int, offset: int, is_part_of_region: bool)

Gets the sub-region at this iterator.

sub_region_size and offset can be used as arguments to GLib.Bytes.get_region().

is_part_of_region has the same meaning as for Gfls.BytesRegionBuilder.append(). Gfls.BytesRegionIter iterates on both the region and the holes, so that the corresponding GLib.Bytes is traversed from start to end.

Added in version 0.4.

iter_is_end(iter)
Parameters:

iter (Gfls.BytesRegionIter) – a Gfls.BytesRegionIter.

Returns:

whether iter is the end iterator.

Return type:

bool

Added in version 0.4.

iter_next(iter)
Parameters:

iter (Gfls.BytesRegionIter) – a Gfls.BytesRegionIter. The end iterator is accepted as an input value.

Moves iter to the next sub-region.

If all sub-regions have been traversed, iter is set to the end iterator.

Added in version 0.4.

match_bytes(bytes)
Parameters:

bytes (GLib.Bytes) – a GLib.Bytes.

Returns:

whether self can be applied to bytes (it checks the total size).

Return type:

bool

Added in version 0.4.

to_string()
Returns:

a string representation of self.

Return type:

str

The format is:

[offset, sub_region_size, is_part_of_region]\n

One line per sub-region, in order.

Added in version 0.4.