source: NonGTP/Xerces/xercesc/util/Transcoders/Uniconv390/Uniconv390TransService.hpp @ 188

Revision 188, 10.4 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) 2002-2004 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 * $Id: Uniconv390TransService.hpp,v 1.6 2004/02/06 15:02:41 cargilld Exp $
59 */
60
61#ifndef UNICONV390TRANSSERVICE_HPP
62#define UNICONV390TRANSSERVICE_HPP
63
64#include <xercesc/util/Mutexes.hpp>
65#include <xercesc/util/TransService.hpp>
66#include <xercesc/util/Transcoders/ICU/ICUTransService.hpp>
67#include "uniconv.h"
68
69XERCES_CPP_NAMESPACE_BEGIN
70
71typedef struct uniconvconverter {
72   XMLMutex               fMutex;
73   uniconv_t                fIconv390DescriptorFrom;
74   uniconv_t                fIconv390DescriptorTo;
75} uniconvconverter_t;
76
77typedef struct uniconvcaseconverter {
78   XMLMutex  fcaseMutex;
79   uniconv_t ftoupperhand;
80   uniconv_t ftolowerhand;
81} uniconvcaseconverter_t;
82
83class XMLUTIL_EXPORT Uniconv390TransService : public XMLTransService
84{
85public :
86    // -----------------------------------------------------------------------
87    //  Constructors and Destructor
88    // -----------------------------------------------------------------------
89    Uniconv390TransService();
90    ~Uniconv390TransService();
91
92
93    // -----------------------------------------------------------------------
94    //  Implementation of the virtual transcoding service API
95    // -----------------------------------------------------------------------
96    virtual int compareIString
97    (
98        const   XMLCh* const    comp1
99        , const XMLCh* const    comp2
100    );
101
102    virtual int compareNIString
103    (
104        const   XMLCh* const    comp1
105        , const XMLCh* const    comp2
106        , const unsigned int    maxChars
107    );
108
109    virtual const XMLCh* getId() const;
110
111    virtual bool isSpace(const XMLCh toCheck) const;
112
113    virtual XMLLCPTranscoder* makeNewLCPTranscoder();
114
115    virtual bool supportsSrcOfs() const;
116
117    virtual void upperCase(XMLCh* const toUpperCase) const;
118    virtual void lowerCase(XMLCh* const toLowerCase) const;
119
120protected :
121    // -----------------------------------------------------------------------
122    //  Protected virtual methods
123    // -----------------------------------------------------------------------
124    virtual XMLTranscoder* makeNewXMLTranscoder
125    (
126        const   XMLCh* const            encodingName
127        ,       XMLTransService::Codes& resValue
128        , const unsigned int            blockSize
129        ,       MemoryManager* const    manager
130    );
131
132    virtual void initTransService();
133
134private :
135    // -----------------------------------------------------------------------
136    //  Unimplemented constructors and operators
137    // -----------------------------------------------------------------------
138    Uniconv390TransService(const Uniconv390TransService&);
139    Uniconv390TransService& operator=(const Uniconv390TransService&);
140    ICUTransService * fICUService;
141    XMLLCPTranscoder* fLCPTranscoder;
142    uniconvcaseconverter_t *fCaseConverter;
143};
144
145
146
147class XMLUTIL_EXPORT Uniconv390Transcoder : public XMLTranscoder
148{
149public :
150    // -----------------------------------------------------------------------
151    //  Constructors and Destructor
152    // -----------------------------------------------------------------------
153    Uniconv390Transcoder
154    (
155        const   XMLCh* const        encodingName
156        ,        uniconvconverter_t* const   toAdopt
157        , const unsigned int        blockSize
158        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
159    );
160    ~Uniconv390Transcoder();
161
162
163    // -----------------------------------------------------------------------
164    //  Implementation of the virtual transcoder interface
165    // -----------------------------------------------------------------------
166    virtual unsigned int transcodeFrom
167    (
168        const   XMLByte* const          srcData
169        , const unsigned int            srcCount
170        ,       XMLCh* const            toFill
171        , const unsigned int            maxChars
172        ,       unsigned int&           bytesEaten
173        ,       unsigned char* const    charSizes
174    );
175
176    virtual unsigned int transcodeTo
177    (
178        const   XMLCh* const    srcData
179        , const unsigned int    srcCount
180        ,       XMLByte* const  toFill
181        , const unsigned int    maxBytes
182        ,       unsigned int&   charsEaten
183        , const UnRepOpts       options
184    );
185
186    virtual bool canTranscodeTo
187    (
188        const   unsigned int    toCheck
189    )   const;
190
191
192
193private :
194    // -----------------------------------------------------------------------
195    //  Unimplemented constructors and operators
196    // -----------------------------------------------------------------------
197    Uniconv390Transcoder();
198    Uniconv390Transcoder(const Uniconv390Transcoder&);
199    Uniconv390Transcoder& operator=(const Uniconv390Transcoder&);
200
201    ICUTranscoder * fICUTranscoder;
202
203    // -----------------------------------------------------------------------
204    //  Private data members
205    //
206    //  fConverter
207    //      This is a pointer to the converter structure that this transcoder
208    //      uses.
209    //
210    // -----------------------------------------------------------------------
211    uniconvconverter_t *fConverter;
212};
213
214
215class XMLUTIL_EXPORT Uniconv390LCPTranscoder : public XMLLCPTranscoder
216{
217public :
218    // -----------------------------------------------------------------------
219    //  Constructors and Destructor
220    // -----------------------------------------------------------------------
221    Uniconv390LCPTranscoder( uniconvconverter_t* const toAdopt);
222    ~Uniconv390LCPTranscoder();
223
224
225    // -----------------------------------------------------------------------
226    //  Implementation of the virtual transcoder interface
227    // -----------------------------------------------------------------------
228    virtual unsigned int calcRequiredSize(const char* const srcText
229        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
230
231    virtual unsigned int calcRequiredSize(const XMLCh* const srcText
232        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
233
234    virtual char* transcode(const XMLCh* const toTranscode);
235    virtual char* transcode(const XMLCh* const toTranscode,
236                            MemoryManager* const manager);
237
238    virtual XMLCh* transcode(const char* const toTranscode);
239    virtual XMLCh* transcode(const char* const toTranscode,
240                             MemoryManager* const manager);
241
242    virtual bool transcode
243    (
244        const   char* const     toTranscode
245        ,       XMLCh* const    toFill
246        , const unsigned int    maxChars
247        , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
248    );
249
250    virtual bool transcode
251    (
252        const   XMLCh* const    toTranscode
253        ,       char* const     toFill
254        , const unsigned int    maxChars
255        , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
256    );
257
258
259
260private :
261    // -----------------------------------------------------------------------
262    //  Unimplemented constructors and operators
263    // -----------------------------------------------------------------------
264    Uniconv390LCPTranscoder();
265    Uniconv390LCPTranscoder(const Uniconv390LCPTranscoder&);
266    Uniconv390LCPTranscoder& operator=(const Uniconv390LCPTranscoder&);
267
268    ICULCPTranscoder * fICULCPTranscoder;
269
270    // -----------------------------------------------------------------------
271    //  Private data members
272    //
273    //  fConverter
274    //      This is a pointer to the converter structure that this transcoder
275    //      uses.
276    // -----------------------------------------------------------------------
277    uniconvconverter_t *fConverter;
278};
279
280XERCES_CPP_NAMESPACE_END
281
282#endif
Note: See TracBrowser for help on using the repository browser.