Fcitx
Macros | Functions
cutf8.h File Reference

C-style utf8 utility functions. More...

#include <cstdint>
#include <cstdlib>
#include <fcitx-utils/fcitxutils_export.h>
Include dependency graph for cutf8.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FCITX_UTF8_MAX_LENGTH   6
 

Functions

FCITXUTILS_EXPORT size_t fcitx_utf8_strlen (const char *s)
 Get utf8 string length.
 
FCITXUTILS_EXPORT char * fcitx_utf8_get_char (const char *in, uint32_t *chr)
 Get UCS-4 char in the utf8 string.
 
FCITXUTILS_EXPORT unsigned int fcitx_utf8_char_len (const char *in)
 Get the number of bytes of next character.
 
FCITXUTILS_EXPORT char * fcitx_utf8_get_nth_char (const char *s, uint32_t n)
 Get the pointer to the nth character. More...
 
FCITXUTILS_EXPORT bool fcitx_utf8_check_string (const char *s)
 Check if the string is valid utf8 string.
 
FCITXUTILS_EXPORT uint32_t fcitx_utf8_get_char_validated (const char *p, int max_len, int *plen)
 Get validated character. More...
 
FCITXUTILS_EXPORT void fcitx_utf8_strncpy (char *str, const char *s, size_t byte)
 Copy most byte length, but keep utf8 valid.
 
FCITXUTILS_EXPORT size_t fcitx_utf8_strnlen (const char *str, size_t byte)
 Count most byte length, utf8 string length.
 
FCITXUTILS_EXPORT size_t fcitx_utf8_strnlen_validated (const char *str, size_t byte)
 Count most byte length, utf8 string length and validates the string.
 
FCITXUTILS_EXPORT int fcitx_ucs4_char_len (uint32_t c)
 Return the utf8 bytes of a UCS4 char.
 
FCITXUTILS_EXPORT int fcitx_ucs4_to_utf8 (uint32_t c, char *output)
 Convert ucs4 char to utf8, need to have enough memory for it.
 

Detailed Description

C-style utf8 utility functions.

Definition in file cutf8.h.