source: icXML/icXML-devel/src/xercesc/util/TransENameMap.hpp @ 2732

Last change on this file since 2732 was 2722, checked in by cameron, 7 years ago

Original Xerces files with import mods for icxercesc

File size: 5.8 KB
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: TransENameMap.hpp 932887 2010-04-11 13:04:59Z borisk $
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_TRANSENAMEMAP_HPP)
23#define XERCESC_INCLUDE_GUARD_TRANSENAMEMAP_HPP
24
25#include <icxercesc/util/TransService.hpp>
26#include <icxercesc/util/XMLString.hpp>
27
28XERCES_CPP_NAMESPACE_BEGIN
29
30//
31//  This class is really private to the TransService class. However, some
32//  compilers are too dumb to allow us to hide this class there in the Cpp
33//  file that uses it.
34//
35class ENameMap : public XMemory
36{
37public :
38    // -----------------------------------------------------------------------
39    //  Destructor
40    // -----------------------------------------------------------------------
41    virtual ~ENameMap()
42    {
43        //delete [] fEncodingName;
44        XMLPlatformUtils::fgMemoryManager->deallocate(fEncodingName);
45    }
46
47
48
49    // -----------------------------------------------------------------------
50    //  Virtual factory method
51    // -----------------------------------------------------------------------
52    virtual XMLTranscoder* makeNew
53    (
54        const   XMLSize_t       blockSize
55        , MemoryManager*  const manager = XMLPlatformUtils::fgMemoryManager
56    )   const = 0;
57
58
59    // -----------------------------------------------------------------------
60    //  Getter methods
61    // -----------------------------------------------------------------------
62    const XMLCh* getKey() const
63    {
64        return fEncodingName;
65    }
66
67
68protected :
69    // -----------------------------------------------------------------------
70    //  Hidden constructors
71    // -----------------------------------------------------------------------
72    ENameMap(const XMLCh* const encodingName) :
73          fEncodingName(XMLString::replicate(encodingName, XMLPlatformUtils::fgMemoryManager))
74    {
75    }
76
77
78private :
79    // -----------------------------------------------------------------------
80    //  Unimplemented constructors and operators
81    // -----------------------------------------------------------------------
82    ENameMap();
83    ENameMap(const ENameMap&);
84    ENameMap& operator=(const ENameMap&);
85
86
87    // -----------------------------------------------------------------------
88    //  Private data members
89    //
90    //  fEncodingName
91    //      This is the encoding name for the transcoder that is controlled
92    //      by this map instance.
93    // -----------------------------------------------------------------------
94    XMLCh*  fEncodingName;
95};
96
97
98template <class TType> class ENameMapFor : public ENameMap
99{
100public :
101    // -----------------------------------------------------------------------
102    //  Constructors and Destructor
103    // -----------------------------------------------------------------------
104    ENameMapFor(const XMLCh* const encodingName);
105    ~ENameMapFor();
106
107
108    // -----------------------------------------------------------------------
109    //  Implementation of virtual factory method
110    // -----------------------------------------------------------------------
111    virtual XMLTranscoder* makeNew(const XMLSize_t      blockSize,
112                                   MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) const;
113
114
115private :
116    // -----------------------------------------------------------------------
117    //  Unimplemented constructors and operators
118    // -----------------------------------------------------------------------
119    ENameMapFor();
120    ENameMapFor(const ENameMapFor<TType>&);
121    ENameMapFor<TType>& operator=(const ENameMapFor<TType>&);
122};
123
124
125template <class TType> class EEndianNameMapFor : public ENameMap
126{
127public :
128    // -----------------------------------------------------------------------
129    //  Constructors and Destructor
130    // -----------------------------------------------------------------------
131    EEndianNameMapFor(const XMLCh* const encodingName, const bool swapped);
132    ~EEndianNameMapFor();
133
134
135    // -----------------------------------------------------------------------
136    //  Implementation of virtual factory method
137    // -----------------------------------------------------------------------
138    virtual XMLTranscoder* makeNew(const XMLSize_t      blockSize,
139                                   MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) const;
140
141
142private :
143    // -----------------------------------------------------------------------
144    //  Unimplemented constructors and operators
145    // -----------------------------------------------------------------------
146    EEndianNameMapFor(const EEndianNameMapFor<TType>&);
147    EEndianNameMapFor<TType>& operator=(const EEndianNameMapFor<TType>&);
148
149
150    // -----------------------------------------------------------------------
151    //  Private data members
152    //
153    //  fSwapped
154    //      Indicates whether the endianness of the encoding is opposite of
155    //      that of the local host.
156    // -----------------------------------------------------------------------
157    bool    fSwapped;
158};
159
160XERCES_CPP_NAMESPACE_END
161
162#if !defined(XERCES_TMPLSINC)
163#include <xercesc/util/TransENameMap.c>
164#endif
165
166#endif
Note: See TracBrowser for help on using the repository browser.