GflsValidatedStringChunk

GflsValidatedStringChunk — A chunk of a GflsValidatedString

Functions

Types and Values

Object Hierarchy

    GBoxed
    ╰── GflsValidatedStringChunk

Includes

#include <gfls/gfls.h>

Description

A chunk of a GflsValidatedString.

Functions

gfls_validated_string_chunk_new ()

GflsValidatedStringChunk *
gfls_validated_string_chunk_new (GBytes *bytes);

Creates a new chunk.

The format of bytes is important: the data contained in bytes must always be nul-terminated, but this must not be included in the GBytes length.

Parameters

bytes

the chunk data.

 

Returns

a new GflsValidatedStringChunk with a reference count of one.

[transfer full]

Since: 0.5


gfls_validated_string_chunk_ref ()

GflsValidatedStringChunk *
gfls_validated_string_chunk_ref (GflsValidatedStringChunk *chunk);

Increases the reference count of chunk by one.

Parameters

Returns

the passed in chunk .

[transfer full]

Since: 0.5


gfls_validated_string_chunk_unref ()

void
gfls_validated_string_chunk_unref (GflsValidatedStringChunk *chunk);

Decreases the reference count of chunk by one. If the reference count drops to 0, chunk is freed.

Parameters

chunk

a GflsValidatedStringChunk.

[nullable]

Since: 0.5


gfls_validated_string_chunk_get_bytes ()

GBytes *
gfls_validated_string_chunk_get_bytes (GflsValidatedStringChunk *chunk);

The data contained in the GBytes is always nul-terminated, but this is not included in the GBytes length.

Parameters

Returns

the chunk data.

[transfer none]

Since: 0.5


gfls_validated_string_chunk_get_valid ()

gboolean
gfls_validated_string_chunk_get_valid (GflsValidatedStringChunk *chunk);

Semantics:

  • If the chunk data is “valid”, it means that all the characters in it were and are valid.

  • If the chunk data is “invalid”, it means that all the characters in it were initially invalid, but have been validated (e.g., by escaping them).

So, a chunk is either all valid, or all invalid. There can't be a mix of both. To mix both valid and invalid characters in a string, you need to create several chunks.

Parameters

Returns

whether chunk contains valid data.

Since: 0.5


gfls_validated_string_chunk_set_valid ()

void
gfls_validated_string_chunk_set_valid (GflsValidatedStringChunk *chunk,
                                       gboolean valid);

See gfls_validated_string_chunk_get_valid() for the semantics of the valid value.

Parameters

chunk

a GflsValidatedStringChunk.

 

valid

the value.

 

Since: 0.5

Types and Values

GflsValidatedStringChunk

typedef struct _GflsValidatedStringChunk GflsValidatedStringChunk;