blob: f2638cb49751fdb9f85747cb454a48ee9ed7c064 [file] [log] [blame]
<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> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center>
<hr><h1>XalanIndentWriter.hpp</h1><a href="XalanIndentWriter_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-2005 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(XALANIDENTWRITER_HEADER_GUARD_1357924680)</font>
<a name="l00017"></a><a class="code" href="XalanIndentWriter_8hpp.html#a0">00017</a> <font class="preprocessor"></font><font class="preprocessor">#define XALANIDENTWRITER_HEADER_GUARD_1357924680</font>
00018 <font class="preprocessor"></font>
00019
00020 <font class="comment">// Base include file. Must be first.</font>
00021 <font class="preprocessor">#include &lt;<a class="code" href="XMLSupportDefinitions_8hpp.html">xalanc/XMLSupport/XMLSupportDefinitions.hpp</a>&gt;</font>
00022
00023 <font class="preprocessor">#include &lt;<a class="code" href="XalanVector_8hpp.html">xalanc/Include/XalanVector.hpp</a>&gt;</font>
00024
00025 <font class="preprocessor">#include &lt;<a class="code" href="Writer_8hpp.html">xalanc/PlatformSupport/Writer.hpp</a>&gt;</font>
00026
00027
00028 XALAN_CPP_NAMESPACE_BEGIN
00029
00030
00031 <font class="keyword">template</font>&lt;<font class="keyword">class </font>WhiteSpaceWriter,
00032 <font class="keyword">class </font>NewLineWriter&gt;
<a name="l00033"></a><a class="code" href="classXalanIndentWriter.html">00033</a> <font class="keyword">class </font><a class="code" href="classXalanIndentWriter.html">XalanIndentWriter</a>
00034 {
00035 <font class="keyword">public</font>:
<a name="l00036"></a><a class="code" href="classXalanIndentWriter.html#s0">00036</a> <font class="keyword">typedef</font> <font class="keyword">typename</font> XalanDOMString::size_type size_type;
<a name="l00037"></a><a class="code" href="classXalanIndentWriter.html#s1">00037</a> <font class="keyword">typedef</font> XalanVector&lt;bool&gt; BoolStackType;
<a name="l00038"></a><a class="code" href="classXalanIndentWriter.html#s2">00038</a> <font class="keyword">typedef</font> <font class="keyword">typename</font> WhiteSpaceWriter::writer_type writer_type;
00039
<a name="l00040"></a><a class="code" href="classXalanIndentWriter.html#a0">00040</a> <a class="code" href="classXalanIndentWriter.html#a0">XalanIndentWriter</a>(
00041 writer_type&amp; writer,
00042 size_type ident) :
00043 m_whiteSpaceWriter(writer),
00044 m_newLineWriter(writer),
00045 m_indent(ident),
00046 m_currentIndent(0),
00047 m_startNewLine(false),
00048 m_ispreserve(false),
00049 m_isprevtext(false),
00050 m_preserves(writer.getMemoryManager(), 5)
00051 {
00052 assert( m_indent != -1);
00053 }
00054
<a name="l00055"></a><a class="code" href="classXalanIndentWriter.html#a1">00055</a> <a class="code" href="classXalanIndentWriter.html#a1">~XalanIndentWriter</a>()<font class="keyword"></font>
00056 <font class="keyword"> </font>{
00057 }
00058
00059
00060 <font class="keywordtype">void</font>
<a name="l00061"></a><a class="code" href="classXalanIndentWriter.html#a2">00061</a> <a class="code" href="classXalanIndentWriter.html#a2">setIndent</a>(size_type value)<font class="keyword"></font>
00062 <font class="keyword"> </font>{
00063 m_indent = value;
00064 }
00065
00066 size_type
<a name="l00067"></a><a class="code" href="classXalanIndentWriter.html#a3">00067</a> <a class="code" href="classXalanIndentWriter.html#a3">getIndent</a>()<font class="keyword">const</font>
00068 {
00069 <font class="keywordflow">return</font> m_indent;
00070 }
00071
00072 <font class="keywordtype">void</font>
<a name="l00073"></a><a class="code" href="classXalanIndentWriter.html#a4">00073</a> <a class="code" href="classXalanIndentWriter.html#a4">indent</a>()<font class="keyword"></font>
00074 <font class="keyword"> </font>{
00075 <font class="keywordflow">if</font>( shouldIndent() )
00076 {
00077 <font class="keywordflow">if</font>(m_startNewLine == <font class="keyword">true</font>)
00078 {
00079 m_newLineWriter();
00080 }
00081
00082 m_whiteSpaceWriter(m_currentIndent);
00083
00084 }
00085 }
00086
00087 <font class="keywordtype">void</font>
<a name="l00088"></a><a class="code" href="classXalanIndentWriter.html#a5">00088</a> <a class="code" href="classXalanIndentWriter.html#a5">increaseIndent</a>()<font class="keyword"></font>
00089 <font class="keyword"> </font>{
00090 m_currentIndent += m_indent;
00091 }
00092
00093 <font class="keywordtype">void</font>
<a name="l00094"></a><a class="code" href="classXalanIndentWriter.html#a6">00094</a> <a class="code" href="classXalanIndentWriter.html#a6">decreaseIndent</a>()<font class="keyword"></font>
00095 <font class="keyword"> </font>{
00096 assert( m_currentIndent &gt;= m_indent);
00097
00098 m_currentIndent -= m_indent;
00099 }
00100
00101 <font class="keywordtype">void</font>
<a name="l00102"></a><a class="code" href="classXalanIndentWriter.html#a7">00102</a> <a class="code" href="classXalanIndentWriter.html#a7">setStartNewLine</a>(<font class="keywordtype">bool</font> value)<font class="keyword"></font>
00103 <font class="keyword"> </font>{
00104 m_startNewLine = value;
00105 }
00106
00110 <font class="keywordtype">void</font>
<a name="l00111"></a><a class="code" href="classXalanIndentWriter.html#a8">00111</a> <a class="code" href="classXalanIndentWriter.html#a8">outputLineSep</a>()<font class="keyword"></font>
00112 <font class="keyword"> </font>{
00113 m_newLineWriter();
00114 }
00115
00116 <font class="keywordtype">void</font>
<a name="l00117"></a><a class="code" href="classXalanIndentWriter.html#a9">00117</a> <a class="code" href="classXalanIndentWriter.html#a9">setPrevText</a>(<font class="keywordtype">bool</font> value)<font class="keyword"></font>
00118 <font class="keyword"> </font>{
00119 m_isprevtext = value;
00120 }
00121
00122 <font class="keywordtype">void</font>
<a name="l00123"></a><a class="code" href="classXalanIndentWriter.html#a10">00123</a> <a class="code" href="classXalanIndentWriter.html#a10">setPreserve</a>(<font class="keywordtype">bool</font> value)<font class="keyword"></font>
00124 <font class="keyword"> </font>{
00125 m_ispreserve = value;
00126 }
00127
00128 <font class="keywordtype">void</font>
<a name="l00129"></a><a class="code" href="classXalanIndentWriter.html#a11">00129</a> <a class="code" href="classXalanIndentWriter.html#a11">pop_preserve</a>()<font class="keyword"></font>
00130 <font class="keyword"> </font>{
00131 <font class="keywordflow">if</font> ( m_preserves.empty() )
00132 {
00133 m_ispreserve = <font class="keyword">false</font>;
00134 }
00135 <font class="keywordflow">else</font>
00136 {
00137 m_ispreserve = m_preserves.back();
00138
00139 m_preserves.pop_back();
00140 }
00141 }
00142
00143 <font class="keywordtype">void</font>
<a name="l00144"></a><a class="code" href="classXalanIndentWriter.html#a12">00144</a> <a class="code" href="classXalanIndentWriter.html#a12">push_preserve</a>()<font class="keyword"></font>
00145 <font class="keyword"> </font>{
00146 m_preserves.push_back(m_ispreserve);
00147 }
00148
00149 <font class="keyword">private</font>:
00150 <font class="keywordtype">bool</font>
00151 shouldIndent()<font class="keyword"> const</font>
00152 <font class="keyword"> </font>{
00153 <font class="keywordflow">return</font> (!m_ispreserve &amp;&amp; !m_isprevtext);
00154 <font class="comment">// return true;</font>
00155 }
00156
00157 <font class="keyword">private</font>:
00158
00159 <font class="comment">//data members</font>
00160
00161 WhiteSpaceWriter m_whiteSpaceWriter;
00162
00163 NewLineWriter m_newLineWriter;
00164
00168 size_type m_indent;
00169
00173 size_type m_currentIndent;
00174
00178 <font class="keywordtype">bool</font> m_startNewLine;
00179
00184 <font class="keywordtype">bool</font> m_ispreserve;
00185
00190 <font class="keywordtype">bool</font> m_isprevtext;
00191
00196 BoolStackType m_preserves;
00197 };
00198
00199 XALAN_CPP_NAMESPACE_END
00200
00201
00202
00203 <font class="preprocessor">#endif // XALANIDENTWRITER_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 &copy; 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>