Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:15:13

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  * 
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  * 
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 /*
0019  * $Id$
0020  */
0021 
0022 #if !defined(XERCESC_INCLUDE_GUARD_TRANSENAMEMAP_HPP)
0023 #define XERCESC_INCLUDE_GUARD_TRANSENAMEMAP_HPP
0024 
0025 #include <xercesc/util/TransService.hpp>
0026 #include <xercesc/util/XMLString.hpp>
0027 
0028 XERCES_CPP_NAMESPACE_BEGIN
0029 
0030 //
0031 //  This class is really private to the TransService class. However, some
0032 //  compilers are too dumb to allow us to hide this class there in the Cpp
0033 //  file that uses it.
0034 //
0035 class ENameMap : public XMemory
0036 {
0037 public :
0038     // -----------------------------------------------------------------------
0039     //  Destructor
0040     // -----------------------------------------------------------------------
0041     virtual ~ENameMap()
0042     {
0043         //delete [] fEncodingName;
0044         XMLPlatformUtils::fgMemoryManager->deallocate(fEncodingName);
0045     }
0046 
0047 
0048 
0049     // -----------------------------------------------------------------------
0050     //  Virtual factory method
0051     // -----------------------------------------------------------------------
0052     virtual XMLTranscoder* makeNew
0053     (
0054         const   XMLSize_t       blockSize
0055         , MemoryManager*  const manager = XMLPlatformUtils::fgMemoryManager
0056     )   const = 0;
0057 
0058 
0059     // -----------------------------------------------------------------------
0060     //  Getter methods
0061     // -----------------------------------------------------------------------
0062     const XMLCh* getKey() const
0063     {
0064         return fEncodingName;
0065     }
0066 
0067 
0068 protected :
0069     // -----------------------------------------------------------------------
0070     //  Hidden constructors
0071     // -----------------------------------------------------------------------
0072     ENameMap(const XMLCh* const encodingName) :
0073           fEncodingName(XMLString::replicate(encodingName, XMLPlatformUtils::fgMemoryManager))
0074     {
0075     }
0076 
0077 
0078 private :
0079     // -----------------------------------------------------------------------
0080     //  Unimplemented constructors and operators
0081     // -----------------------------------------------------------------------
0082     ENameMap();
0083     ENameMap(const ENameMap&);
0084     ENameMap& operator=(const ENameMap&);
0085 
0086 
0087     // -----------------------------------------------------------------------
0088     //  Private data members
0089     //
0090     //  fEncodingName
0091     //      This is the encoding name for the transcoder that is controlled
0092     //      by this map instance.
0093     // -----------------------------------------------------------------------
0094     XMLCh*  fEncodingName;
0095 };
0096 
0097 
0098 template <class TType> class ENameMapFor : public ENameMap
0099 {
0100 public :
0101     // -----------------------------------------------------------------------
0102     //  Constructors and Destructor
0103     // -----------------------------------------------------------------------
0104     ENameMapFor(const XMLCh* const encodingName);
0105     ~ENameMapFor();
0106 
0107 
0108     // -----------------------------------------------------------------------
0109     //  Implementation of virtual factory method
0110     // -----------------------------------------------------------------------
0111     virtual XMLTranscoder* makeNew(const XMLSize_t      blockSize,
0112                                    MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) const;
0113 
0114 
0115 private :
0116     // -----------------------------------------------------------------------
0117     //  Unimplemented constructors and operators
0118     // -----------------------------------------------------------------------
0119     ENameMapFor();
0120     ENameMapFor(const ENameMapFor<TType>&);
0121     ENameMapFor<TType>& operator=(const ENameMapFor<TType>&);
0122 };
0123 
0124 
0125 template <class TType> class EEndianNameMapFor : public ENameMap
0126 {
0127 public :
0128     // -----------------------------------------------------------------------
0129     //  Constructors and Destructor
0130     // -----------------------------------------------------------------------
0131     EEndianNameMapFor(const XMLCh* const encodingName, const bool swapped);
0132     ~EEndianNameMapFor();
0133 
0134 
0135     // -----------------------------------------------------------------------
0136     //  Implementation of virtual factory method
0137     // -----------------------------------------------------------------------
0138     virtual XMLTranscoder* makeNew(const XMLSize_t      blockSize,
0139                                    MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) const;
0140 
0141 
0142 private :
0143     // -----------------------------------------------------------------------
0144     //  Unimplemented constructors and operators
0145     // -----------------------------------------------------------------------
0146     EEndianNameMapFor(const EEndianNameMapFor<TType>&);
0147     EEndianNameMapFor<TType>& operator=(const EEndianNameMapFor<TType>&);
0148 
0149 
0150     // -----------------------------------------------------------------------
0151     //  Private data members
0152     //
0153     //  fSwapped
0154     //      Indicates whether the endianness of the encoding is opposite of
0155     //      that of the local host.
0156     // -----------------------------------------------------------------------
0157     bool    fSwapped;
0158 };
0159 
0160 XERCES_CPP_NAMESPACE_END
0161 
0162 #if !defined(XERCES_TMPLSINC)
0163 #include <xercesc/util/TransENameMap.c>
0164 #endif
0165 
0166 #endif