00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __FAXPP__TRANSCODE_H
00018 #define __FAXPP__TRANSCODE_H
00019
00020 #include <stdint.h>
00021
00023 typedef uint32_t Char32;
00024
00025 #define TRANSCODE_ERROR 1000
00026 #define TRANSCODE_PREMATURE_END_OF_BUFFER 1001
00027 #define TRANSCODE_BAD_ENCODING 1002
00028
00046 typedef unsigned int (*FAXPP_DecodeFunction)
00047 (const void *buffer, const void *buffer_end, Char32 *ch);
00048
00064 typedef unsigned int (*FAXPP_EncodeFunction)
00065 (void *buffer, void *buffer_end, Char32 ch);
00066
00073 typedef struct {
00074 FAXPP_DecodeFunction decode;
00075 FAXPP_EncodeFunction encode;
00076 } FAXPP_Transcoder;
00077
00083 extern const FAXPP_Transcoder FAXPP_utf8_transcoder;
00089 extern const FAXPP_Transcoder FAXPP_utf16_native_transcoder;
00090
00096 const char *FAXPP_decode_to_string(FAXPP_DecodeFunction t);
00097
00103 const char *FAXPP_encode_to_string(FAXPP_EncodeFunction t);
00104
00111 FAXPP_DecodeFunction FAXPP_string_to_decode(const char *encodingName);
00112
00119 FAXPP_EncodeFunction FAXPP_string_to_encode(const char *encodingName);
00120
00137 unsigned int FAXPP_utf8_decode(const void *buffer, const void *buffer_end, Char32 *ch);
00138
00155 unsigned int FAXPP_iso_8859_1_decode(const void *buffer, const void *buffer_end, Char32 *ch);
00156
00173 unsigned int FAXPP_utf16_le_decode(const void *buffer, const void *buffer_end, Char32 *ch);
00174
00191 unsigned int FAXPP_utf16_be_decode(const void *buffer, const void *buffer_end, Char32 *ch);
00192
00209 unsigned int FAXPP_utf16_native_decode(const void *buffer, const void *buffer_end, Char32 *ch);
00210
00227 unsigned int FAXPP_ucs4_le_decode(const void *buffer, const void *buffer_end, Char32 *ch);
00228
00245 unsigned int FAXPP_ucs4_be_decode(const void *buffer, const void *buffer_end, Char32 *ch);
00246
00263 unsigned int FAXPP_ucs4_native_decode(const void *buffer, const void *buffer_end, Char32 *ch);
00264
00280 unsigned int FAXPP_utf8_encode(void *buffer, void *buffer_end, Char32 ch);
00281
00297 unsigned int FAXPP_utf16_native_encode(void *buffer, void *buffer_end, Char32 ch);
00298
00299 #endif