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

Revision 2674, 8.2 KB checked in by mattausch, 16 years ago (diff)
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 * $Id: Uniconv390TransService.hpp 568078 2007-08-21 11:43:25Z amassari $
20 */
21
22#ifndef UNICONV390TRANSSERVICE_HPP
23#define UNICONV390TRANSSERVICE_HPP
24
25#include <xercesc/util/Mutexes.hpp>
26#include <xercesc/util/TransService.hpp>
27#include <xercesc/util/Transcoders/ICU/ICUTransService.hpp>
28#include "uniconv.h"
29
30XERCES_CPP_NAMESPACE_BEGIN
31
32typedef struct uniconvconverter {
33   XMLMutex               fMutex;
34   uniconv_t                fIconv390DescriptorFrom;
35   uniconv_t                fIconv390DescriptorTo;
36} uniconvconverter_t;
37
38typedef struct uniconvcaseconverter {
39   XMLMutex  fcaseMutex;
40   uniconv_t ftoupperhand;
41   uniconv_t ftolowerhand;
42} uniconvcaseconverter_t;
43
44class XMLUTIL_EXPORT Uniconv390TransService : public XMLTransService
45{
46public :
47    // -----------------------------------------------------------------------
48    //  Constructors and Destructor
49    // -----------------------------------------------------------------------
50    Uniconv390TransService();
51    ~Uniconv390TransService();
52
53
54    // -----------------------------------------------------------------------
55    //  Implementation of the virtual transcoding service API
56    // -----------------------------------------------------------------------
57    virtual int compareIString
58    (
59        const   XMLCh* const    comp1
60        , const XMLCh* const    comp2
61    );
62
63    virtual int compareNIString
64    (
65        const   XMLCh* const    comp1
66        , const XMLCh* const    comp2
67        , const unsigned int    maxChars
68    );
69
70    virtual const XMLCh* getId() const;
71
72    virtual bool isSpace(const XMLCh toCheck) const;
73
74    virtual XMLLCPTranscoder* makeNewLCPTranscoder();
75
76    virtual bool supportsSrcOfs() const;
77
78    virtual void upperCase(XMLCh* const toUpperCase) const;
79    virtual void lowerCase(XMLCh* const toLowerCase) const;
80
81protected :
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    virtual void initTransService();
94
95private :
96    // -----------------------------------------------------------------------
97    //  Unimplemented constructors and operators
98    // -----------------------------------------------------------------------
99    Uniconv390TransService(const Uniconv390TransService&);
100    Uniconv390TransService& operator=(const Uniconv390TransService&);
101    ICUTransService * fICUService;
102    XMLLCPTranscoder* fLCPTranscoder;
103    uniconvcaseconverter_t *fCaseConverter;
104};
105
106
107
108class XMLUTIL_EXPORT Uniconv390Transcoder : public XMLTranscoder
109{
110public :
111    // -----------------------------------------------------------------------
112    //  Constructors and Destructor
113    // -----------------------------------------------------------------------
114    Uniconv390Transcoder
115    (
116        const   XMLCh* const        encodingName
117        ,        uniconvconverter_t* const   toAdopt
118        , const unsigned int        blockSize
119        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
120    );
121    ~Uniconv390Transcoder();
122
123
124    // -----------------------------------------------------------------------
125    //  Implementation of the virtual transcoder interface
126    // -----------------------------------------------------------------------
127    virtual unsigned int transcodeFrom
128    (
129        const   XMLByte* const          srcData
130        , const unsigned int            srcCount
131        ,       XMLCh* const            toFill
132        , const unsigned int            maxChars
133        ,       unsigned int&           bytesEaten
134        ,       unsigned char* const    charSizes
135    );
136
137    virtual unsigned int transcodeTo
138    (
139        const   XMLCh* const    srcData
140        , const unsigned int    srcCount
141        ,       XMLByte* const  toFill
142        , const unsigned int    maxBytes
143        ,       unsigned int&   charsEaten
144        , const UnRepOpts       options
145    );
146
147    virtual bool canTranscodeTo
148    (
149        const   unsigned int    toCheck
150    )   const;
151
152
153
154private :
155    // -----------------------------------------------------------------------
156    //  Unimplemented constructors and operators
157    // -----------------------------------------------------------------------
158    Uniconv390Transcoder();
159    Uniconv390Transcoder(const Uniconv390Transcoder&);
160    Uniconv390Transcoder& operator=(const Uniconv390Transcoder&);
161
162    ICUTranscoder * fICUTranscoder;
163
164    // -----------------------------------------------------------------------
165    //  Private data members
166    //
167    //  fConverter
168    //      This is a pointer to the converter structure that this transcoder
169    //      uses.
170    //
171    // -----------------------------------------------------------------------
172    uniconvconverter_t *fConverter;
173};
174
175
176class XMLUTIL_EXPORT Uniconv390LCPTranscoder : public XMLLCPTranscoder
177{
178public :
179    // -----------------------------------------------------------------------
180    //  Constructors and Destructor
181    // -----------------------------------------------------------------------
182    Uniconv390LCPTranscoder( uniconvconverter_t* const toAdopt);
183    ~Uniconv390LCPTranscoder();
184
185
186    // -----------------------------------------------------------------------
187    //  Implementation of the virtual transcoder interface
188    // -----------------------------------------------------------------------
189    virtual unsigned int calcRequiredSize(const char* const srcText
190        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
191
192    virtual unsigned int calcRequiredSize(const XMLCh* const srcText
193        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
194
195    virtual char* transcode(const XMLCh* const toTranscode);
196    virtual char* transcode(const XMLCh* const toTranscode,
197                            MemoryManager* const manager);
198
199    virtual XMLCh* transcode(const char* const toTranscode);
200    virtual XMLCh* transcode(const char* const toTranscode,
201                             MemoryManager* const manager);
202
203    virtual bool transcode
204    (
205        const   char* const     toTranscode
206        ,       XMLCh* const    toFill
207        , const unsigned int    maxChars
208        , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
209    );
210
211    virtual bool transcode
212    (
213        const   XMLCh* const    toTranscode
214        ,       char* const     toFill
215        , const unsigned int    maxChars
216        , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
217    );
218
219
220
221private :
222    // -----------------------------------------------------------------------
223    //  Unimplemented constructors and operators
224    // -----------------------------------------------------------------------
225    Uniconv390LCPTranscoder();
226    Uniconv390LCPTranscoder(const Uniconv390LCPTranscoder&);
227    Uniconv390LCPTranscoder& operator=(const Uniconv390LCPTranscoder&);
228
229    ICULCPTranscoder * fICULCPTranscoder;
230
231    // -----------------------------------------------------------------------
232    //  Private data members
233    //
234    //  fConverter
235    //      This is a pointer to the converter structure that this transcoder
236    //      uses.
237    // -----------------------------------------------------------------------
238    uniconvconverter_t *fConverter;
239};
240
241XERCES_CPP_NAMESPACE_END
242
243#endif
Note: See TracBrowser for help on using the repository browser.