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 | * @02A V5R2M0 200419 jrhansen : support lowercase function |
---|
24 | * $Id: Iconv400TransService.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
25 | */ |
---|
26 | |
---|
27 | #ifndef ICONV400TRANSSERVICE_HPP |
---|
28 | #define ICONV400TRANSSERVICE_HPP |
---|
29 | |
---|
30 | #include <xercesc/util/Mutexes.hpp> |
---|
31 | #include <xercesc/util/TransService.hpp> |
---|
32 | #include <qlg.h> |
---|
33 | |
---|
34 | XERCES_CPP_NAMESPACE_BEGIN |
---|
35 | |
---|
36 | struct UConverter; |
---|
37 | |
---|
38 | class XMLUTIL_EXPORT Iconv400TransService : public XMLTransService |
---|
39 | { |
---|
40 | public : |
---|
41 | // ----------------------------------------------------------------------- |
---|
42 | // Public, static methods |
---|
43 | // ----------------------------------------------------------------------- |
---|
44 | |
---|
45 | |
---|
46 | // ----------------------------------------------------------------------- |
---|
47 | // Constructors and Destructor |
---|
48 | // ----------------------------------------------------------------------- |
---|
49 | Iconv400TransService(); |
---|
50 | ~Iconv400TransService(); |
---|
51 | |
---|
52 | |
---|
53 | // ----------------------------------------------------------------------- |
---|
54 | // Implementation of the virtual transcoding service API |
---|
55 | // ----------------------------------------------------------------------- |
---|
56 | virtual int compareIString |
---|
57 | ( |
---|
58 | const XMLCh* const comp1 |
---|
59 | , const XMLCh* const comp2 |
---|
60 | ); |
---|
61 | |
---|
62 | virtual int compareNIString |
---|
63 | ( |
---|
64 | const XMLCh* const comp1 |
---|
65 | , const XMLCh* const comp2 |
---|
66 | , const unsigned int maxChars |
---|
67 | ); |
---|
68 | |
---|
69 | virtual const XMLCh* getId() const; |
---|
70 | |
---|
71 | virtual bool isSpace(const XMLCh toCheck) const; |
---|
72 | |
---|
73 | virtual XMLLCPTranscoder* makeNewLCPTranscoder(); |
---|
74 | |
---|
75 | virtual bool supportsSrcOfs() const; |
---|
76 | |
---|
77 | virtual void upperCase(XMLCh* const toUpperCase) const; |
---|
78 | virtual void lowerCase(XMLCh* const toLowerCase) const; |
---|
79 | |
---|
80 | |
---|
81 | protected : |
---|
82 | // ----------------------------------------------------------------------- |
---|
83 | // Protected virtual methods |
---|
84 | // ----------------------------------------------------------------------- |
---|
85 | virtual XMLTranscoder* makeNewXMLTranscoder |
---|
86 | ( |
---|
87 | const XMLCh* const encodingName |
---|
88 | , XMLTransService::Codes& resValue |
---|
89 | , const unsigned int blockSize |
---|
90 | , MemoryManager* const manager |
---|
91 | ); |
---|
92 | |
---|
93 | |
---|
94 | private : |
---|
95 | // ----------------------------------------------------------------------- |
---|
96 | // Unimplemented constructors and operators |
---|
97 | // ----------------------------------------------------------------------- |
---|
98 | Iconv400TransService(const Iconv400TransService&); |
---|
99 | Iconv400TransService& operator=(const Iconv400TransService&); |
---|
100 | |
---|
101 | XMLCh toUnicodeUpper(XMLCh toupper) const; |
---|
102 | XMLCh toUnicodeLower(XMLCh tolower) const; |
---|
103 | |
---|
104 | Qlg_CCSID_ReqCtlBlk_T convertCtlblkUpper; |
---|
105 | Qlg_CCSID_ReqCtlBlk_T convertCtlblkLower; |
---|
106 | |
---|
107 | }; |
---|
108 | |
---|
109 | |
---|
110 | |
---|
111 | class XMLUTIL_EXPORT Iconv400Transcoder : public XMLTranscoder |
---|
112 | { |
---|
113 | public : |
---|
114 | // ----------------------------------------------------------------------- |
---|
115 | // Constructors and Destructor |
---|
116 | // ----------------------------------------------------------------------- |
---|
117 | Iconv400Transcoder |
---|
118 | ( |
---|
119 | const XMLCh* const encodingName |
---|
120 | , UConverter* const toAdopt |
---|
121 | , const unsigned int blockSize |
---|
122 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
---|
123 | ); |
---|
124 | ~Iconv400Transcoder(); |
---|
125 | |
---|
126 | // ----------------------------------------------------------------------- |
---|
127 | // Implementation of the virtual transcoder interface |
---|
128 | // ----------------------------------------------------------------------- |
---|
129 | virtual unsigned int transcodeFrom |
---|
130 | ( |
---|
131 | const XMLByte* const srcData |
---|
132 | , const unsigned int srcCount |
---|
133 | , XMLCh* const toFill |
---|
134 | , const unsigned int maxChars |
---|
135 | , unsigned int& bytesEaten |
---|
136 | , unsigned char* const charSizes |
---|
137 | ); |
---|
138 | |
---|
139 | virtual unsigned int transcodeTo |
---|
140 | ( |
---|
141 | const XMLCh* const srcData |
---|
142 | , const unsigned int srcCount |
---|
143 | , XMLByte* const toFill |
---|
144 | , const unsigned int maxBytes |
---|
145 | , unsigned int& charsEaten |
---|
146 | , const UnRepOpts options |
---|
147 | ); |
---|
148 | |
---|
149 | virtual bool canTranscodeTo |
---|
150 | ( |
---|
151 | const unsigned int toCheck |
---|
152 | ) const; |
---|
153 | |
---|
154 | |
---|
155 | |
---|
156 | private : |
---|
157 | // ----------------------------------------------------------------------- |
---|
158 | // Unimplemented constructors and operators |
---|
159 | // ----------------------------------------------------------------------- |
---|
160 | Iconv400Transcoder(); |
---|
161 | Iconv400Transcoder(const Iconv400Transcoder&); |
---|
162 | Iconv400Transcoder& operator=(const Iconv400Transcoder&); |
---|
163 | |
---|
164 | |
---|
165 | // ----------------------------------------------------------------------- |
---|
166 | // Private data members |
---|
167 | // |
---|
168 | // fConverter |
---|
169 | // This is a pointer to the Iconv400 converter that this transcoder |
---|
170 | // uses. |
---|
171 | // |
---|
172 | // fFixed |
---|
173 | // This is set to true if the encoding is a fixed size one. This |
---|
174 | // can be used to optimize some operations. |
---|
175 | // |
---|
176 | // fSrcOffsets |
---|
177 | // This is an array of longs, which are allocated to the size of |
---|
178 | // the trancoding block (if any) indicated in the ctor. It is used |
---|
179 | // to get the character offsets from Iconv400, which are then translated |
---|
180 | // into an array of char sizes for return. |
---|
181 | // ----------------------------------------------------------------------- |
---|
182 | UConverter* fConverter; |
---|
183 | bool fFixed; |
---|
184 | long* fSrcOffsets; |
---|
185 | |
---|
186 | }; |
---|
187 | |
---|
188 | |
---|
189 | class XMLUTIL_EXPORT Iconv400LCPTranscoder : public XMLLCPTranscoder |
---|
190 | { |
---|
191 | public : |
---|
192 | // ----------------------------------------------------------------------- |
---|
193 | // Constructors and Destructor |
---|
194 | // ----------------------------------------------------------------------- |
---|
195 | Iconv400LCPTranscoder(UConverter* const toAdopt); |
---|
196 | ~Iconv400LCPTranscoder(); |
---|
197 | |
---|
198 | |
---|
199 | // ----------------------------------------------------------------------- |
---|
200 | // Implementation of the virtual transcoder interface |
---|
201 | // ----------------------------------------------------------------------- |
---|
202 | virtual unsigned int calcRequiredSize(const char* const srcText |
---|
203 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); |
---|
204 | |
---|
205 | virtual unsigned int calcRequiredSize(const XMLCh* const srcText |
---|
206 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); |
---|
207 | |
---|
208 | virtual char* transcode(const XMLCh* const toTranscode); |
---|
209 | virtual char* transcode(const XMLCh* const toTranscode, |
---|
210 | MemoryManager* const manager); |
---|
211 | |
---|
212 | virtual XMLCh* transcode(const char* const toTranscode); |
---|
213 | virtual XMLCh* transcode(const char* const toTranscode, |
---|
214 | MemoryManager* const manager); |
---|
215 | |
---|
216 | virtual bool transcode |
---|
217 | ( |
---|
218 | const char* const toTranscode |
---|
219 | , XMLCh* const toFill |
---|
220 | , const unsigned int maxChars |
---|
221 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
---|
222 | ); |
---|
223 | |
---|
224 | virtual bool transcode |
---|
225 | ( |
---|
226 | const XMLCh* const toTranscode |
---|
227 | , char* const toFill |
---|
228 | , const unsigned int maxChars |
---|
229 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
---|
230 | ); |
---|
231 | |
---|
232 | |
---|
233 | |
---|
234 | private : |
---|
235 | // ----------------------------------------------------------------------- |
---|
236 | // Unimplemented constructors and operators |
---|
237 | // ----------------------------------------------------------------------- |
---|
238 | Iconv400LCPTranscoder(); |
---|
239 | Iconv400LCPTranscoder(const Iconv400LCPTranscoder&); |
---|
240 | Iconv400LCPTranscoder& operator=(const Iconv400LCPTranscoder&); |
---|
241 | |
---|
242 | |
---|
243 | // ----------------------------------------------------------------------- |
---|
244 | // Private data members |
---|
245 | // |
---|
246 | // fConverter |
---|
247 | // This is a pointer to the Iconv converter that this transcoder |
---|
248 | // uses. |
---|
249 | // |
---|
250 | // fMutex |
---|
251 | // We have to synchronize threaded calls to the converter. |
---|
252 | // ----------------------------------------------------------------------- |
---|
253 | UConverter* fConverter; |
---|
254 | XMLMutex fMutex; |
---|
255 | }; |
---|
256 | |
---|
257 | XERCES_CPP_NAMESPACE_END |
---|
258 | |
---|
259 | #endif |
---|
260 | #if (__OS400_TGTVRM__>=510) /* @01a */ |
---|
261 | #pragma datamodel(pop) /* @01a */ |
---|
262 | #endif /* @01a */ |
---|
263 | |
---|