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

Revision 2674, 5.4 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: Iconv390TransService.hpp 568078 2007-08-21 11:43:25Z amassari $
20 */
21
22#ifndef ICONV390TRANSSERVICE_HPP
23#define ICONV390TRANSSERVICE_HPP
24
25#include <xercesc/util/TransService.hpp>
26#include <xercesc/util/Mutexes.hpp>
27#include <iconv.h>
28
29XERCES_CPP_NAMESPACE_BEGIN
30
31/* Max encoding name in characters. */
32#define UCNV_MAX_CONVERTER_NAME_LENGTH 60
33typedef struct iconvconverter {
34   struct iconvconverter *nextconverter;
35   char                   name [UCNV_MAX_CONVERTER_NAME_LENGTH];
36   XMLMutex               fMutex;
37   iconv_t                fIconv390Descriptor;
38   int                    usecount;
39} iconvconverter_t;
40
41class XMLUTIL_EXPORT Iconv390TransService : public XMLTransService
42{
43public :
44    // -----------------------------------------------------------------------
45    //  Constructors and Destructor
46    // -----------------------------------------------------------------------
47    Iconv390TransService();
48    ~Iconv390TransService();
49
50
51    // -----------------------------------------------------------------------
52    //  Implementation of the virtual transcoding service API
53    // -----------------------------------------------------------------------
54    virtual int compareIString
55    (
56        const   XMLCh* const    comp1
57        , const XMLCh* const    comp2
58    );
59
60    virtual int compareNIString
61    (
62        const   XMLCh* const    comp1
63        , const XMLCh* const    comp2
64        , const unsigned int    maxChars
65    );
66
67    virtual const XMLCh* getId() const;
68
69    virtual bool isSpace(const XMLCh toCheck) const;
70
71    virtual XMLLCPTranscoder* makeNewLCPTranscoder();
72
73    virtual bool supportsSrcOfs() const;
74
75    virtual void upperCase(XMLCh* const toUpperCase) const;
76    virtual void lowerCase(XMLCh* const toLowerCase) const;
77
78protected :
79    // -----------------------------------------------------------------------
80    //  Protected virtual methods
81    // -----------------------------------------------------------------------
82    virtual XMLTranscoder* makeNewXMLTranscoder
83    (
84        const   XMLCh* const            encodingName
85        ,       XMLTransService::Codes& resValue
86        , const unsigned int            blockSize
87        ,       MemoryManager* const    manager
88    );
89
90
91private :
92    // -----------------------------------------------------------------------
93    //  Unimplemented constructors and operators
94    // -----------------------------------------------------------------------
95    Iconv390TransService(const Iconv390TransService&);
96    Iconv390TransService& operator=(const Iconv390TransService&);
97};
98
99class XMLUTIL_EXPORT Iconv390LCPTranscoder : public XMLLCPTranscoder
100{
101public :
102    // -----------------------------------------------------------------------
103    //  Constructors and Destructor
104    // -----------------------------------------------------------------------
105    Iconv390LCPTranscoder();
106    Iconv390LCPTranscoder(iconvconverter_t* const toAdopt);
107    ~Iconv390LCPTranscoder();
108
109    // -----------------------------------------------------------------------
110    //  Implementation of the virtual transcoder interface
111    // -----------------------------------------------------------------------
112    virtual unsigned int calcRequiredSize(const char* const srcText
113        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
114
115    virtual unsigned int calcRequiredSize(const XMLCh* const srcText
116        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
117
118    virtual char* transcode(const XMLCh* const toTranscode);
119    virtual char* transcode(const XMLCh* const toTranscode,
120                            MemoryManager* const manager);
121
122    virtual bool transcode
123    (
124        const   XMLCh* const    toTranscode
125        ,       char* const     toFill
126        , const unsigned int    maxBytes
127        , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
128    );
129
130    virtual XMLCh* transcode(const char* const toTranscode);
131    virtual XMLCh* transcode(const char* const toTranscode,
132                             MemoryManager* const manager);
133
134    virtual bool transcode
135    (
136        const   char* const     toTranscode
137        ,       XMLCh* const    toFill
138        , const unsigned int    maxChars
139        , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
140    );
141
142
143private :
144    // -----------------------------------------------------------------------
145    //  Unimplemented constructors and operators
146    // -----------------------------------------------------------------------
147    Iconv390LCPTranscoder(const Iconv390LCPTranscoder&);
148    Iconv390LCPTranscoder& operator=(const Iconv390LCPTranscoder&);
149    iconvconverter_t *converter;
150};
151
152XERCES_CPP_NAMESPACE_END
153
154#endif
Note: See TracBrowser for help on using the repository browser.