## GflsBytesRegionBuilder

GflsBytesRegionBuilder — Builds GflsBytesRegion objects

## Functions

GflsBytesRegionBuilder * | gfls_bytes_region_builder_new ()
void | gfls_bytes_region_builder_append ()
gsize | gfls_bytes_region_builder_get_current_size ()
GflsBytesRegion * | gfls_bytes_region_builder_free ()

## Types and Values

| GflsBytesRegionBuilder

## Includes

    #include <gfls/gfls.h>

## Description

Builds GflsBytesRegion objects.

## Functions

### gfls_bytes_region_builder_new ()

    GflsBytesRegionBuilder *
    gfls_bytes_region_builder_new (void);

[skip]

#### Returns

a new GflsBytesRegionBuilder.

[transfer full]

Since: 0.4

### gfls_bytes_region_builder_append ()

    void
    gfls_bytes_region_builder_append (GflsBytesRegionBuilder *builder,
                                      gsize sub_region_length,
                                      gboolean is_part_of_region);

Appends a sub-region at the end.

If `is_part_of_region` is `FALSE` it creates a hole.

Contiguous sub-regions of the same kind are merged and will thus be treated as a single sub-region. So you can conveniently call this function several times in a row with the same value for `is_part_of_region` .

In order to create a GflsBytesRegion that will traverse a whole GBytes, it is required to call this function the right amount of times, even if it ends with a hole. See also `gfls_bytes_region_match_bytes()`.

#### Parameters

builder | a GflsBytesRegionBuilder. |
sub_region_length | the length of the sub-region. Must not be equal to 0. |
is_part_of_region | whether the sub-region is part of the region. |

Since: 0.4

### gfls_bytes_region_builder_get_current_size ()

    gsize
    gfls_bytes_region_builder_get_current_size
                                   (GflsBytesRegionBuilder *builder);

#### Parameters

builder | a GflsBytesRegionBuilder. |

#### Returns

the current total size, in number of bytes (holes included).

Since: 0.4

### gfls_bytes_region_builder_free ()

    GflsBytesRegion *
    gfls_bytes_region_builder_free (GflsBytesRegionBuilder *builder,
                                    gboolean free_data);

Creates a GflsBytesRegion and frees `builder` .

[skip]

#### Parameters

builder | a GflsBytesRegionBuilder. | [nullable]
free_data | if `TRUE`, the data is freed as well. |

#### Returns

a GflsBytesRegion, or `NULL` if `free_data` is `TRUE`.

[transfer full][nullable]

Since: 0.4

## Types and Values

### GflsBytesRegionBuilder

    typedef struct _GflsBytesRegionBuilder GflsBytesRegionBuilder;