libkate 0.4.3
Functions
Text manipulation

Functions

int kate_text_get_character (kate_text_encoding text_encoding, const char **const text, size_t *len0)
 
int kate_text_set_character (kate_text_encoding text_encoding, int c, char **const text, size_t *len0)
 
int kate_text_remove_markup (kate_text_encoding text_encoding, char *text, size_t *len0)
 
int kate_text_validate (kate_text_encoding text_encoding, const char *text, size_t len0)
 

Detailed Description

Function Documentation

◆ kate_text_get_character()

int kate_text_get_character ( kate_text_encoding  text_encoding,
const char **const  text,
size_t *  len0 
)

Reads a code point from the string, advancing the text pointer to the next one.

Parameters
text_encodingthe character encoding the text is coded in
texta pointer to the text pointer, to be advanced to the next character on success
len0a pointer to the length of the buffer, including any terminating NUL, to be decreased by the number of bytes that text is advanced on success
Returns
>=0 success, the unicode code point read
KATE_E_* error

References KATE_E_INVALID_PARAMETER, KATE_E_TEXT, and kate_utf8.

Referenced by kate_tracker_init().

◆ kate_text_remove_markup()

int kate_text_remove_markup ( kate_text_encoding  text_encoding,
char *  text,
size_t *  len0 
)

Removes markup from the given text.

Parameters
text_encodingthe character encoding the text is coded in
textthe text to remove markup from
len0the length in bytes of the text, including any terminating NUL - will be set to the length of the text with markup removed, including any terminating NUL
Returns
0 success
KATE_E_* error

References KATE_E_INVALID_PARAMETER, and kate_utf8.

◆ kate_text_set_character()

int kate_text_set_character ( kate_text_encoding  text_encoding,
int  c,
char **const  text,
size_t *  len0 
)

Writes a code point to the given string, advancing the text pointer to the next byte.

Parameters
text_encodingthe character encoding the text is coded in
cthe unicode code point to write to the string
texta pointer to the text pointer, to be advanced to the next character on success
len0a pointer to the length of the buffer, including any terminating NUL, to be decreased by the number of bytes that text is advanced on success
Returns
>=0 success, the number of bytes used to write this code point
KATE_E_* error

References KATE_E_INVALID_PARAMETER, KATE_E_TEXT, and kate_utf8.

◆ kate_text_validate()

int kate_text_validate ( kate_text_encoding  text_encoding,
const char *  text,
size_t  len0 
)

Validates text for the given character encoding, flagging partial sequences and invalid sequences.

Parameters
text_encodingthe character encoding the text is coded in
textthe text to validate (may include embedded NULs)
len0the length in bytes of the text, including any terminating NUL
Returns
0 success
KATE_E_* error

References KATE_E_INVALID_PARAMETER, KATE_E_TEXT, and kate_utf8.

Referenced by kate_comment_add_length(), kate_encode_text_raw_times(), and kate_meta_add_string().