SourceForge.net Logo

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 #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

Generated on Thu Mar 20 02:12:09 2008 for Faxpp by  doxygen 1.5.1