blob: 2a80253a86fa0a2148fc650c88e4ae483266cf5c [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>XalanAutoPtr.hpp</h1><a href="XalanAutoPtr_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(XALANAUTOPTR_HEADER_GUARD_1357924680)</font>
<a name="l00017"></a><a class="code" href="XalanAutoPtr_8hpp.html#a0">00017</a> <font class="preprocessor"></font><font class="preprocessor">#define XALANAUTOPTR_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 &lt;<a class="code" href="PlatformSupportDefinitions_8hpp.html">xalanc/PlatformSupport/PlatformSupportDefinitions.hpp</a>&gt;</font>
00023
00024
00025
00026 <font class="preprocessor">#include &lt;cstddef&gt;</font>
00027
00028
00029
00030 XALAN_CPP_NAMESPACE_BEGIN
00031
00032
00033
00034 <font class="comment">// We're using our own auto_ptr-like class due to wide</font>
00035 <font class="comment">// variations amongst the varous platforms we have to</font>
00036 <font class="comment">// support</font>
00037 template&lt;class Type&gt;
<a name="l00038"></a><a class="code" href="classXalanAutoPtr.html">00038</a> <font class="keyword">class </font><a class="code" href="classXalanAutoPtr.html">XalanAutoPtr</a>
00039 {
00040 <font class="keyword">public</font>:
00041
<a name="l00042"></a><a class="code" href="classXalanAutoPtr.html#a0">00042</a> <a class="code" href="classXalanAutoPtr.html#a0">XalanAutoPtr</a>(Type* thePointer = 0) :
00043 m_pointer(thePointer)
00044 {
00045 }
00046
<a name="l00047"></a><a class="code" href="classXalanAutoPtr.html#a1">00047</a> <a class="code" href="classXalanAutoPtr.html#a0">XalanAutoPtr</a>(<font class="keyword">const</font> <a class="code" href="classXalanAutoPtr.html">XalanAutoPtr&lt;Type&gt;</a>&amp; theSource) :
00048 m_pointer(((<a class="code" href="classXalanAutoPtr.html">XalanAutoPtr</a>&lt;Type&gt;&amp;)theSource).release())
00049 {
00050 }
00051
00052 <a class="code" href="classXalanAutoPtr.html">XalanAutoPtr&lt;Type&gt;</a>&amp;
<a name="l00053"></a><a class="code" href="classXalanAutoPtr.html#a2">00053</a> <a class="code" href="classXalanAutoPtr.html#a2">operator=</a>(<a class="code" href="classXalanAutoPtr.html">XalanAutoPtr&lt;Type&gt;</a>&amp; theRHS)<font class="keyword"></font>
00054 <font class="keyword"> </font>{
00055 <font class="keywordflow">if</font> (<font class="keyword">this</font> != &amp;theRHS)
00056 {
00057 <font class="comment">// This test ought not to be necessary, but</font>
00058 <font class="comment">// MSVC 6.0 calls delete, which checks for 0.</font>
00059 <font class="comment">// The problem with that is the locking is</font>
00060 <font class="comment">// extremely expensive.</font>
00061 <font class="keywordflow">if</font> (m_pointer != 0)
00062 {
00063 <font class="keyword">delete</font> m_pointer;
00064 }
00065
00066 m_pointer = theRHS.<a class="code" href="classXalanAutoPtr.html#a7">release</a>();
00067 }
00068
00069 <font class="keywordflow">return</font> *<font class="keyword">this</font>;
00070 }
00071
<a name="l00072"></a><a class="code" href="classXalanAutoPtr.html#a3">00072</a> <a class="code" href="classXalanAutoPtr.html#a3">~XalanAutoPtr</a>()<font class="keyword"></font>
00073 <font class="keyword"> </font>{
00074 <font class="comment">// See note in operator=() about this...</font>
00075 <font class="keywordflow">if</font> (m_pointer != 0)
00076 {
00077 <font class="keyword">delete</font> m_pointer;
00078 }
00079 }
00080
00081 Type&amp;
<a name="l00082"></a><a class="code" href="classXalanAutoPtr.html#a4">00082</a> <a class="code" href="classXalanAutoPtr.html#a4">operator*</a>()<font class="keyword"> const</font>
00083 <font class="keyword"> </font>{
00084 <font class="keywordflow">return</font> *m_pointer;
00085 }
00086
00087 Type*
<a name="l00088"></a><a class="code" href="classXalanAutoPtr.html#a5">00088</a> <a class="code" href="classXalanAutoPtr.html#a5">operator-&gt;</a>()<font class="keyword"> const</font>
00089 <font class="keyword"> </font>{
00090 <font class="keywordflow">return</font> m_pointer;
00091 }
00092
00093 Type*
<a name="l00094"></a><a class="code" href="classXalanAutoPtr.html#a6">00094</a> <a class="code" href="classXalanAutoPtr.html#a6">get</a>()<font class="keyword"> const</font>
00095 <font class="keyword"> </font>{
00096 <font class="keywordflow">return</font> m_pointer;
00097 }
00098
00099 Type*
<a name="l00100"></a><a class="code" href="classXalanAutoPtr.html#a7">00100</a> <a class="code" href="classXalanAutoPtr.html#a7">release</a>()<font class="keyword"></font>
00101 <font class="keyword"> </font>{
00102 Type* <font class="keyword">const</font> temp = m_pointer;
00103
00104 m_pointer = 0;
00105
00106 <font class="keywordflow">return</font> temp;
00107 }
00108
00109 <font class="keywordtype">void</font>
<a name="l00110"></a><a class="code" href="classXalanAutoPtr.html#a8">00110</a> <a class="code" href="classXalanAutoPtr.html#a8">reset</a>(Type* thePointer = 0)<font class="keyword"></font>
00111 <font class="keyword"> </font>{
00112 <font class="comment">// See note in operator=() about this...</font>
00113 <font class="keywordflow">if</font> (m_pointer != 0)
00114 {
00115 <font class="keyword">delete</font> m_pointer;
00116 }
00117
00118 m_pointer = thePointer;
00119 }
00120
00121 <font class="keyword">private</font>:
00122
00123 Type* m_pointer;
00124 };
00125
00126
00127
00128 <font class="comment">// A class similar to XalanAutoPtr, but for arrays.</font>
00129 template&lt;class Type&gt;
<a name="l00130"></a><a class="code" href="classXalanArrayAutoPtr.html">00130</a> <font class="keyword">class </font><a class="code" href="classXalanArrayAutoPtr.html">XalanArrayAutoPtr</a>
00131 {
00132 <font class="keyword">public</font>:
00133
<a name="l00134"></a><a class="code" href="classXalanArrayAutoPtr.html#a0">00134</a> <a class="code" href="classXalanArrayAutoPtr.html#a0">XalanArrayAutoPtr</a>(Type* thePointer = 0) :
00135 m_pointer(thePointer)
00136 {
00137 }
00138
<a name="l00139"></a><a class="code" href="classXalanArrayAutoPtr.html#a1">00139</a> <a class="code" href="classXalanArrayAutoPtr.html#a0">XalanArrayAutoPtr</a>(<font class="keyword">const</font> <a class="code" href="classXalanArrayAutoPtr.html">XalanArrayAutoPtr&lt;Type&gt;</a>&amp; theSource) :
00140 m_pointer(((<a class="code" href="classXalanArrayAutoPtr.html">XalanArrayAutoPtr</a>&lt;Type&gt;&amp;)theSource).release())
00141 {
00142 }
00143
00144 <a class="code" href="classXalanArrayAutoPtr.html">XalanArrayAutoPtr&lt;Type&gt;</a>&amp;
<a name="l00145"></a><a class="code" href="classXalanArrayAutoPtr.html#a2">00145</a> <a class="code" href="classXalanArrayAutoPtr.html#a2">operator=</a>(<a class="code" href="classXalanArrayAutoPtr.html">XalanArrayAutoPtr&lt;Type&gt;</a>&amp; theRHS)<font class="keyword"></font>
00146 <font class="keyword"> </font>{
00147 <font class="keywordflow">if</font> (<font class="keyword">this</font> != &amp;theRHS)
00148 {
00149 <font class="comment">// This test ought not to be necessary, but</font>
00150 <font class="comment">// MSVC 6.0 calls delete, which checks for 0.</font>
00151 <font class="comment">// The problem with that is the locking is</font>
00152 <font class="comment">// extremely expensive.</font>
00153 <font class="keywordflow">if</font> (m_pointer != 0)
00154 {
00155 <font class="keyword">delete</font> [] m_pointer;
00156 }
00157
00158 m_pointer = theRHS.<a class="code" href="classXalanArrayAutoPtr.html#a7">release</a>();
00159 }
00160
00161 <font class="keywordflow">return</font> *<font class="keyword">this</font>;
00162 }
00163
<a name="l00164"></a><a class="code" href="classXalanArrayAutoPtr.html#a3">00164</a> <a class="code" href="classXalanArrayAutoPtr.html#a3">~XalanArrayAutoPtr</a>()<font class="keyword"></font>
00165 <font class="keyword"> </font>{
00166 <font class="comment">// See note in operator=() about this...</font>
00167 <font class="keywordflow">if</font> (m_pointer != 0)
00168 {
00169 <font class="keyword">delete</font> [] m_pointer;
00170 }
00171 }
00172
00173 Type&amp;
<a name="l00174"></a><a class="code" href="classXalanArrayAutoPtr.html#a4">00174</a> <a class="code" href="classXalanArrayAutoPtr.html#a4">operator*</a>()<font class="keyword"> const</font>
00175 <font class="keyword"> </font>{
00176 <font class="keywordflow">return</font> *m_pointer;
00177 }
00178
00179 Type&amp;
00180 <font class="preprocessor">#if defined(XALAN_STRICT_ANSI_HEADERS)</font>
00181 <font class="preprocessor"></font> <a class="code" href="classXalanArrayAutoPtr.html#a5">operator[]</a>(std::size_t index) <font class="keyword">const</font>
00182 <font class="preprocessor">#else</font>
<a name="l00183"></a><a class="code" href="classXalanArrayAutoPtr.html#a5">00183</a> <font class="preprocessor"></font> <a class="code" href="classXalanArrayAutoPtr.html#a5">operator[]</a>(size_t index) <font class="keyword">const</font>
00184 <font class="preprocessor">#endif</font>
00185 <font class="preprocessor"></font> {
00186 <font class="keywordflow">return</font> m_pointer[index];
00187 }
00188
00189 Type*
<a name="l00190"></a><a class="code" href="classXalanArrayAutoPtr.html#a6">00190</a> <a class="code" href="classXalanArrayAutoPtr.html#a6">get</a>()<font class="keyword"> const</font>
00191 <font class="keyword"> </font>{
00192 <font class="keywordflow">return</font> m_pointer;
00193 }
00194
00195 Type*
<a name="l00196"></a><a class="code" href="classXalanArrayAutoPtr.html#a7">00196</a> <a class="code" href="classXalanArrayAutoPtr.html#a7">release</a>()<font class="keyword"></font>
00197 <font class="keyword"> </font>{
00198 Type* <font class="keyword">const</font> temp = m_pointer;
00199
00200 m_pointer = 0;
00201
00202 <font class="keywordflow">return</font> temp;
00203 }
00204
00205 <font class="keywordtype">void</font>
<a name="l00206"></a><a class="code" href="classXalanArrayAutoPtr.html#a8">00206</a> <a class="code" href="classXalanArrayAutoPtr.html#a8">reset</a>(Type* thePointer = 0)<font class="keyword"></font>
00207 <font class="keyword"> </font>{
00208 <font class="comment">// See note in operator=() about this...</font>
00209 <font class="keywordflow">if</font> (m_pointer != 0)
00210 {
00211 <font class="keyword">delete</font> [] m_pointer;
00212 }
00213
00214 m_pointer = thePointer;
00215 }
00216
00217 <font class="keyword">private</font>:
00218
00219 Type* m_pointer;
00220 };
00221
00222
00223
00224 XALAN_CPP_NAMESPACE_END
00225
00226
00227
00228 <font class="preprocessor">#endif // if !defined(XALANAUTOPTR_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>