- Main Page
- Data Structures
- Files
- Examples

# transcode.h

Go to the documentation of this file.

    00001 /*
    00002  * Copyright 2007 Doxological Ltd.
    00003  *
    00004  * Licensed under the Apache License, Version 2.0 (the "License");
    00005  * you may not use this file except in compliance with the License.
    00006  * You may obtain a copy of the License at
    00007  *
    00008  *     http://www.apache.org/licenses/LICENSE-2.0
    00009  *
    00010  * Unless required by applicable law or agreed to in writing, software
    00011  * distributed under the License is distributed on an "AS IS" BASIS,
    00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00013  * See the License for the specific language governing permissions and
    00014  * limitations under the License.
    00015  */
    00016
    00017 #ifndef __FAXPP__TRANSCODE_H
    00018 #define __FAXPP__TRANSCODE_H
    00019
    00020 #ifdef _MSC_VER
    00021 typedef unsigned __int8 uint8_t
    00022 typedef unsigned __int16 uint16_t
    00023 typedef unsigned __int32 uint32_t
    00024 #else
    00025 #include <stdint.h>
    00026 #endif
    00027
    00029 typedef uint32_t Char32;
    00030
    00031 #define TRANSCODE_ERROR 1000
    00032 #define TRANSCODE_PREMATURE_END_OF_BUFFER 1001
    00033 #define TRANSCODE_BAD_ENCODING 1002
    00034
    00052 typedef unsigned int (*FAXPP_DecodeFunction)
    00053      (const void *buffer, const void *buffer_end, Char32 *ch);
    00054
    00070 typedef unsigned int (*FAXPP_EncodeFunction)
    00071      (void *buffer, void *buffer_end, Char32 ch);
    00072
    00079 typedef struct {
    00080   FAXPP_DecodeFunction decode;
    00081   FAXPP_EncodeFunction encode;
    00082 } FAXPP_Transcoder;
    00083
    00089 extern const FAXPP_Transcoder FAXPP_utf8_transcoder;
    00095 extern const FAXPP_Transcoder FAXPP_utf16_native_transcoder;
    00096
    00102 const char *FAXPP_decode_to_string(FAXPP_DecodeFunction t);
    00103
    00109 const char *FAXPP_encode_to_string(FAXPP_EncodeFunction t);
    00110
    00117 FAXPP_DecodeFunction FAXPP_string_to_decode(const char *encodingName);
    00118
    00125 FAXPP_EncodeFunction FAXPP_string_to_encode(const char *encodingName);
    00126
    00143 unsigned int FAXPP_utf8_decode(const void *buffer, const void *buffer_end, Char32 *ch);
    00144
    00161 unsigned int FAXPP_iso_8859_1_decode(const void *buffer, const void *buffer_end, Char32 *ch);
    00162
    00179 unsigned int FAXPP_utf16_le_decode(const void *buffer, const void *buffer_end, Char32 *ch);
    00180
    00197 unsigned int FAXPP_utf16_be_decode(const void *buffer, const void *buffer_end, Char32 *ch);
    00198
    00215 unsigned int FAXPP_utf16_native_decode(const void *buffer, const void *buffer_end, Char32 *ch);
    00216
    00233 unsigned int FAXPP_ucs4_le_decode(const void *buffer, const void *buffer_end, Char32 *ch);
    00234
    00251 unsigned int FAXPP_ucs4_be_decode(const void *buffer, const void *buffer_end, Char32 *ch);
    00252
    00269 unsigned int FAXPP_ucs4_native_decode(const void *buffer, const void *buffer_end, Char32 *ch);
    00270
    00286 unsigned int FAXPP_utf8_encode(void *buffer, void *buffer_end, Char32 ch);
    00287
    00303 unsigned int FAXPP_utf16_native_encode(void *buffer, void *buffer_end, Char32 ch);
    00304
    00305 #endif