#include <stdint.h>
Include dependency graph for transcode.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Data Structures | |
struct | FAXPP_Transcoder |
Encapsulates the information needed to both decode and encode an encoding. More... | |
Defines | |
#define | TRANSCODE_ERROR 1000 |
#define | TRANSCODE_PREMATURE_END_OF_BUFFER 1001 |
#define | TRANSCODE_BAD_ENCODING 1002 |
Typedefs | |
typedef uint32_t | Char32 |
A single unicode codepoint. | |
typedef unsigned int(*) | FAXPP_DecodeFunction (const void *buffer, const void *buffer_end, Char32 *ch) |
Decodes a single character from the buffer into it's unicode codepoint. | |
typedef unsigned int(*) | FAXPP_EncodeFunction (void *buffer, void *buffer_end, Char32 ch) |
Encodes a single unicode codepoint into the given buffer. | |
Functions | |
const char * | FAXPP_decode_to_string (FAXPP_DecodeFunction t) |
Returns a string describing the given (built-in) decode function. | |
const char * | FAXPP_encode_to_string (FAXPP_EncodeFunction t) |
Returns a string describing the given (built-in) encode function. | |
FAXPP_DecodeFunction | FAXPP_string_to_decode (const char *encodingName) |
Returns a FAXPP_DecodeFunction for the given encoding string, or 0 if one is not supported internally. | |
FAXPP_EncodeFunction | FAXPP_string_to_encode (const char *encodingName) |
Returns a FAXPP_EncodeFunction for the given encoding string, or 0 if one is not supported internally. | |
unsigned int | FAXPP_utf8_decode (const void *buffer, const void *buffer_end, Char32 *ch) |
Decodes a single UTF-8 character from the buffer into it's unicode codepoint. | |
unsigned int | FAXPP_iso_8859_1_decode (const void *buffer, const void *buffer_end, Char32 *ch) |
Decodes a single ISO-8859-1 (Latin1) character from the buffer into it's unicode codepoint. | |
unsigned int | FAXPP_utf16_le_decode (const void *buffer, const void *buffer_end, Char32 *ch) |
Decodes a single UTF-16 little endian character from the buffer into it's unicode codepoint. | |
unsigned int | FAXPP_utf16_be_decode (const void *buffer, const void *buffer_end, Char32 *ch) |
Decodes a single UTF-16 big endian character from the buffer into it's unicode codepoint. | |
unsigned int | FAXPP_utf16_native_decode (const void *buffer, const void *buffer_end, Char32 *ch) |
Decodes a single UTF-16 native endian character from the buffer into it's unicode codepoint. | |
unsigned int | FAXPP_ucs4_le_decode (const void *buffer, const void *buffer_end, Char32 *ch) |
Decodes a single UCS-4 little endian character from the buffer into it's unicode codepoint. | |
unsigned int | FAXPP_ucs4_be_decode (const void *buffer, const void *buffer_end, Char32 *ch) |
Decodes a single UCS-4 big endian character from the buffer into it's unicode codepoint. | |
unsigned int | FAXPP_ucs4_native_decode (const void *buffer, const void *buffer_end, Char32 *ch) |
Decodes a single UCS-4 native endian character from the buffer into it's unicode codepoint. | |
unsigned int | FAXPP_utf8_encode (void *buffer, void *buffer_end, Char32 ch) |
Encodes a single unicode codepoint as UTF-8 into the given buffer. | |
unsigned int | FAXPP_utf16_native_encode (void *buffer, void *buffer_end, Char32 ch) |
Encodes a single unicode codepoint as UTF-16 (native endian) into the given buffer. | |
Variables | |
const FAXPP_Transcoder | FAXPP_utf8_transcoder |
Transcoder to and from UTF-8. | |
const FAXPP_Transcoder | FAXPP_utf16_native_transcoder |
Transcoder to and from native endian UTF-16. |
#define TRANSCODE_BAD_ENCODING 1002 |
Definition at line 27 of file transcode.h.
#define TRANSCODE_ERROR 1000 |
Definition at line 25 of file transcode.h.
#define TRANSCODE_PREMATURE_END_OF_BUFFER 1001 |
Definition at line 26 of file transcode.h.
typedef uint32_t Char32 |
typedef unsigned int(*) FAXPP_DecodeFunction(const void *buffer, const void *buffer_end, Char32 *ch) |
Decodes a single character from the buffer into it's unicode codepoint.
buffer | The buffer to decode from | |
buffer_end | A pointer to the end of the buffer | |
[out] | ch | The decoded unicode codepoint |
TRANSCODE_PREMATURE_END_OF_BUFFER | If there is not enough buffer left to decode another character | |
TRANSCODE_BAD_ENCODING | If the the encoding is invalid |
Definition at line 47 of file transcode.h.
typedef unsigned int(*) FAXPP_EncodeFunction(void *buffer, void *buffer_end, Char32 ch) |
Encodes a single unicode codepoint into the given buffer.
buffer | The buffer to encode to | |
buffer_end | A pointer to the end of the buffer | |
ch | The unicode codepoint to encode |
TRANSCODE_PREMATURE_END_OF_BUFFER | If the buffer does not have enough space to encode the unicode codepoint |
Definition at line 65 of file transcode.h.
const char* FAXPP_decode_to_string | ( | FAXPP_DecodeFunction | t | ) |
Returns a string describing the given (built-in) decode function.
t |
const char* FAXPP_encode_to_string | ( | FAXPP_EncodeFunction | t | ) |
Returns a string describing the given (built-in) encode function.
t |
unsigned int FAXPP_iso_8859_1_decode | ( | const void * | buffer, | |
const void * | buffer_end, | |||
Char32 * | ch | |||
) |
Decodes a single ISO-8859-1 (Latin1) character from the buffer into it's unicode codepoint.
buffer | The buffer to decode from | |
buffer_end | A pointer to the end of the buffer | |
[out] | ch | The decoded unicode codepoint |
TRANSCODE_PREMATURE_END_OF_BUFFER | If there is not enough buffer left to decode another character | |
TRANSCODE_BAD_ENCODING | If the the encoding is invalid |
FAXPP_DecodeFunction FAXPP_string_to_decode | ( | const char * | encodingName | ) |
Returns a FAXPP_DecodeFunction for the given encoding string, or 0 if one is not supported internally.
encodingName | The encoding to look up |
FAXPP_EncodeFunction FAXPP_string_to_encode | ( | const char * | encodingName | ) |
Returns a FAXPP_EncodeFunction for the given encoding string, or 0 if one is not supported internally.
encodingName | The encoding to look up |
unsigned int FAXPP_ucs4_be_decode | ( | const void * | buffer, | |
const void * | buffer_end, | |||
Char32 * | ch | |||
) |
Decodes a single UCS-4 big endian character from the buffer into it's unicode codepoint.
buffer | The buffer to decode from | |
buffer_end | A pointer to the end of the buffer | |
[out] | ch | The decoded unicode codepoint |
TRANSCODE_PREMATURE_END_OF_BUFFER | If there is not enough buffer left to decode another character | |
TRANSCODE_BAD_ENCODING | If the the encoding is invalid |
unsigned int FAXPP_ucs4_le_decode | ( | const void * | buffer, | |
const void * | buffer_end, | |||
Char32 * | ch | |||
) |
Decodes a single UCS-4 little endian character from the buffer into it's unicode codepoint.
buffer | The buffer to decode from | |
buffer_end | A pointer to the end of the buffer | |
[out] | ch | The decoded unicode codepoint |
TRANSCODE_PREMATURE_END_OF_BUFFER | If there is not enough buffer left to decode another character | |
TRANSCODE_BAD_ENCODING | If the the encoding is invalid |
unsigned int FAXPP_ucs4_native_decode | ( | const void * | buffer, | |
const void * | buffer_end, | |||
Char32 * | ch | |||
) |
Decodes a single UCS-4 native endian character from the buffer into it's unicode codepoint.
buffer | The buffer to decode from | |
buffer_end | A pointer to the end of the buffer | |
[out] | ch | The decoded unicode codepoint |
TRANSCODE_PREMATURE_END_OF_BUFFER | If there is not enough buffer left to decode another character | |
TRANSCODE_BAD_ENCODING | If the the encoding is invalid |
unsigned int FAXPP_utf16_be_decode | ( | const void * | buffer, | |
const void * | buffer_end, | |||
Char32 * | ch | |||
) |
Decodes a single UTF-16 big endian character from the buffer into it's unicode codepoint.
buffer | The buffer to decode from | |
buffer_end | A pointer to the end of the buffer | |
[out] | ch | The decoded unicode codepoint |
TRANSCODE_PREMATURE_END_OF_BUFFER | If there is not enough buffer left to decode another character | |
TRANSCODE_BAD_ENCODING | If the the encoding is invalid |
unsigned int FAXPP_utf16_le_decode | ( | const void * | buffer, | |
const void * | buffer_end, | |||
Char32 * | ch | |||
) |
Decodes a single UTF-16 little endian character from the buffer into it's unicode codepoint.
buffer | The buffer to decode from | |
buffer_end | A pointer to the end of the buffer | |
[out] | ch | The decoded unicode codepoint |
TRANSCODE_PREMATURE_END_OF_BUFFER | If there is not enough buffer left to decode another character | |
TRANSCODE_BAD_ENCODING | If the the encoding is invalid |
unsigned int FAXPP_utf16_native_decode | ( | const void * | buffer, | |
const void * | buffer_end, | |||
Char32 * | ch | |||
) |
Decodes a single UTF-16 native endian character from the buffer into it's unicode codepoint.
buffer | The buffer to decode from | |
buffer_end | A pointer to the end of the buffer | |
[out] | ch | The decoded unicode codepoint |
TRANSCODE_PREMATURE_END_OF_BUFFER | If there is not enough buffer left to decode another character | |
TRANSCODE_BAD_ENCODING | If the the encoding is invalid |
unsigned int FAXPP_utf16_native_encode | ( | void * | buffer, | |
void * | buffer_end, | |||
Char32 | ch | |||
) |
Encodes a single unicode codepoint as UTF-16 (native endian) into the given buffer.
buffer | The buffer to encode to | |
buffer_end | A pointer to the end of the buffer | |
ch | The unicode codepoint to encode |
TRANSCODE_PREMATURE_END_OF_BUFFER | If the buffer does not have enough space to encode the unicode codepoint |
unsigned int FAXPP_utf8_decode | ( | const void * | buffer, | |
const void * | buffer_end, | |||
Char32 * | ch | |||
) |
Decodes a single UTF-8 character from the buffer into it's unicode codepoint.
buffer | The buffer to decode from | |
buffer_end | A pointer to the end of the buffer | |
[out] | ch | The decoded unicode codepoint |
TRANSCODE_PREMATURE_END_OF_BUFFER | If there is not enough buffer left to decode another character | |
TRANSCODE_BAD_ENCODING | If the the encoding is invalid |
unsigned int FAXPP_utf8_encode | ( | void * | buffer, | |
void * | buffer_end, | |||
Char32 | ch | |||
) |
Encodes a single unicode codepoint as UTF-8 into the given buffer.
buffer | The buffer to encode to | |
buffer_end | A pointer to the end of the buffer | |
ch | The unicode codepoint to encode |
TRANSCODE_PREMATURE_END_OF_BUFFER | If the buffer does not have enough space to encode the unicode codepoint |
Transcoder to and from native endian UTF-16.