source: NonGTP/Xerces/xercesc/util/Transcoders/Iconv400/iconv_util.hpp @ 188

Revision 188, 5.6 KB checked in by mattausch, 19 years ago (diff)

added xercesc to support

Line 
1/*
2 * The Apache Software License, Version 1.1
3 *
4 * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
5 * reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 *
14 * 2. Redistributions in binary form must reproduce the above copyright
15 *    notice, this list of conditions and the following disclaimer in
16 *    the documentation and/or other materials provided with the
17 *    distribution.
18 *
19 * 3. The end-user documentation included with the redistribution,
20 *    if any, must include the following acknowledgment:
21 *       "This product includes software developed by the
22 *        Apache Software Foundation (http://www.apache.org/)."
23 *    Alternately, this acknowledgment may appear in the software itself,
24 *    if and wherever such third-party acknowledgments normally appear.
25 *
26 * 4. The names "Xerces" and "Apache Software Foundation" must
27 *    not be used to endorse or promote products derived from this
28 *    software without prior written permission. For written
29 *    permission, please contact apache\@apache.org.
30 *
31 * 5. Products derived from this software may not be called "Apache",
32 *    nor may "Apache" appear in their name, without prior written
33 *    permission of the Apache Software Foundation.
34 *
35 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
36 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
39 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
42 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
45 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46 * SUCH DAMAGE.
47 * ====================================================================
48 *
49 * This software consists of voluntary contributions made by many
50 * individuals on behalf of the Apache Software Foundation, and was
51 * originally based on software copyright (c) 1999, International
52 * Business Machines, Inc., http://www.ibm.com .  For more information
53 * on the Apache Software Foundation, please see
54 * <http://www.apache.org/>.
55 */
56
57/**
58 * $Log: iconv_util.hpp,v $
59 * Revision 1.2  2002/11/04 15:14:33  tng
60 * C++ Namespace Support.
61 *
62 * Revision 1.1.1.1  2002/02/01 22:22:36  peiyongz
63 * sane_include
64 *
65 * Revision 1.1  2001/06/25 16:20:08  tng
66 * Rename iconv_util.h to iconv_util.hpp.  AS400 changes by Linda Swan.
67 *
68 * Revision 1.1  2000/02/10 18:08:28  abagchi
69 * Initial checkin
70 *
71 */
72
73
74const char* iconv_getDefaultCodepage(void);
75
76
77#include "utypes.h"
78#include <iconv.h>
79
80extern "C" int QlgCvtTextDescToDesc (int, int, char *, int, char*, int, int);
81
82#define MAX_CONVERTER_NAME_LENGTH 60
83#define MAX_SUBCHAR_LEN 4
84#define ERROR_BUFFER_LENGTH 20
85typedef enum {UNKNOWN = -1, IBM = 0}
86UCNV_PLATFORM;
87typedef enum
88{
89  UNSUPPORTED_CONVERTER = -1,
90  SBCS = 0,
91  DBCS = 1,
92  MBCS = 2,
93  LATIN_1 = 3,
94  UTF8 = 4,
95  UTF16_BigEndian = 5,
96  UTF16_LittleEndian = 6,
97  EBCDIC_STATEFUL = 7,
98  ISO_2022 = 8,
99  JIS = 9,
100  EUC = 10,
101  GB = 11
102}
103UCNV_TYPE;
104int32_t
105u_strlen(const UChar *s);
106
107/* note sure if needed -  think that this is needed in cnv.c */
108char* u_austrcpy(char *s1,
109         const UChar *ucs2 );
110
111/*Defines the struct of a UConverterSharedData the immutable, shared part of
112 *UConverter
113 */
114typedef struct
115  {
116    uint32_t referenceCounter;  /*used to count number of clients */
117    char name[MAX_CONVERTER_NAME_LENGTH];       /*internal name of the converter */
118    UCNV_PLATFORM platform;     /*platform of the converter (only IBM now */
119    int32_t codepage;           /*codepage # (now IBM-$codepage) */
120    UCNV_TYPE conversionType;   /*conversion type */
121    int8_t minBytesPerChar;     /*Minimum # bytes per char in this codepage */
122    int8_t maxBytesPerChar;     /*Maximum # bytes per char in this codepage */
123
124    struct
125      {                         /*initial values of some members of the mutable part of object */
126
127        int8_t subCharLen;
128        unsigned char subChar[MAX_SUBCHAR_LEN];
129      } defaultConverterValues ;
130
131    iconv_t toiconv_handle ;     /* handle to convert to unicode*/
132    iconv_t fromiconv_handle;   /* handle to convert from unicode*/
133  }
134UConverterSharedData;
135
136
137/*Defines a UConverter, the lightweight mutable part the user sees */
138struct UConverter
139  {
140
141
142
143    int8_t pad;
144    int32_t mode;
145    int8_t subCharLen;          /*length of the codepage specific character sequence */
146    unsigned char subChar[MAX_SUBCHAR_LEN];     /*codepage specific character sequence */
147
148
149    UConverterSharedData *sharedData;   /*Pointer to the shared immutable part of the
150                                         *converter object
151                                         */
152
153
154  };
155
156typedef struct UConverter UConverter;
157
158UConverter* createNewConverter(const char *name, UErrorCode *err);
159
160/*Initializes the mutable lightweight portion of the object
161 *By copying data from UConverter->sharedData->defaultConverter
162 */
163static void   initializeDataConverter (UConverter * myUConverter);
164UConverter *createConverter (const char *converterName, UErrorCode * err);
165
166XERCES_CPP_NAMESPACE_END
Note: See TracBrowser for help on using the repository browser.