Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

XalanTranscodingServices.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 1999-2004 The Apache Software Foundation.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #if !defined(XALANTRANSCODINGSERVICES_HEADER_GUARD_1357924680)
00017 #define XALANTRANSCODINGSERVICES_HEADER_GUARD_1357924680
00018 
00019 
00020 
00021 // Base include file.  Must be first.
00022 #include <xalanc/PlatformSupport/PlatformSupportDefinitions.hpp>
00023 
00024 
00025 
00026 #include <cassert>
00027 
00028 
00029 
00030 #include <xalanc/PlatformSupport/DOMStringHelper.hpp>
00031 #include <xalanc/PlatformSupport/XSLException.hpp>
00032 
00033 
00034 
00035 XALAN_CPP_NAMESPACE_BEGIN
00036 
00037 
00038 
00039 class XalanOutputTranscoder;
00040 
00041 
00042 
00043 class XALAN_PLATFORMSUPPORT_EXPORT XalanTranscodingServices
00044 {
00045 public:
00046 
00050     static void
00051     initialize(MemoryManagerType&      theManager);
00052  
00056     static void
00057     terminate();
00058 
00059     typedef unsigned char   XalanXMLByte;
00060     typedef unsigned int    size_type;
00061     typedef unsigned int    UnicodeCharType;
00062 
00063     static size_type
00064     length(const XalanXMLByte*  theBytes)
00065     {
00066         assert(theBytes != 0);
00067 
00068         size_type   i = 0;
00069 
00070         while(theBytes[i] != 0)
00071         {
00072             ++i;
00073         }
00074 
00075         return i;
00076     }
00077 
00078     enum eCode
00079     {
00080         OK,
00081         UnsupportedEncoding,
00082         InternalFailure,
00083         SupportFilesNotFound
00084     };
00085 
00086 
00096     static XalanOutputTranscoder*
00097     makeNewTranscoder(
00098             MemoryManagerType&      theManager,
00099             const XalanDOMString&   theEncodingName,
00100             eCode&                  theResult,
00101             size_type               theBlockSize);
00102 
00108     static void
00109     destroyTranscoder(XalanOutputTranscoder*    theTranscoder);
00110 
00117     static bool
00118     encodingIsUTF8(const XalanDOMChar*      theEncodingName);
00119 
00126     static bool
00127     encodingIsUTF8(const XalanDOMString&    theEncodingName);
00128 
00135     static bool
00136     encodingIsUTF16(const XalanDOMChar*     theEncodingName);
00137 
00144     static bool
00145     encodingIsUTF16(const XalanDOMString&   theEncodingName);
00146 
00153     static bool
00154     encodingIsUTF32(const XalanDOMChar*     theEncodingName);
00155 
00162     static bool
00163     encodingIsUTF32(const XalanDOMString&   theEncodingName);
00175     static const XalanXMLByte*
00176     getStreamProlog(const XalanDOMString&   theEncodingName);
00177 
00184     static XalanDOMChar
00185     getMaximumCharacterValue(const XalanDOMString&  theEncoding);
00186 
00195     static XalanDOMChar
00196     getMaximumCharacterValue();
00197 
00205     static bool
00206     getBytesEqualChars(const XalanDOMString&    theEncoding);
00207 
00208     static bool
00209     canTranscodeToLocalCodePage(UnicodeCharType     theChar)
00210     {
00211         // Yuck!! See getMaximumCharacterValue() for more details.
00212         return theChar <= 0x7fu ? true : false;
00213     }
00214 
00215     static const XalanDOMChar   s_utf8String[];
00216 
00217     static const XalanDOMChar   s_utf16String[];
00218 
00219     static const XalanDOMChar   s_utf16LEString[];
00220 
00221     static const XalanDOMChar   s_utf16BEString[];
00222 
00223     static const XalanDOMChar   s_utf32String[];
00224 
00225     static const XalanDOMChar   s_asciiString[];
00226 
00227     static const XalanDOMChar   s_usASCIIString[];
00228 
00229     static const XalanDOMChar   s_windows1250String[];
00230 
00231     static const XalanDOMChar   s_iso88591String[];
00232 
00233     static const XalanDOMChar   s_shiftJISString[];
00234 
00235 
00236     class XALAN_PLATFORMSUPPORT_EXPORT UnrepresentableCharacterException : public XSLException
00237     {
00238     public:
00239 
00240         UnrepresentableCharacterException(
00241             UnicodeCharType         theCharacter,
00242             const XalanDOMString&   theEncoding,
00243             XalanDOMString&         theBuffer);
00244 
00245         virtual
00246         ~UnrepresentableCharacterException();
00247 
00248         UnicodeCharType
00249         getCharacter() const
00250         {
00251             return m_badCharacter;
00252         }
00253 
00254         const XalanDOMString&
00255         getEncoding() const
00256         {
00257             return m_encoding;
00258         }
00259 
00260         virtual const XalanDOMChar*
00261         getType() const
00262         {
00263             return m_type;
00264         }
00265 
00266     private:
00267         // not implemented
00268         UnrepresentableCharacterException(const UnrepresentableCharacterException&);
00269 
00270         static const XalanDOMChar   m_type[];
00271 
00272 
00273         const UnicodeCharType   m_badCharacter;
00274 
00275         const XalanDOMString    m_encoding;
00276     };
00277 
00278 private:
00279 
00280     static const XalanXMLByte   s_dummyByteOrderMark[];
00281     static const XalanXMLByte   s_UTF8ByteOrderMark[];
00282     static const XalanDOMChar   s_UTF16ByteOrderMark[];
00283 };
00284 
00285 
00286 
00287 class XALAN_PLATFORMSUPPORT_EXPORT XalanOutputTranscoder
00288 {
00289 public:
00290 
00291     typedef XalanTranscodingServices::XalanXMLByte      XalanXMLByte;
00292     typedef XalanTranscodingServices::eCode             eCode;
00293     typedef XalanTranscodingServices::size_type         size_type;
00294     typedef XalanTranscodingServices::UnicodeCharType   UnicodeCharType;
00295 
00296     explicit
00297     XalanOutputTranscoder(MemoryManagerType& theManager);
00298 
00299     virtual
00300     ~XalanOutputTranscoder();
00301 
00302     MemoryManagerType&
00303     getMemoryManager()
00304     {
00305         return m_memoryManager;
00306     }
00307 
00321     virtual eCode
00322     transcode(
00323             const XalanDOMChar*     theSourceData,
00324             size_type               theSourceCount,
00325             XalanXMLByte*           theTarget,
00326             size_type               theTargetSize,
00327             size_type&              theSourceCharsTranscoded,
00328             size_type&              theTargetBytesUsed) = 0;
00329 
00344     virtual eCode
00345     transcode(
00346             const XalanXMLByte*     theSourceData,
00347             size_type               theSourceCount,
00348             XalanDOMChar*           theTarget,
00349             size_type               theTargetSize,
00350             size_type&              theSourceCharsTranscoded,
00351             size_type&              theTargetBytesUsed,
00352             unsigned char*          theCharSizes) = 0;
00353 
00354     virtual bool
00355     canTranscodeTo(UnicodeCharType  theChar) const = 0;
00356 
00357 private:
00358 
00359     MemoryManagerType&              m_memoryManager;
00360     // Not implemented...
00361     XalanOutputTranscoder(const XalanOutputTranscoder&  theSource);
00362 
00363     bool
00364     operator==(const XalanOutputTranscoder& theRHS) const;
00365 
00366     XalanOutputTranscoder&
00367     operator=(const XalanOutputTranscoder&  theRHS);
00368 };
00369 
00370 
00371 
00372 XALAN_CPP_NAMESPACE_END
00373 
00374 
00375 
00376 #endif  // XALANTRANSCODINGSERVICES_HEADER_GUARD_1357924680

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

dot

Xalan-C++ XSLT Processor Version 1.10
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.

Apache Logo