source: NonGTP/Xerces/xerces-c_2_8_0/include/xercesc/util/Transcoders/Iconv400/iconv_util.hpp @ 2674

Revision 2674, 3.7 KB checked in by mattausch, 16 years ago (diff)
Line 
1#if (__OS400_TGTVRM__>=510)                               /* @01a */
2    #pragma datamodel(P128)                               /* @01a */
3#endif                                                    /* @01a */
4
5/*
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements.  See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License.  You may obtain a copy of the License at
12 *
13 *      http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21
22/*
23 * $Id: iconv_util.hpp 568078 2007-08-21 11:43:25Z amassari $
24 */
25
26
27#include "utypes.h"
28#include <iconv.h>
29
30XERCES_CPP_NAMESPACE_BEGIN
31
32const char* iconv_getDefaultCodepage(void);
33
34// extern "C" int QlgCvtTextDescToDesc (int, int, char *, int, char*, int, int);
35
36#define MAX_CONVERTER_NAME_LENGTH 60
37#define MAX_SUBCHAR_LEN 4
38#define ERROR_BUFFER_LENGTH 20
39typedef enum {UNKNOWN = -1, IBM = 0}
40UCNV_PLATFORM;
41typedef enum
42{
43  UNSUPPORTED_CONVERTER = -1,
44  SBCS = 0,
45  DBCS = 1,
46  MBCS = 2,
47  LATIN_1 = 3,
48  UTF8 = 4,
49  UTF16_BigEndian = 5,
50  UTF16_LittleEndian = 6,
51  EBCDIC_STATEFUL = 7,
52  ISO_2022 = 8,
53  JIS = 9,
54  EUC = 10,
55  GB = 11
56}
57UCNV_TYPE;
58int32_t
59u_strlen(const UChar *s);
60
61/* note sure if needed -  think that this is needed in cnv.c */
62char* u_austrcpy(char *s1,
63         const UChar *ucs2 );
64
65/*Defines the struct of a UConverterSharedData the immutable, shared part of
66 *UConverter
67 */
68typedef struct
69  {
70    uint32_t referenceCounter;  /*used to count number of clients */
71    char name[MAX_CONVERTER_NAME_LENGTH];       /*internal name of the converter */
72    UCNV_PLATFORM platform;     /*platform of the converter (only IBM now */
73    int32_t codepage;           /*codepage # (now IBM-$codepage) */
74    UCNV_TYPE conversionType;   /*conversion type */
75    int8_t minBytesPerChar;     /*Minimum # bytes per char in this codepage */
76    int8_t maxBytesPerChar;     /*Maximum # bytes per char in this codepage */
77
78    struct
79      {                         /*initial values of some members of the mutable part of object */
80
81        int8_t subCharLen;
82        unsigned char subChar[MAX_SUBCHAR_LEN];
83      } defaultConverterValues ;
84
85    iconv_t toiconv_handle ;     /* handle to convert to unicode*/
86    iconv_t fromiconv_handle;   /* handle to convert from unicode*/
87  }
88UConverterSharedData;
89
90
91/*Defines a UConverter, the lightweight mutable part the user sees */
92struct UConverter
93  {
94
95
96
97    int8_t pad;
98    int32_t mode;
99    int8_t subCharLen;          /*length of the codepage specific character sequence */
100    unsigned char subChar[MAX_SUBCHAR_LEN];     /*codepage specific character sequence */
101
102
103    UConverterSharedData *sharedData;   /*Pointer to the shared immutable part of the
104                                         *converter object
105                                         */
106
107
108  };
109
110typedef struct UConverter UConverter;
111
112UConverter* createNewConverter(const char *name, UErrorCode *err);
113
114/*Initializes the mutable lightweight portion of the object
115 *By copying data from UConverter->sharedData->defaultConverter
116 */
117static void   initializeDataConverter (UConverter * myUConverter);
118UConverter *createConverter (const char *converterName, UErrorCode * err);
119
120XERCES_CPP_NAMESPACE_END
121#if (__OS400_TGTVRM__>=510)                                /* @01a */ 
122     #pragma datamodel(pop)                                /* @01a */
123#endif                                                     /* @01a */
124
Note: See TracBrowser for help on using the repository browser.