guacamole/unicode.h File Reference

Provides functions for manipulating Unicode strings. More...

Go to the source code of this file.

Functions

size_t guac_utf8_charsize (unsigned char c)
 Given the initial byte of a single UTF-8 character, returns the overall byte size of the entire character.
size_t guac_utf8_strlen (const char *str)
 Given a UTF-8-encoded string, returns the length of the string in characters (not bytes).
int guac_utf8_write (int codepoint, char *utf8, int length)
 Given destination buffer and its length, writes the given codepoint as UTF-8 to the buffer, returning the number of bytes written.
int guac_utf8_read (const char *utf8, int length, int *codepoint)
 Given a buffer containing UTF-8 characters, reads the first codepoint in the buffer, returning the length of the codepoint in bytes.

Detailed Description

Provides functions for manipulating Unicode strings.


Function Documentation

size_t guac_utf8_charsize ( unsigned char  c  ) 

Given the initial byte of a single UTF-8 character, returns the overall byte size of the entire character.

Parameters:
c The initial byte of the character to check.
Returns:
The number of bytes in the given character overall.
int guac_utf8_read ( const char *  utf8,
int  length,
int *  codepoint 
)

Given a buffer containing UTF-8 characters, reads the first codepoint in the buffer, returning the length of the codepoint in bytes.

If no codepoint could be read, zero is returned.

Parameters:
utf8 A buffer containing UTF-8 characters.
length The length of the buffer, in bytes.
codepoint A pointer to an integer which will contain the codepoint read, if any. If no character can be read, the integer will be left untouched.
Returns:
The number of bytes read, which may be zero if there is not enough space in the buffer to read a character.
size_t guac_utf8_strlen ( const char *  str  ) 

Given a UTF-8-encoded string, returns the length of the string in characters (not bytes).

Parameters:
str The UTF-8 string to calculate the length of.
Returns:
The length in characters of the given UTF-8 string.
int guac_utf8_write ( int  codepoint,
char *  utf8,
int  length 
)

Given destination buffer and its length, writes the given codepoint as UTF-8 to the buffer, returning the number of bytes written.

If there is not enough space in the buffer to write the character, no bytes are written at all.

Parameters:
codepoint The Unicode codepoint to write to the buffer.
utf8 The buffer to write to.
length The length of the buffer, in bytes.
Returns:
The number of bytes written, which may be zero if there is not enough space in the buffer to write the UTF-8 character.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on 15 Aug 2017 for libguac by  doxygen 1.6.1