[188] | 1 | /*
|
---|
| 2 | * The Apache Software License, Version 1.1
|
---|
| 3 | *
|
---|
| 4 | * Copyright (c) 1999-2000 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 | * $Log: IconvTransService.hpp,v $
|
---|
| 59 | * Revision 1.7 2003/12/24 15:24:15 cargilld
|
---|
| 60 | * More updates to memory management so that the static memory manager.
|
---|
| 61 | *
|
---|
| 62 | * Revision 1.6 2003/05/15 18:47:03 knoaman
|
---|
| 63 | * Partial implementation of the configurable memory manager.
|
---|
| 64 | *
|
---|
| 65 | * Revision 1.5 2003/03/07 18:15:57 tng
|
---|
| 66 | * Return a reference instead of void for operator=
|
---|
| 67 | *
|
---|
| 68 | * Revision 1.4 2003/01/06 21:48:05 tng
|
---|
| 69 | * Remove obsolete old functions transcodeXML and transcodeOne
|
---|
| 70 | *
|
---|
| 71 | * Revision 1.3 2002/11/04 15:14:33 tng
|
---|
| 72 | * C++ Namespace Support.
|
---|
| 73 | *
|
---|
| 74 | * Revision 1.2 2002/04/09 15:44:00 knoaman
|
---|
| 75 | * Add lower case string support.
|
---|
| 76 | *
|
---|
| 77 | * Revision 1.1.1.1 2002/02/01 22:22:36 peiyongz
|
---|
| 78 | * sane_include
|
---|
| 79 | *
|
---|
| 80 | * Revision 1.8 2000/03/02 19:55:35 roddey
|
---|
| 81 | * This checkin includes many changes done while waiting for the
|
---|
| 82 | * 1.1.0 code to be finished. I can't list them all here, but a list is
|
---|
| 83 | * available elsewhere.
|
---|
| 84 | *
|
---|
| 85 | * Revision 1.7 2000/02/06 07:48:33 rahulj
|
---|
| 86 | * Year 2K copyright swat.
|
---|
| 87 | *
|
---|
| 88 | * Revision 1.6 2000/01/25 22:49:57 roddey
|
---|
| 89 | * Moved the supportsSrcOfs() method from the individual transcoder to the
|
---|
| 90 | * transcoding service, where it should have been to begin with.
|
---|
| 91 | *
|
---|
| 92 | * Revision 1.5 2000/01/25 19:19:08 roddey
|
---|
| 93 | * Simple addition of a getId() method to the xcode and netacess abstractions to
|
---|
| 94 | * allow each impl to give back an id string.
|
---|
| 95 | *
|
---|
| 96 | * Revision 1.4 2000/01/06 01:21:34 aruna1
|
---|
| 97 | * Transcoding services modified.
|
---|
| 98 | *
|
---|
| 99 | * Revision 1.3 2000/01/05 23:30:38 abagchi
|
---|
| 100 | * Fixed the new class IconvLCPTranscoder functions. Tested on Linux only.
|
---|
| 101 | *
|
---|
| 102 | * Revision 1.2 1999/12/18 00:22:32 roddey
|
---|
| 103 | * Changes to support the new, completely orthagonal, transcoder architecture.
|
---|
| 104 | *
|
---|
| 105 | * Revision 1.1.1.1 1999/11/09 01:06:10 twl
|
---|
| 106 | * Initial checkin
|
---|
| 107 | *
|
---|
| 108 | * Revision 1.2 1999/11/08 20:45:34 rahul
|
---|
| 109 | * Swat for adding in Product name and CVS comment log variable.
|
---|
| 110 | *
|
---|
| 111 | */
|
---|
| 112 |
|
---|
| 113 | #ifndef ICONVTRANSSERVICE_HPP
|
---|
| 114 | #define ICONVTRANSSERVICE_HPP
|
---|
| 115 |
|
---|
| 116 | #include <xercesc/util/TransService.hpp>
|
---|
| 117 |
|
---|
| 118 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
| 119 |
|
---|
| 120 | class XMLUTIL_EXPORT IconvTransService : public XMLTransService
|
---|
| 121 | {
|
---|
| 122 | public :
|
---|
| 123 | // -----------------------------------------------------------------------
|
---|
| 124 | // Constructors and Destructor
|
---|
| 125 | // -----------------------------------------------------------------------
|
---|
| 126 | IconvTransService();
|
---|
| 127 | ~IconvTransService();
|
---|
| 128 |
|
---|
| 129 |
|
---|
| 130 | // -----------------------------------------------------------------------
|
---|
| 131 | // Implementation of the virtual transcoding service API
|
---|
| 132 | // -----------------------------------------------------------------------
|
---|
| 133 | virtual int compareIString
|
---|
| 134 | (
|
---|
| 135 | const XMLCh* const comp1
|
---|
| 136 | , const XMLCh* const comp2
|
---|
| 137 | );
|
---|
| 138 |
|
---|
| 139 | virtual int compareNIString
|
---|
| 140 | (
|
---|
| 141 | const XMLCh* const comp1
|
---|
| 142 | , const XMLCh* const comp2
|
---|
| 143 | , const unsigned int maxChars
|
---|
| 144 | );
|
---|
| 145 |
|
---|
| 146 | virtual const XMLCh* getId() const;
|
---|
| 147 |
|
---|
| 148 | virtual bool isSpace(const XMLCh toCheck) const;
|
---|
| 149 |
|
---|
| 150 | virtual XMLLCPTranscoder* makeNewLCPTranscoder();
|
---|
| 151 |
|
---|
| 152 | virtual bool supportsSrcOfs() const;
|
---|
| 153 |
|
---|
| 154 | virtual void upperCase(XMLCh* const toUpperCase) const;
|
---|
| 155 | virtual void lowerCase(XMLCh* const toLowerCase) const;
|
---|
| 156 |
|
---|
| 157 | protected :
|
---|
| 158 | // -----------------------------------------------------------------------
|
---|
| 159 | // Protected virtual methods
|
---|
| 160 | // -----------------------------------------------------------------------
|
---|
| 161 | virtual XMLTranscoder* makeNewXMLTranscoder
|
---|
| 162 | (
|
---|
| 163 | const XMLCh* const encodingName
|
---|
| 164 | , XMLTransService::Codes& resValue
|
---|
| 165 | , const unsigned int blockSize
|
---|
| 166 | , MemoryManager* const manager
|
---|
| 167 | );
|
---|
| 168 |
|
---|
| 169 |
|
---|
| 170 | private :
|
---|
| 171 | // -----------------------------------------------------------------------
|
---|
| 172 | // Unimplemented constructors and operators
|
---|
| 173 | // -----------------------------------------------------------------------
|
---|
| 174 | IconvTransService(const IconvTransService&);
|
---|
| 175 | IconvTransService& operator=(const IconvTransService&);
|
---|
| 176 | };
|
---|
| 177 |
|
---|
| 178 |
|
---|
| 179 | class XMLUTIL_EXPORT IconvLCPTranscoder : public XMLLCPTranscoder
|
---|
| 180 | {
|
---|
| 181 | public :
|
---|
| 182 | // -----------------------------------------------------------------------
|
---|
| 183 | // Constructors and Destructor
|
---|
| 184 | // -----------------------------------------------------------------------
|
---|
| 185 | IconvLCPTranscoder();
|
---|
| 186 | ~IconvLCPTranscoder();
|
---|
| 187 |
|
---|
| 188 |
|
---|
| 189 | // -----------------------------------------------------------------------
|
---|
| 190 | // Implementation of the virtual transcoder interface
|
---|
| 191 | // -----------------------------------------------------------------------
|
---|
| 192 | virtual unsigned int calcRequiredSize(const char* const srcText
|
---|
| 193 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
---|
| 194 |
|
---|
| 195 | virtual unsigned int calcRequiredSize(const XMLCh* const srcText
|
---|
| 196 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
---|
| 197 |
|
---|
| 198 | virtual char* transcode(const XMLCh* const toTranscode);
|
---|
| 199 | virtual char* transcode(const XMLCh* const toTranscode,
|
---|
| 200 | MemoryManager* const manager);
|
---|
| 201 |
|
---|
| 202 | virtual bool transcode
|
---|
| 203 | (
|
---|
| 204 | const XMLCh* const toTranscode
|
---|
| 205 | , char* const toFill
|
---|
| 206 | , const unsigned int maxBytes
|
---|
| 207 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
| 208 | );
|
---|
| 209 |
|
---|
| 210 | virtual XMLCh* transcode(const char* const toTranscode);
|
---|
| 211 | virtual XMLCh* transcode(const char* const toTranscode,
|
---|
| 212 | MemoryManager* const manager);
|
---|
| 213 |
|
---|
| 214 | virtual bool transcode
|
---|
| 215 | (
|
---|
| 216 | const char* const toTranscode
|
---|
| 217 | , XMLCh* const toFill
|
---|
| 218 | , const unsigned int maxChars
|
---|
| 219 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
| 220 | );
|
---|
| 221 |
|
---|
| 222 |
|
---|
| 223 | private :
|
---|
| 224 | // -----------------------------------------------------------------------
|
---|
| 225 | // Unimplemented constructors and operators
|
---|
| 226 | // -----------------------------------------------------------------------
|
---|
| 227 | IconvLCPTranscoder(const IconvLCPTranscoder&);
|
---|
| 228 | IconvLCPTranscoder& operator=(const IconvLCPTranscoder&);
|
---|
| 229 | };
|
---|
| 230 |
|
---|
| 231 | XERCES_CPP_NAMESPACE_END
|
---|
| 232 |
|
---|
| 233 | #endif
|
---|