## Xalan-C++ API Documentation

### The Xalan C++ XSLT Processor Version 1.9

Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

# FormatterToXML_UTF16.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(FORMATTERTOXML_UTF16_HEADER_GUARD_1357924680)
    00017 #define FORMATTERTOXML_UTF16_HEADER_GUARD_1357924680
    00018
    00019
    00020
    00021
    00022 // Base include file.  Must be first.
    00023 #include <xalanc/XMLSupport/XMLSupportDefinitions.hpp>
    00024
    00025
    00026
    00027 #include <xalanc/XalanDOM/XalanDOMString.hpp>
    00028
    00029
    00030
    00031 // Base class header file.
    00032 #include "FormatterToXMLBase.hpp"
    00033
    00034
    00035
    00036 XALAN_CPP_NAMESPACE_BEGIN
    00037
    00038
    00039
    00043 class XALAN_XMLSUPPORT_EXPORT FormatterToXML_UTF16 : public FormatterToXMLBase
    00044 {
    00045 public:
    00046
    00047
    00048
    00052     static void
    00053     initialize(MemoryManagerType& theManager);
    00054
    00058     static void
    00059     terminate();
    00060
    00076     FormatterToXML_UTF16(
    00077             Writer&                 writer,
    00078             const XalanDOMString&   version = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
    00079             const XalanDOMString&   mediaType = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
    00080             const XalanDOMString&   doctypeSystem = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
    00081             const XalanDOMString&   doctypePublic = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
    00082             bool                    xmlDecl = true,
    00083             const XalanDOMString&   standalone = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
    00084             MemoryManagerType&      theManager XALAN_DEFAULT_MEMMGR);
    00085
    00086     static FormatterToXML_UTF16*
    00087     create(
    00088             MemoryManagerType&      theManager,
    00089             Writer&                 writer,
    00090             const XalanDOMString&   version = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
    00091             const XalanDOMString&   mediaType = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
    00092             const XalanDOMString&   doctypeSystem = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
    00093             const XalanDOMString&   doctypePublic = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
    00094             bool                    xmlDecl = true,
    00095             const XalanDOMString&   standalone = XalanDOMString(XalanMemMgrs::getDummyMemMgr()));
    00096
    00097     virtual
    00098     ~FormatterToXML_UTF16();
    00099
    00100
    00101     // These methods are inherited from FormatterListener ...
    00102
    00103     virtual void
    00104     startElement(
    00105             const XMLCh* const  name,
    00106             AttributeListType&  attrs);
    00107
    00108     virtual void
    00109     endElement(const XMLCh* const   name);
    00110
    00111     virtual void
    00112     charactersRaw(
    00113             const XMLCh* const  chars,
    00114             const unsigned int  length);
    00115
    00116     virtual void
    00117     entityReference(const XMLCh* const  name);
    00118
    00119     virtual void
    00120     comment(const XMLCh* const  data);
    00121
    00122     virtual const XalanDOMString&
    00123     getEncoding() const;
    00124
    00125 protected:
    00126
    00127     virtual void
    00128     writeXMLHeader();
    00129
    00130     virtual void
    00131     flushBuffer();
    00132
    00133     virtual void
    00134     writeDoctypeDecl(const XalanDOMChar*    name);
    00135
    00136     virtual void
    00137     writeProcessingInstruction(
    00138             const XMLCh*    target,
    00139             const XMLCh*    data);
    00140
    00141     virtual void
    00142     writeCharacters(
    00143             const XMLCh*    chars,
    00144             unsigned int    length);
    00145
    00146     virtual void
    00147     writeCDATA(
    00148             const XMLCh*    chars,
    00149             unsigned int    length);
    00150
    00151     virtual void
    00152     outputNewline();
    00153
    00157     void
    00158     writeDefaultEscape(XalanDOMChar     ch);
    00159
    00163     void
    00164     writeDefaultAttributeEscape(XalanDOMChar    ch);
    00165
    00170     bool
    00171     writeDefaultEntity(XalanDOMChar     ch);
    00172
    00177     bool
    00178     writeDefaultAttributeEntity(XalanDOMChar    ch);
    00179
    00184     void
    00185     writeCommentData(const XalanDOMChar*    data);
    00186
    00191     void
    00192     writeParentTagEnd();
    00193
    00198     void
    00199     writeNormalizedChar(XalanDOMChar    ch);
    00200
    00207     void
    00208     writeCDATAChars(
    00209             const XalanDOMChar          ch[],
    00210             XalanDOMString::size_type   length);
    00211
    00218     void
    00219     writeAttrString(
    00220             const XalanDOMChar*         theString,
    00221             XalanDOMString::size_type   theStringLength);
    00222
    00223 private:
    00224
    00225     // These are not implemented.
    00226     FormatterToXML_UTF16(const FormatterToXML_UTF16&);
    00227
    00228     FormatterToXML_UTF16&
    00229     operator=(const FormatterToXML_UTF16&);
    00230
    00231     bool
    00232     operator==(const FormatterToXML_UTF16&) const;
    00233
    00234     void
    00235     write(
    00236             const XalanDOMChar*         theChars,
    00237             XalanDOMString::size_type   theLength);
    00238
    00239     void
    00240     writeName(const XalanDOMChar*   theChars);
    00241
    00242     void
    00243     write(const XalanDOMChar*   theChars)
    00244     {
    00245         write(theChars, XalanDOMString::length(theChars));
    00246     }
    00247
    00248     void
    00249     write(XalanDOMChar  theChar)
    00250     {
    00251         write(&theChar, 1);
    00252     }
    00253
    00254     void
    00255     write(const XalanDOMString&     theChars)
    00256     {
    00257         write(theChars.c_str(), theChars.length());
    00258     }
    00259
    00265     void
    00266     outputDocTypeDecl(const XalanDOMChar*   name);
    00267
    00273     void
    00274     processAttribute(
    00275             const XalanDOMChar*     name,
    00276             const XalanDOMChar*     value);
    00277
    00283     void
    00284     writeNormalizedPIData(
    00285             const XalanDOMChar*         theData,
    00286             XalanDOMString::size_type   theLength);
    00287
    00288     // Data members...
    00289
    00293     static const XalanDOMString&    s_utf16String;
    00294
    00298     static const XalanDOMChar               s_doctypeHeaderStartString[];
    00299
    00300     static const XalanDOMString::size_type  s_doctypeHeaderStartStringLength;
    00301
    00305     static const XalanDOMChar               s_doctypeHeaderPublicString[];
    00306
    00307     static const XalanDOMString::size_type  s_doctypeHeaderPublicStringLength;
    00308
    00312     static const XalanDOMChar               s_doctypeHeaderSystemString[];
    00313
    00314     static const XalanDOMString::size_type  s_doctypeHeaderSystemStringLength;
    00315
    00319     static const XalanDOMChar               s_xmlHeaderStartString[];
    00320
    00321     static const XalanDOMString::size_type  s_xmlHeaderStartStringLength;
    00322
    00326     static const XalanDOMChar               s_xmlHeaderEncodingString[];
    00327
    00328     static const XalanDOMString::size_type  s_xmlHeaderEncodingStringLength;
    00329
    00333     static const XalanDOMChar               s_xmlHeaderStandaloneString[];
    00334
    00335     static const XalanDOMString::size_type  s_xmlHeaderStandaloneStringLength;
    00336
    00340     static const XalanDOMChar               s_xmlHeaderEndString[];
    00341
    00342     static const XalanDOMString::size_type  s_xmlHeaderEndStringLength;
    00343
    00347     static const XalanDOMChar               s_defaultVersionString[];
    00348
    00349     static const XalanDOMString::size_type  s_defaultVersionStringLength;
    00350
    00354     static const XalanDOMChar               s_xhtmlDocTypeString[];
    00355
    00356     static const XalanDOMString::size_type  s_xhtmlDocTypeStringLength;
    00357
    00361     static const XalanDOMChar               s_cdataOpenString[];
    00362
    00363     static const XalanDOMString::size_type  s_cdataOpenStringLength;
    00364
    00368     static const XalanDOMChar               s_cdataCloseString[];
    00369
    00370     static const XalanDOMString::size_type  s_cdataCloseStringLength;
    00371
    00375     static const XalanDOMChar               s_lessThanEntityString[];
    00376
    00377     static const XalanDOMString::size_type  s_lessThanEntityStringLength;
    00378
    00382     static const XalanDOMChar               s_greaterThanEntityString[];
    00383
    00384     static const XalanDOMString::size_type  s_greaterThanEntityStringLength;
    00385
    00389     static const XalanDOMChar               s_ampersandEntityString[];
    00390
    00391     static const XalanDOMString::size_type  s_ampersandEntityStringLength;
    00392
    00396     static const XalanDOMChar               s_quoteEntityString[];
    00397
    00398     static const XalanDOMString::size_type  s_quoteEntityStringLength;
    00399
    00403     static const XalanDOMChar               s_linefeedNCRString[];
    00404
    00405     static const XalanDOMString::size_type  s_linefeedNCRStringLength;
    00406
    00410     static const XalanDOMChar               s_carriageReturnNCRString[];
    00411
    00412     static const XalanDOMString::size_type  s_carriageReturnNCRStringLength;
    00413
    00417     static const XalanDOMChar               s_htabNCRString[];
    00418
    00419     static const XalanDOMString::size_type  s_htabNCRStringLength;
    00420
    00421     enum
    00422     {
    00423         kBufferSize = 512       // The size of the buffer
    00424     };
    00425
    00426     static bool
    00427     isContentSpecial(XalanDOMChar   theChar)
    00428     {
    00429         if ((theChar < kSpecialsSize) && (s_specialChars[theChar] & kContentSpecial))
    00430         {
    00431             return true;
    00432         }
    00433         else
    00434         {
    00435             return false;
    00436         }
    00437     }
    00438
    00439     static bool
    00440     isAttributeSpecial(XalanDOMChar     theChar)
    00441     {
    00442         if ((theChar < kSpecialsSize) && (s_specialChars[theChar] & kAttributeSpecial))
    00443         {
    00444             return true;
    00445         }
    00446         else
    00447         {
    00448             return false;
    00449         }
    00450     }
    00451
    00452
    00453     XalanDOMChar                m_buffer[kBufferSize];
    00454
    00455     XalanDOMChar*               m_bufferPosition;
    00456
    00457     XalanDOMString::size_type   m_bufferRemaining;
    00458 };
    00459
    00460
    00461
    00462 XALAN_CPP_NAMESPACE_END
    00463
    00464
    00465
    00466 #endif  // FORMATTERTOXML_UTF16_HEADER_GUARD_1357924680

Interpreting class diagrams

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

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