| <HTML><HEAD><TITLE>Xalan-C++ API Documentation</TITLE></HEAD>
|
| <BODY>
|
| <h2 align="center">Xalan-C++ API Documentation</h2>
|
| <h3 align="center">The Xalan C++ XSLT Processor Version 1.10</h3>
|
| </BODY> |
| <!-- Generated by Doxygen 1.2.8.1 --> |
| <center> |
| <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center> |
| <hr><h1>XalanFormatterWriter.hpp</h1><a href="XalanFormatterWriter_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">/*</font> |
| 00002 <font class="comment"> * Copyright 1999-2004 The Apache Software Foundation.</font> |
| 00003 <font class="comment"> *</font> |
| 00004 <font class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</font> |
| 00005 <font class="comment"> * you may not use this file except in compliance with the License.</font> |
| 00006 <font class="comment"> * You may obtain a copy of the License at</font> |
| 00007 <font class="comment"> *</font> |
| 00008 <font class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</font> |
| 00009 <font class="comment"> *</font> |
| 00010 <font class="comment"> * Unless required by applicable law or agreed to in writing, software</font> |
| 00011 <font class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</font> |
| 00012 <font class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</font> |
| 00013 <font class="comment"> * See the License for the specific language governing permissions and</font> |
| 00014 <font class="comment"> * limitations under the License.</font> |
| 00015 <font class="comment"> */</font> |
| 00016 <font class="preprocessor">#if !defined(XALANFORMATTERWRITER_HEADER_GUARD_1357924680)</font> |
| <a name="l00017"></a><a class="code" href="XalanFormatterWriter_8hpp.html#a0">00017</a> <font class="preprocessor"></font><font class="preprocessor">#define XALANFORMATTERWRITER_HEADER_GUARD_1357924680</font> |
| 00018 <font class="preprocessor"></font> |
| 00019 |
| 00020 |
| 00021 <font class="comment">// Base include file. Must be first.</font> |
| 00022 <font class="preprocessor">#include <<a class="code" href="XMLSupportDefinitions_8hpp.html">xalanc/XMLSupport/XMLSupportDefinitions.hpp</a>></font> |
| 00023 |
| 00024 <font class="preprocessor">#include <xercesc/sax/SAXException.hpp></font> |
| 00025 |
| 00026 <font class="preprocessor">#include <<a class="code" href="DOMStringHelper_8hpp.html">xalanc/PlatformSupport/DOMStringHelper.hpp</a>></font> |
| 00027 <font class="preprocessor">#include <<a class="code" href="Writer_8hpp.html">xalanc/PlatformSupport/Writer.hpp</a>></font> |
| 00028 <font class="preprocessor">#include <<a class="code" href="XalanMessageLoader_8hpp.html">xalanc/PlatformSupport/XalanMessageLoader.hpp</a>></font> |
| 00029 <font class="preprocessor">#include <<a class="code" href="XalanOutputStream_8hpp.html">xalanc/PlatformSupport/XalanOutputStream.hpp</a>></font> |
| 00030 |
| 00031 |
| 00032 |
| 00033 XALAN_CPP_NAMESPACE_BEGIN |
| 00034 |
| 00035 |
| 00036 |
| <a name="l00037"></a><a class="code" href="XalanFormatterWriter_8hpp.html#a1">00037</a> <a class="code" href="XSLTInputSource_8hpp.html#a3">XALAN_USING_XERCES</a>(MemoryManager) |
| 00038 |
| 00039 |
| 00040 |
| 00041 <font class="keyword">class </font><a class="code" href="classXalanFormatterWriter.html">XalanFormatterWriter</a> |
| 00042 { |
| 00043 <font class="keyword">public</font>: |
| 00044 |
| 00045 template <class WriterType> |
| 00046 <font class="keyword">class </font>NewLineWriterFunctor |
| 00047 { |
| 00048 <font class="keyword">public</font>: |
| 00049 |
| 00050 <font class="keyword">typedef</font> WriterType writer_type; |
| 00051 |
| 00052 NewLineWriterFunctor(WriterType& writer) : |
| 00053 m_writer(writer), |
| 00054 m_newlineString(0), |
| 00055 m_newlineStringLength(0)<font class="keyword"></font> |
| 00056 <font class="keyword"> </font>{ |
| 00057 <a class="code" href="classXalanOutputStream.html">XalanOutputStream</a>* stream = writer.getStream(); |
| 00058 |
| 00059 <font class="keywordflow">if</font>(stream != 0) |
| 00060 { |
| 00061 m_newlineString = stream-><a class="code" href="classXalanOutputStream.html#a4">getNewlineString</a>(); |
| 00062 } |
| 00063 <font class="keywordflow">else</font> |
| 00064 { |
| 00065 m_newlineString = <a class="code" href="classXalanOutputStream.html#d0">XalanOutputStream::defaultNewlineString</a>(); |
| 00066 } |
| 00067 |
| 00068 assert(m_newlineString != 0); |
| 00069 |
| 00070 m_newlineStringLength = <a class="code" href="DOMStringHelper_8hpp.html#a14">length</a>(m_newlineString); |
| 00071 } |
| 00072 |
| 00073 <font class="keywordtype">void</font> |
| 00074 operator()()<font class="keyword"> </font> |
| 00075 <font class="keyword"> </font>{ |
| 00076 assert(m_newlineString != 0 && <a class="code" href="DOMStringHelper_8hpp.html#a14">length</a>(m_newlineString) == m_newlineStringLength); |
| 00077 |
| 00078 m_writer.write(m_newlineString, m_newlineStringLength); |
| 00079 } |
| 00080 |
| 00081 <font class="keyword">private</font>: |
| 00082 |
| 00083 WriterType& m_writer; |
| 00084 |
| 00088 <font class="keyword">const</font> XalanDOMChar* m_newlineString; |
| 00089 |
| 00093 XalanDOMString::size_type m_newlineStringLength; |
| 00094 }; |
| 00095 |
| 00096 template<class WriterType> |
| 00097 <font class="keyword">class </font>WhiteSpaceWriterFunctor |
| 00098 { |
| 00099 <font class="keyword">typedef</font> XalanDOMString::size_type size_type; |
| 00100 <font class="keyword">typedef</font> <font class="keyword">typename</font> WriterType::value_type value_type; |
| 00101 <font class="keyword">public</font>: |
| 00102 <font class="keyword">typedef</font> WriterType writer_type; |
| 00103 |
| 00104 WhiteSpaceWriterFunctor(WriterType& writer) : |
| 00105 m_writer(writer)<font class="keyword"></font> |
| 00106 <font class="keyword"> </font>{ |
| 00107 } |
| 00108 |
| 00109 <font class="keywordtype">void</font> |
| 00110 operator()(size_type count)<font class="keyword"> </font> |
| 00111 <font class="keyword"> </font>{ |
| 00112 <font class="keywordflow">for</font> ( size_type i = 0 ; i < count ; i++ ) |
| 00113 { |
| 00114 m_writer.write(value_type(XalanUnicode::charSpace)); |
| 00115 } |
| 00116 } |
| 00117 |
| 00118 <font class="keyword">private</font>: |
| 00119 |
| 00120 WriterType& m_writer; |
| 00121 }; |
| 00122 |
| 00123 <font class="keyword">class </font>CommonRepresentableCharFunctor |
| 00124 { |
| 00125 <font class="keyword">public</font>: |
| 00126 |
| 00127 CommonRepresentableCharFunctor(<font class="keyword">const</font> <a class="code" href="classXalanOutputStream.html">XalanOutputStream</a>* stream) : |
| 00128 m_stream(stream)<font class="keyword"></font> |
| 00129 <font class="keyword"> </font>{ |
| 00130 assert(stream != 0); |
| 00131 } |
| 00132 |
| 00133 <font class="keywordtype">bool</font> |
| 00134 operator()(<font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> theChar)<font class="keyword"> const</font> |
| 00135 <font class="keyword"> </font>{ |
| 00136 <font class="keywordtype">bool</font> result = <font class="keyword">true</font>; |
| 00137 |
| 00138 <font class="keywordflow">if</font>( m_stream != 0) |
| 00139 { |
| 00140 result = m_stream->canTranscodeTo(theChar); |
| 00141 } |
| 00142 |
| 00143 <font class="keywordflow">return</font> result; |
| 00144 } |
| 00145 |
| 00146 <font class="keyword">private</font>: |
| 00147 |
| 00148 <font class="keyword">const</font> <a class="code" href="classXalanOutputStream.html">XalanOutputStream</a>* <font class="keyword">const</font> m_stream; |
| 00149 }; |
| 00150 |
| 00151 <font class="keyword">public</font>: |
| 00152 |
| 00153 <font class="keyword">typedef</font> XalanDOMString::size_type size_type; |
| 00154 |
| 00155 |
| 00156 XalanFormatterWriter( |
| 00157 <a class="code" href="classWriter.html">Writer</a>& theWriter, |
| 00158 MemoryManager& theMemoryManager) : |
| 00159 m_writer(theWriter), |
| 00160 m_memoryManager(theMemoryManager), |
| 00161 m_stringBuffer(5, 0, theMemoryManager)<font class="keyword"></font> |
| 00162 <font class="keyword"> </font>{ |
| 00163 <font class="keyword">const</font> <a class="code" href="classXalanOutputStream.html">XalanOutputStream</a>* <font class="keyword">const</font> theStream = |
| 00164 theWriter.<a class="code" href="classWriter.html#a4">getStream</a>(); |
| 00165 |
| 00166 <font class="keywordflow">if</font> (theStream == 0) |
| 00167 { |
| 00168 m_newlineString = <a class="code" href="classXalanOutputStream.html#d0">XalanOutputStream::defaultNewlineString</a>(); |
| 00169 } |
| 00170 <font class="keywordflow">else</font> |
| 00171 { |
| 00172 m_newlineString = theStream-><a class="code" href="classXalanOutputStream.html#a4">getNewlineString</a>(); |
| 00173 } |
| 00174 |
| 00175 assert(m_newlineString != 0); |
| 00176 |
| 00177 m_newlineStringLength = <a class="code" href="DOMStringHelper_8hpp.html#a14">length</a>(m_newlineString); |
| 00178 |
| 00179 assert(m_newlineString != 0); |
| 00180 } |
| 00181 |
| 00182 MemoryManagerType& |
| 00183 getMemoryManager()<font class="keyword"></font> |
| 00184 <font class="keyword"> </font>{ |
| 00185 <font class="keywordflow">return</font> m_memoryManager; |
| 00186 } |
| 00187 |
| 00188 <font class="keyword">virtual</font> |
| 00189 ~XalanFormatterWriter()<font class="keyword"></font> |
| 00190 <font class="keyword"> </font>{ |
| 00191 } |
| 00192 |
| 00193 <a class="code" href="classWriter.html">Writer</a>* |
| 00194 getWriter()<font class="keyword"> const</font> |
| 00195 <font class="keyword"> </font>{ |
| 00196 <font class="keywordflow">return</font> &m_writer; |
| 00197 } |
| 00198 |
| 00199 <a class="code" href="classXalanOutputStream.html">XalanOutputStream</a>* |
| 00200 getStream()<font class="keyword"></font> |
| 00201 <font class="keyword"> </font>{ |
| 00202 <font class="keywordflow">return</font> m_writer.getStream(); |
| 00203 } |
| 00204 |
| 00205 <font class="keyword">const</font> <a class="code" href="classXalanOutputStream.html">XalanOutputStream</a>* |
| 00206 getStream()<font class="keyword"> const</font> |
| 00207 <font class="keyword"> </font>{ |
| 00208 <font class="keywordflow">return</font> m_writer.getStream(); |
| 00209 } |
| 00210 |
| 00211 <font class="keywordtype">void</font> |
| 00212 flushWriter()<font class="keyword"></font> |
| 00213 <font class="keyword"> </font>{ |
| 00214 m_writer.flush(); |
| 00215 } |
| 00216 |
| 00217 |
| 00218 <font class="keyword">static</font> <font class="keywordtype">bool</font> |
| 00219 isUTF16HighSurrogate(XalanDOMChar theChar)<font class="keyword"></font> |
| 00220 <font class="keyword"> </font>{ |
| 00221 <font class="keywordflow">return</font> 0xD800u <= theChar && theChar <= 0xDBFFu ? <font class="keyword">true</font> : <font class="keyword">false</font>; |
| 00222 } |
| 00223 |
| 00224 <font class="keyword">static</font> <font class="keywordtype">bool</font> |
| 00225 isUTF16LowSurrogate(XalanDOMChar theChar)<font class="keyword"></font> |
| 00226 <font class="keyword"> </font>{ |
| 00227 <font class="keywordflow">return</font> 0xDC00u <= theChar && theChar <= 0xDFFFu ? <font class="keyword">true</font> : <font class="keyword">false</font>; |
| 00228 } |
| 00229 |
| 00230 <font class="keyword">static</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> |
| 00231 decodeUTF16SurrogatePair( |
| 00232 XalanDOMChar theHighSurrogate, |
| 00233 XalanDOMChar theLowSurrogate, |
| 00234 MemoryManager& theManager)<font class="keyword"></font> |
| 00235 <font class="keyword"> </font>{ |
| 00236 assert(isUTF16HighSurrogate(theHighSurrogate) == <font class="keyword">true</font>); |
| 00237 |
| 00238 <font class="keywordflow">if</font> (isUTF16LowSurrogate(theLowSurrogate) == <font class="keyword">false</font>) |
| 00239 { |
| 00240 throwInvalidUTF16SurrogateException(theHighSurrogate, theLowSurrogate, theManager); |
| 00241 } |
| 00242 |
| 00243 <font class="keywordflow">return</font> ((theHighSurrogate - 0xD800u) << 10) + theLowSurrogate - 0xDC00u + 0x00010000u; |
| 00244 } |
| 00245 |
| 00246 <font class="keyword">static</font> <font class="keywordtype">void</font> |
| 00247 throwInvalidCharacterException( |
| 00248 <font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> ch, |
| 00249 MemoryManager& theManager)<font class="keyword"></font> |
| 00250 <font class="keyword"> </font>{ |
| 00251 <a class="code" href="classXalanDOMString.html">XalanDOMString</a> theMessage(theManager); |
| 00252 <a class="code" href="classXalanDOMString.html">XalanDOMString</a> theBuffer(theManager); |
| 00253 |
| 00254 XalanMessageLoader::getMessage( |
| 00255 theMessage, |
| 00256 XalanMessages::InvalidScalar_1Param, |
| 00257 UnsignedLongToHexDOMString(ch, theBuffer)); |
| 00258 |
| 00259 <a class="code" href="XSLTInputSource_8hpp.html#a3">XALAN_USING_XERCES</a>(SAXException) |
| 00260 |
| 00261 <font class="keywordflow">throw</font> SAXException(<a class="code" href="DOMStringHelper_8hpp.html#a7">c_wstr</a>(theMessage), &theManager); |
| 00262 } |
| 00263 |
| 00264 <font class="keyword">static</font> <font class="keywordtype">void</font> |
| 00265 throwInvalidUTF16SurrogateException( |
| 00266 XalanDOMChar ch, |
| 00267 XalanDOMChar next, |
| 00268 MemoryManagerType& theManager)<font class="keyword"></font> |
| 00269 <font class="keyword"> </font>{ |
| 00270 |
| 00271 <a class="code" href="classXalanDOMString.html">XalanDOMString</a> chStr(theManager); |
| 00272 |
| 00273 <a class="code" href="classXalanDOMString.html">XalanDOMString</a> nextStr(theManager); |
| 00274 |
| 00275 UnsignedLongToHexDOMString(ch, chStr); |
| 00276 |
| 00277 UnsignedLongToHexDOMString(next, nextStr); |
| 00278 |
| 00279 <a class="code" href="classXalanDOMString.html">XalanDOMString</a> theMessage(theManager); |
| 00280 |
| 00281 XalanMessageLoader::getMessage( |
| 00282 theMessage, |
| 00283 XalanMessages::InvalidSurrogatePair_2Param, |
| 00284 theMessage, |
| 00285 chStr, |
| 00286 nextStr); |
| 00287 |
| 00288 <a class="code" href="XSLTInputSource_8hpp.html#a3">XALAN_USING_XERCES</a>(SAXException) |
| 00289 |
| 00290 <font class="keywordflow">throw</font> SAXException(<a class="code" href="DOMStringHelper_8hpp.html#a7">c_wstr</a>(theMessage),&theManager); |
| 00291 } |
| 00292 |
| 00293 <font class="keyword">protected</font>: |
| 00294 |
| 00298 <a class="code" href="classWriter.html">Writer</a>& m_writer; |
| 00299 |
| 00304 MemoryManager& m_memoryManager; |
| 00305 |
| 00306 <a class="code" href="classXalanDOMString.html">XalanDOMString</a> m_stringBuffer; |
| 00307 |
| 00311 <font class="keyword">const</font> XalanDOMChar* m_newlineString; |
| 00312 |
| 00316 XalanDOMString::size_type m_newlineStringLength; |
| 00317 |
| 00323 <font class="keyword">const</font> <a class="code" href="classXalanDOMString.html">XalanDOMString</a>& |
| 00324 formatNumericCharacterReference(<font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> theNumber)<font class="keyword"></font> |
| 00325 <font class="keyword"> </font>{ |
| 00326 <a class="code" href="DOMStringHelper_8hpp.html#a80">clear</a>(m_stringBuffer); |
| 00327 |
| 00328 m_stringBuffer.<a class="code" href="classXalanDOMString.html#a54">push_back</a>(XalanDOMChar(XalanUnicode::charAmpersand)); |
| 00329 m_stringBuffer.<a class="code" href="classXalanDOMString.html#a54">push_back</a>(XalanDOMChar(XalanUnicode::charNumberSign)); |
| 00330 |
| 00331 UnsignedLongToDOMString(theNumber, m_stringBuffer); |
| 00332 |
| 00333 m_stringBuffer.<a class="code" href="classXalanDOMString.html#a54">push_back</a>(XalanDOMChar(XalanUnicode::charSemicolon)); |
| 00334 |
| 00335 <font class="keywordflow">return</font> m_stringBuffer; |
| 00336 } |
| 00337 |
| 00338 <font class="keyword">private</font>: |
| 00339 |
| 00340 <font class="comment">// These are not implemented.</font> |
| 00341 XalanFormatterWriter(); |
| 00342 |
| 00343 <a class="code" href="classXalanFormatterWriter.html">XalanFormatterWriter</a>& |
| 00344 operator=(<font class="keyword">const</font> <a class="code" href="classXalanFormatterWriter.html">XalanFormatterWriter</a>&); |
| 00345 }; |
| 00346 |
| 00347 |
| 00348 |
| 00349 XALAN_CPP_NAMESPACE_END |
| 00350 |
| 00351 |
| 00352 |
| 00353 <font class="preprocessor">#endif // XALANFORMATTERWRITER_HEADER_GUARD_1357924680</font> |
| </font></pre></div><p align="center"><a href="diagramnotes.html">Interpreting class diagrams</a></p>
|
| <p><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">
|
| <i><A href="http://www.stack.nl/~dimitri/doxygen/">Doxygen</A> and
|
| <A href="http://www.research.att.com/sw/tools/graphviz/">GraphViz</A> are used to generate this API documentation from the Xalan-C header files.</I></FONT></p>
|
|
|
| <TABLE border="0" cellpadding="0" cellspacing="0" width="820"><TR><TD bgcolor="#0086b2"><IMG height="1" src="../resources/dot.gif" width="1" alt="dot"></TD></TR></TABLE>
|
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="80%">
|
| <TR>
|
| <TD WIDTH="80%" VALIGN="TOP">
|
| <P ALIGN="CENTER"><B>Xalan-C++ XSLT Processor Version 1.10</B><BR>
|
| Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.</i></p>
|
| </TD>
|
| </TR>
|
| <TR>
|
| <TD WIDTH="100%">
|
| <P ALIGN="CENTER"><IMG SRC="ApacheLogo.jpg" WIDTH="387" HEIGHT="100" ALIGN="BOTTOM" BORDER="0" ALT="Apache Logo">
|
| </TD>
|
| </TR>
|
| </TABLE>
|