ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

encoding.h
Go to the documentation of this file.
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 LIBXML_ICU_ENABLED
00031 #include <unicode/ucnv.h>
00032 #endif
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036 
00037 /*
00038  * xmlCharEncoding:
00039  *
00040  * Predefined values for some standard encodings.
00041  * Libxml does not do beforehand translation on UTF8 and ISOLatinX.
00042  * It also supports ASCII, ISO-8859-1, and UTF16 (LE and BE) by default.
00043  *
00044  * Anything else would have to be translated to UTF8 before being
00045  * given to the parser itself. The BOM for UTF16 and the encoding
00046  * declaration are looked at and a converter is looked for at that
00047  * point. If not found the parser stops here as asked by the XML REC. A
00048  * converter can be registered by the user using xmlRegisterCharEncodingHandler
00049  * but the current form doesn't allow stateful transcoding (a serious
00050  * problem agreed !). If iconv has been found it will be used
00051  * automatically and allow stateful transcoding, the simplest is then
00052  * to be sure to enable iconv and to provide iconv libs for the encoding
00053  * support needed.
00054  *
00055  * Note that the generic "UTF-16" is not a predefined value.  Instead, only
00056  * the specific UTF-16LE and UTF-16BE are present.
00057  */
00058 typedef enum {
00059     XML_CHAR_ENCODING_ERROR=   -1, /* No char encoding detected */
00060     XML_CHAR_ENCODING_NONE= 0, /* No char encoding detected */
00061     XML_CHAR_ENCODING_UTF8= 1, /* UTF-8 */
00062     XML_CHAR_ENCODING_UTF16LE=  2, /* UTF-16 little endian */
00063     XML_CHAR_ENCODING_UTF16BE=  3, /* UTF-16 big endian */
00064     XML_CHAR_ENCODING_UCS4LE=   4, /* UCS-4 little endian */
00065     XML_CHAR_ENCODING_UCS4BE=   5, /* UCS-4 big endian */
00066     XML_CHAR_ENCODING_EBCDIC=   6, /* EBCDIC uh! */
00067     XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */
00068     XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */
00069     XML_CHAR_ENCODING_UCS2= 9, /* UCS-2 */
00070     XML_CHAR_ENCODING_8859_1=   10,/* ISO-8859-1 ISO Latin 1 */
00071     XML_CHAR_ENCODING_8859_2=   11,/* ISO-8859-2 ISO Latin 2 */
00072     XML_CHAR_ENCODING_8859_3=   12,/* ISO-8859-3 */
00073     XML_CHAR_ENCODING_8859_4=   13,/* ISO-8859-4 */
00074     XML_CHAR_ENCODING_8859_5=   14,/* ISO-8859-5 */
00075     XML_CHAR_ENCODING_8859_6=   15,/* ISO-8859-6 */
00076     XML_CHAR_ENCODING_8859_7=   16,/* ISO-8859-7 */
00077     XML_CHAR_ENCODING_8859_8=   17,/* ISO-8859-8 */
00078     XML_CHAR_ENCODING_8859_9=   18,/* ISO-8859-9 */
00079     XML_CHAR_ENCODING_2022_JP=  19,/* ISO-2022-JP */
00080     XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */
00081     XML_CHAR_ENCODING_EUC_JP=   21,/* EUC-JP */
00082     XML_CHAR_ENCODING_ASCII=    22 /* pure ASCII */
00083 } xmlCharEncoding;
00084 
00101 typedef int (* xmlCharEncodingInputFunc)(unsigned char *out, int *outlen,
00102                                          const unsigned char *in, int *inlen);
00103 
00104 
00123 typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen,
00124                                           const unsigned char *in, int *inlen);
00125 
00126 
00127 /*
00128  * Block defining the handlers for non UTF-8 encodings.
00129  * If iconv is supported, there are two extra fields.
00130  */
00131 #ifdef LIBXML_ICU_ENABLED
00132 struct _uconv_t {
00133   UConverter *uconv; /* for conversion between an encoding and UTF-16 */
00134   UConverter *utf8; /* for conversion between UTF-8 and UTF-16 */
00135 };
00136 typedef struct _uconv_t uconv_t;
00137 #endif
00138 
00139 typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler;
00140 typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr;
00141 struct _xmlCharEncodingHandler {
00142     char                       *name;
00143     xmlCharEncodingInputFunc   input;
00144     xmlCharEncodingOutputFunc  output;
00145 #ifdef LIBXML_ICONV_ENABLED
00146     iconv_t                    iconv_in;
00147     iconv_t                    iconv_out;
00148 #endif /* LIBXML_ICONV_ENABLED */
00149 #ifdef LIBXML_ICU_ENABLED
00150     uconv_t                    *uconv_in;
00151     uconv_t                    *uconv_out;
00152 #endif /* LIBXML_ICU_ENABLED */
00153 };
00154 
00155 #ifdef __cplusplus
00156 }
00157 #endif
00158 #include <libxml/tree.h>
00159 #ifdef __cplusplus
00160 extern "C" {
00161 #endif
00162 
00163 /*
00164  * Interfaces for encoding handlers.
00165  */
00166 XMLPUBFUN void XMLCALL  
00167     xmlInitCharEncodingHandlers (void);
00168 XMLPUBFUN void XMLCALL  
00169     xmlCleanupCharEncodingHandlers  (void);
00170 XMLPUBFUN void XMLCALL  
00171     xmlRegisterCharEncodingHandler  (xmlCharEncodingHandlerPtr handler);
00172 XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
00173     xmlGetCharEncodingHandler   (xmlCharEncoding enc);
00174 XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
00175     xmlFindCharEncodingHandler  (const char *name);
00176 XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
00177     xmlNewCharEncodingHandler   (const char *name, 
00178                                  xmlCharEncodingInputFunc input,
00179                                  xmlCharEncodingOutputFunc output);
00180 
00181 /*
00182  * Interfaces for encoding names and aliases.
00183  */
00184 XMLPUBFUN int XMLCALL   
00185     xmlAddEncodingAlias     (const char *name,
00186                      const char *alias);
00187 XMLPUBFUN int XMLCALL   
00188     xmlDelEncodingAlias     (const char *alias);
00189 XMLPUBFUN const char * XMLCALL
00190     xmlGetEncodingAlias     (const char *alias);
00191 XMLPUBFUN void XMLCALL  
00192     xmlCleanupEncodingAliases   (void);
00193 XMLPUBFUN xmlCharEncoding XMLCALL
00194     xmlParseCharEncoding        (const char *name);
00195 XMLPUBFUN const char * XMLCALL
00196     xmlGetCharEncodingName      (xmlCharEncoding enc);
00197 
00198 /*
00199  * Interfaces directly used by the parsers.
00200  */
00201 XMLPUBFUN xmlCharEncoding XMLCALL
00202     xmlDetectCharEncoding       (const unsigned char *in,
00203                      int len);
00204 
00205 XMLPUBFUN int XMLCALL   
00206     xmlCharEncOutFunc       (xmlCharEncodingHandler *handler,
00207                      xmlBufferPtr out,
00208                      xmlBufferPtr in);
00209 
00210 XMLPUBFUN int XMLCALL   
00211     xmlCharEncInFunc        (xmlCharEncodingHandler *handler,
00212                      xmlBufferPtr out,
00213                      xmlBufferPtr in);
00214 XMLPUBFUN int XMLCALL
00215     xmlCharEncFirstLine     (xmlCharEncodingHandler *handler,
00216                      xmlBufferPtr out,
00217                      xmlBufferPtr in);
00218 XMLPUBFUN int XMLCALL   
00219     xmlCharEncCloseFunc     (xmlCharEncodingHandler *handler);
00220 
00221 /*
00222  * Export a few useful functions
00223  */
00224 #ifdef LIBXML_OUTPUT_ENABLED
00225 XMLPUBFUN int XMLCALL   
00226     UTF8Toisolat1           (unsigned char *out,
00227                      int *outlen,
00228                      const unsigned char *in,
00229                      int *inlen);
00230 #endif /* LIBXML_OUTPUT_ENABLED */
00231 XMLPUBFUN int XMLCALL   
00232     isolat1ToUTF8           (unsigned char *out,
00233                      int *outlen,
00234                      const unsigned char *in,
00235                      int *inlen);
00236 #ifdef __cplusplus
00237 }
00238 #endif
00239 
00240 #endif /* __XML_CHAR_ENCODING_H__ */

Generated on Sat May 26 2012 04:32:00 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.