Ring Daemon 16.0.0
Loading...
Searching...
No Matches
utf8_utils.cpp File Reference
Include dependency graph for utf8_utils.cpp:

Go to the source code of this file.

Namespaces

namespace  jami
 

Macros

#define CONTINUATION_CHAR
 
#define LIKELY(expr)   (expr)
 
#define UNICODE_VALID(Char)   ((Char) < 0x110000 && (((Char) &0xFFFFF800) != 0xD800))
 
#define UNLIKELY(expr)   (expr)
 

Functions

static const charjami::fast_validate (const char *str)
 
static const charjami::fast_validate_len (const char *str, ssize_t max_len)
 
bool jami::utf8_validate (std::string_view str)
 utf8_validate:
 
bool jami::utf8_validate_c_str (const char *str, ssize_t max_len, const char **end)
 utf8_validate_c_str: @str: a pointer to character data @max_len: max bytes to validate, or -1 to go until NULL @end: return location for end of valid data
 
: a pointer to a nul delimited string.

utf8_make_valid:

Transforms a unknown c_string into a pretty utf8 encoded std::string. Every unreadable or invalid byte will be transformed into U+FFFD (REPLACEMENT CHARACTER).

Returns: a valid utf8 string.

std::string jami::utf8_make_valid (std::string_view name)
 

Macro Definition Documentation

◆ CONTINUATION_CHAR

#define CONTINUATION_CHAR
Value:
if ((*(unsigned char*) p & 0xc0) != 0x80) /* 10xxxxxx */ \
goto error; \
val <<= 6; \
val |= (*(unsigned char*) p) & 0x3f;

Definition at line 56 of file utf8_utils.cpp.

◆ LIKELY

#define LIKELY (   expr)    (expr)

Definition at line 40 of file utf8_utils.cpp.

◆ UNICODE_VALID

#define UNICODE_VALID (   Char)    ((Char) < 0x110000 && (((Char) &0xFFFFF800) != 0xD800))

Definition at line 54 of file utf8_utils.cpp.

◆ UNLIKELY

#define UNLIKELY (   expr)    (expr)

Definition at line 41 of file utf8_utils.cpp.