Eneboo - Documentación para desarrolladores
src/libdigidoc/libxml2/include/libxml/encoding.h
Ir a la documentación de este archivo.
00001 /*
00002  * Summary: interface for the encoding conversion functions
00003  * Description: interface for the encoding conversion functions needed for
00004  *              XML basic encoding and iconv() support.
00005  *
00006  * Related specs are
00007  * rfc2044        (UTF-8 and UTF-16) F. Yergeau Alis Technologies
00008  * [ISO-10646]    UTF-8 and UTF-16 in Annexes
00009  * [ISO-8859-1]   ISO Latin-1 characters codes.
00010  * [UNICODE]      The Unicode Consortium, "The Unicode Standard --
00011  *                Worldwide Character Encoding -- Version 1.0", Addison-
00012  *                Wesley, Volume 1, 1991, Volume 2, 1992.  UTF-8 is
00013  *                described in Unicode Technical Report #4.
00014  * [US-ASCII]     Coded Character Set--7-bit American Standard Code for
00015  *                Information Interchange, ANSI X3.4-1986.
00016  *
00017  * Copy: See Copyright for the status of this software.
00018  *
00019  * Author: Daniel Veillard
00020  */
00021 
00022 #ifndef __XML_CHAR_ENCODING_H__
00023 #define __XML_CHAR_ENCODING_H__
00024 
00025 #include <libxml/xmlversion.h>
00026 
00027 #ifdef LIBXML_ICONV_ENABLED
00028 #include <iconv.h>
00029 #endif
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033 
00034 /*
00035  * xmlCharEncoding:
00036  *
00037  * Predefined values for some standard encodings.
00038  * Libxml does not do beforehand translation on UTF8 and ISOLatinX.
00039  * It also supports ASCII, ISO-8859-1, and UTF16 (LE and BE) by default.
00040  *
00041  * Anything else would have to be translated to UTF8 before being
00042  * given to the parser itself. The BOM for UTF16 and the encoding
00043  * declaration are looked at and a converter is looked for at that
00044  * point. If not found the parser stops here as asked by the XML REC. A
00045  * converter can be registered by the user using xmlRegisterCharEncodingHandler
00046  * but the current form doesn't allow stateful transcoding (a serious
00047  * problem agreed !). If iconv has been found it will be used
00048  * automatically and allow stateful transcoding, the simplest is then
00049  * to be sure to enable iconv and to provide iconv libs for the encoding
00050  * support needed.
00051  *
00052  * Note that the generic "UTF-16" is not a predefined value.  Instead, only
00053  * the specific UTF-16LE and UTF-16BE are present.
00054  */
00055 typedef enum {
00056     XML_CHAR_ENCODING_ERROR=   -1, /* No char encoding detected */
00057     XML_CHAR_ENCODING_NONE=     0, /* No char encoding detected */
00058     XML_CHAR_ENCODING_UTF8=     1, /* UTF-8 */
00059     XML_CHAR_ENCODING_UTF16LE=  2, /* UTF-16 little endian */
00060     XML_CHAR_ENCODING_UTF16BE=  3, /* UTF-16 big endian */
00061     XML_CHAR_ENCODING_UCS4LE=   4, /* UCS-4 little endian */
00062     XML_CHAR_ENCODING_UCS4BE=   5, /* UCS-4 big endian */
00063     XML_CHAR_ENCODING_EBCDIC=   6, /* EBCDIC uh! */
00064     XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */
00065     XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */
00066     XML_CHAR_ENCODING_UCS2=     9, /* UCS-2 */
00067     XML_CHAR_ENCODING_8859_1=   10,/* ISO-8859-1 ISO Latin 1 */
00068     XML_CHAR_ENCODING_8859_2=   11,/* ISO-8859-2 ISO Latin 2 */
00069     XML_CHAR_ENCODING_8859_3=   12,/* ISO-8859-3 */
00070     XML_CHAR_ENCODING_8859_4=   13,/* ISO-8859-4 */
00071     XML_CHAR_ENCODING_8859_5=   14,/* ISO-8859-5 */
00072     XML_CHAR_ENCODING_8859_6=   15,/* ISO-8859-6 */
00073     XML_CHAR_ENCODING_8859_7=   16,/* ISO-8859-7 */
00074     XML_CHAR_ENCODING_8859_8=   17,/* ISO-8859-8 */
00075     XML_CHAR_ENCODING_8859_9=   18,/* ISO-8859-9 */
00076     XML_CHAR_ENCODING_2022_JP=  19,/* ISO-2022-JP */
00077     XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */
00078     XML_CHAR_ENCODING_EUC_JP=   21,/* EUC-JP */
00079     XML_CHAR_ENCODING_ASCII=    22 /* pure ASCII */
00080 } xmlCharEncoding;
00081 
00098 typedef int (* xmlCharEncodingInputFunc)(unsigned char *out, int *outlen,
00099                                          const unsigned char *in, int *inlen);
00100 
00101 
00120 typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen,
00121                                           const unsigned char *in, int *inlen);
00122 
00123 
00124 /*
00125  * Block defining the handlers for non UTF-8 encodings.
00126  * If iconv is supported, there are two extra fields.
00127  */
00128 
00129 typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler;
00130 typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr;
00131 struct _xmlCharEncodingHandler {
00132     char                       *name;
00133     xmlCharEncodingInputFunc   input;
00134     xmlCharEncodingOutputFunc  output;
00135 #ifdef LIBXML_ICONV_ENABLED
00136     iconv_t                    iconv_in;
00137     iconv_t                    iconv_out;
00138 #endif /* LIBXML_ICONV_ENABLED */
00139 };
00140 
00141 #ifdef __cplusplus
00142 }
00143 #endif
00144 #include <libxml/tree.h>
00145 #ifdef __cplusplus
00146 extern "C" {
00147 #endif
00148 
00149 /*
00150  * Interfaces for encoding handlers.
00151  */
00152 XMLPUBFUN void XMLCALL  
00153         xmlInitCharEncodingHandlers     (void);
00154 XMLPUBFUN void XMLCALL  
00155         xmlCleanupCharEncodingHandlers  (void);
00156 XMLPUBFUN void XMLCALL  
00157         xmlRegisterCharEncodingHandler  (xmlCharEncodingHandlerPtr handler);
00158 XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
00159         xmlGetCharEncodingHandler       (xmlCharEncoding enc);
00160 XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
00161         xmlFindCharEncodingHandler      (const char *name);
00162 XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
00163         xmlNewCharEncodingHandler       (const char *name, 
00164                                          xmlCharEncodingInputFunc input,
00165                                          xmlCharEncodingOutputFunc output);
00166 
00167 /*
00168  * Interfaces for encoding names and aliases.
00169  */
00170 XMLPUBFUN int XMLCALL   
00171         xmlAddEncodingAlias             (const char *name,
00172                                          const char *alias);
00173 XMLPUBFUN int XMLCALL   
00174         xmlDelEncodingAlias             (const char *alias);
00175 XMLPUBFUN const char * XMLCALL
00176         xmlGetEncodingAlias             (const char *alias);
00177 XMLPUBFUN void XMLCALL  
00178         xmlCleanupEncodingAliases       (void);
00179 XMLPUBFUN xmlCharEncoding XMLCALL
00180         xmlParseCharEncoding            (const char *name);
00181 XMLPUBFUN const char * XMLCALL
00182         xmlGetCharEncodingName          (xmlCharEncoding enc);
00183 
00184 /*
00185  * Interfaces directly used by the parsers.
00186  */
00187 XMLPUBFUN xmlCharEncoding XMLCALL
00188         xmlDetectCharEncoding           (const unsigned char *in,
00189                                          int len);
00190 
00191 XMLPUBFUN int XMLCALL   
00192         xmlCharEncOutFunc               (xmlCharEncodingHandler *handler,
00193                                          xmlBufferPtr out,
00194                                          xmlBufferPtr in);
00195 
00196 XMLPUBFUN int XMLCALL   
00197         xmlCharEncInFunc                (xmlCharEncodingHandler *handler,
00198                                          xmlBufferPtr out,
00199                                          xmlBufferPtr in);
00200 XMLPUBFUN int XMLCALL
00201         xmlCharEncFirstLine             (xmlCharEncodingHandler *handler,
00202                                          xmlBufferPtr out,
00203                                          xmlBufferPtr in);
00204 XMLPUBFUN int XMLCALL   
00205         xmlCharEncCloseFunc             (xmlCharEncodingHandler *handler);
00206 
00207 /*
00208  * Export a few useful functions
00209  */
00210 #ifdef LIBXML_OUTPUT_ENABLED
00211 XMLPUBFUN int XMLCALL   
00212         UTF8Toisolat1                   (unsigned char *out,
00213                                          int *outlen,
00214                                          const unsigned char *in,
00215                                          int *inlen);
00216 #endif /* LIBXML_OUTPUT_ENABLED */
00217 XMLPUBFUN int XMLCALL   
00218         isolat1ToUTF8                   (unsigned char *out,
00219                                          int *outlen,
00220                                          const unsigned char *in,
00221                                          int *inlen);
00222 #ifdef __cplusplus
00223 }
00224 #endif
00225 
00226 #endif /* __XML_CHAR_ENCODING_H__ */
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'