<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.4</h3> </BODY> <!-- Generated by Doxygen 1.1.2 on Mon Sep 16 08:26:01 2002 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</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>VariablesStack.hpp</h1><a href="VariablesStack.hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 /* 00002 * The Apache Software License, Version 1.1 00003 * 00004 * 00005 * Copyright (c) 2000 The Apache Software Foundation. All rights 00006 * reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions 00010 * are met: 00011 * 00012 * 1. Redistributions of source code must retain the above copyright 00013 * notice, this list of conditions and the following disclaimer. 00014 * 00015 * 2. Redistributions in binary form must reproduce the above copyright 00016 * notice, this list of conditions and the following disclaimer in 00017 * the documentation and/or other materials provided with the 00018 * distribution. 00019 * 00020 * 3. The end-user documentation included with the redistribution, 00021 * if any, must include the following acknowledgment: 00022 * "This product includes software developed by the 00023 * Apache Software Foundation (http://www.apache.org/)." 00024 * Alternately, this acknowledgment may appear in the software itself, 00025 * if and wherever such third-party acknowledgments normally appear. 00026 * 00027 * 4. The names "Xalan" and "Apache Software Foundation" must 00028 * not be used to endorse or promote products derived from this 00029 * software without prior written permission. For written 00030 * permission, please contact apache@apache.org. 00031 * 00032 * 5. Products derived from this software may not be called "Apache", 00033 * nor may "Apache" appear in their name, without prior written 00034 * permission of the Apache Software Foundation. 00035 * 00036 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 00037 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00038 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00039 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 00040 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00041 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00042 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 00043 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00044 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00045 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00046 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00047 * SUCH DAMAGE. 00048 * ==================================================================== 00049 * 00050 * This software consists of voluntary contributions made by many 00051 * individuals on behalf of the Apache Software Foundation and was 00052 * originally based on software copyright (c) 1999, International 00053 * Business Machines, Inc., http://www.ibm.com. For more 00054 * information on the Apache Software Foundation, please see 00055 * <http://www.apache.org/>. 00056 */ 00057 #if !defined(XALAN_VARIABLESSTACK_HEADER_GUARD) <a name="l00058"><a class="code" href="VariablesStack.hpp.html#a0">00058</a></a> #define XALAN_VARIABLESSTACK_HEADER_GUARD 00059 00060 00061 00062 // Base include file. Must be first. 00063 #include <XSLT/XSLTDefinitions.hpp> 00064 00065 00066 00067 #include <cassert> 00068 #include <vector> 00069 00070 00071 00072 #include <XPath/XalanQName.hpp> 00073 #include <XPath/XObject.hpp> 00074 00075 00076 00077 #include <XSLT/XSLTProcessorException.hpp> 00078 00079 00080 00081 class Arg; 00082 class <a class="code" href="class_elemtemplateelement.html">ElemTemplateElement</a>; 00083 class <a class="code" href="class_elemvariable.html">ElemVariable</a>; 00084 class <a class="code" href="class_stylesheetexecutioncontext.html">StylesheetExecutionContext</a>; 00085 class <a class="code" href="class_xalannode.html">XalanNode</a>; 00086 00087 00088 <a name="l00092"><a class="code" href="class_variablesstack.html">00092</a></a> class XALAN_XSLT_EXPORT <a class="code" href="class_variablesstack.html">VariablesStack</a> 00093 { 00094 public: 00095 00099 explicit 00100 <a class="code" href="class_variablesstack.html#a0">VariablesStack</a>(); 00101 00102 <a class="code" href="class_variablesstack.html#a1">~VariablesStack</a>(); 00103 00104 00108 void 00109 <a class="code" href="class_variablesstack.html#a2">reset</a>(); 00110 00116 void 00117 <a class="code" href="class_variablesstack.html#a3">pushElementFrame</a>(const <a class="code" href="class_elemtemplateelement.html">ElemTemplateElement</a>* elem); 00118 00124 void 00125 <a class="code" href="class_variablesstack.html#a4">popElementFrame</a>(const <a class="code" href="class_elemtemplateelement.html">ElemTemplateElement</a>* elem); 00126 00134 void 00135 <a class="code" href="class_variablesstack.html#a5">pushContextMarker</a>(); 00136 00140 void 00141 <a class="code" href="class_variablesstack.html#a6">popContextMarker</a>(); 00142 <a name="l00143"><a class="code" href="class_variablesstack__paramsvectorentry.html">00143</a></a> struct ParamsVectorEntry 00144 { <a name="l00145"><a class="code" href="class_variablesstack__paramsvectorentry.html#a0">00145</a></a> ParamsVectorEntry() : 00146 m_qname(0), 00147 m_value(), 00148 m_variable(0) 00149 { 00150 } 00151 <a name="l00152"><a class="code" href="class_variablesstack__paramsvectorentry.html#a1">00152</a></a> ParamsVectorEntry( 00153 const <a class="code" href="class_xalanqname.html">XalanQName</a>* qname, 00154 const <a class="code" href="class_xobjectptr.html">XObjectPtr</a> value) : 00155 m_qname(qname), 00156 m_value(value), 00157 m_variable(0) 00158 { 00159 } 00160 <a name="l00161"><a class="code" href="class_variablesstack__paramsvectorentry.html#a2">00161</a></a> ParamsVectorEntry( 00162 const <a class="code" href="class_xalanqname.html">XalanQName</a>* qname, 00163 const <a class="code" href="class_elemvariable.html">ElemVariable</a>* variable) : 00164 m_qname(qname), 00165 m_value(), 00166 m_variable(variable) 00167 { 00168 } 00169 <a name="l00170"><a class="code" href="class_variablesstack__paramsvectorentry.html#m0">00170</a></a> const <a class="code" href="class_xalanqname.html">XalanQName</a>* m_qname; 00171 <a name="l00172"><a class="code" href="class_variablesstack__paramsvectorentry.html#m1">00172</a></a> <a class="code" href="class_xobjectptr.html">XObjectPtr</a> m_value; 00173 <a name="l00174"><a class="code" href="class_variablesstack__paramsvectorentry.html#m2">00174</a></a> const <a class="code" href="class_elemvariable.html">ElemVariable</a>* m_variable; 00175 }; 00176 00177 #if defined(XALAN_NO_NAMESPACES) 00178 typedef vector<ParamsVectorEntry> ParamsVectorType; 00179 typedef vector<const <a class="code" href="class_elemvariable.html">ElemVariable</a>*> RecursionGuardStackType; 00180 #else <a name="l00181"><a class="code" href="class_variablesstack.html#s0">00181</a></a> typedef std::vector<ParamsVectorEntry> ParamsVectorType; <a name="l00182"><a class="code" href="class_variablesstack.html#s1">00182</a></a> typedef std::vector<const <a class="code" href="class_elemvariable.html">ElemVariable</a>*> RecursionGuardStackType; 00183 #endif 00184 00192 void 00193 pushParams( 00194 const ParamsVectorType& theParams, 00195 const <a class="code" href="class_elemtemplateelement.html">ElemTemplateElement</a>* targetTemplate); 00196 00207 const <a class="code" href="class_xobjectptr.html">XObjectPtr</a> <a name="l00208"><a class="code" href="class_variablesstack.html#a8">00208</a></a> getParamVariable( 00209 const <a class="code" href="class_xalanqname.html">XalanQName</a>& qname, 00210 <a class="code" href="class_stylesheetexecutioncontext.html">StylesheetExecutionContext</a>& executionContext, 00211 bool& fNameFound) 00212 { 00213 return findXObject(qname, executionContext, true, false, fNameFound); 00214 } 00215 00227 const <a class="code" href="class_xobjectptr.html">XObjectPtr</a> <a name="l00228"><a class="code" href="class_variablesstack.html#a9">00228</a></a> getVariable( 00229 const <a class="code" href="class_xalanqname.html">XalanQName</a>& qname, 00230 <a class="code" href="class_stylesheetexecutioncontext.html">StylesheetExecutionContext</a>& executionContext, 00231 bool& fNameFound) 00232 { 00233 return findXObject(qname, executionContext, false, true, fNameFound); 00234 } 00235 00245 void 00246 pushVariable( 00247 const <a class="code" href="class_xalanqname.html">XalanQName</a>& name, 00248 const <a class="code" href="class_elemvariable.html">ElemVariable</a>* var, 00249 const <a class="code" href="class_elemtemplateelement.html">ElemTemplateElement</a>* e); 00250 00260 void 00261 pushVariable( 00262 const <a class="code" href="class_xalanqname.html">XalanQName</a>& name, 00263 const <a class="code" href="class_xobjectptr.html">XObjectPtr</a>& val, 00264 const <a class="code" href="class_elemtemplateelement.html">ElemTemplateElement</a>* e); 00265 00269 void 00270 start(); 00271 00275 void 00276 resetParams(); 00277 00281 void 00282 markGlobalStackFrame(); 00283 00287 void 00288 unmarkGlobalStackFrame(); 00289 00297 void <a name="l00298"><a class="code" href="class_variablesstack.html#a16">00298</a></a> setCurrentStackFrameIndex(int currentStackFrameIndex = -1) 00299 { 00300 if (currentStackFrameIndex == -1) 00301 m_currentStackFrameIndex = m_stack.size(); 00302 else 00303 m_currentStackFrameIndex = currentStackFrameIndex; 00304 } 00305 00312 int <a name="l00313"><a class="code" href="class_variablesstack.html#a17">00313</a></a> getCurrentStackFrameIndex() const 00314 { 00315 return m_currentStackFrameIndex; 00316 } 00317 00323 int <a name="l00324"><a class="code" href="class_variablesstack.html#a18">00324</a></a> getGlobalStackFrameIndex() const 00325 { 00326 return m_globalStackFrameIndex; 00327 } 00328 <a name="l00329"><a class="code" href="class_variablesstack__invalidstackcontextexception.html">00329</a></a> class InvalidStackContextException : public <a class="code" href="class_xsltprocessorexception.html">XSLTProcessorException</a> 00330 { 00331 public: 00332 00333 InvalidStackContextException(); 00334 00335 virtual 00336 ~InvalidStackContextException(); 00337 00338 private: 00339 00340 }; 00341 <a name="l00342"><a class="code" href="class_variablesstack__pushparamfunctor.html">00342</a></a> class PushParamFunctor 00343 { 00344 public: 00345 <a name="l00346"><a class="code" href="class_variablesstack__pushparamfunctor.html#a0">00346</a></a> PushParamFunctor(<a class="code" href="class_variablesstack.html">VariablesStack</a>& theVariablesStack) : 00347 m_variablesStack(theVariablesStack) 00348 { 00349 } 00350 00351 const void 00352 operator()(const ParamsVectorType::value_type& theEntry); 00353 00354 private: 00355 00356 <a class="code" href="class_variablesstack.html">VariablesStack</a>& m_variablesStack; 00357 }; 00358 <a name="l00359"><a class="code" href="class_variablesstack__stackentry.html">00359</a></a> class XALAN_XSLT_EXPORT <a class="code" href="class_stackentry.html">StackEntry</a> 00360 { 00361 public: 00362 <a name="l00367"><a class="code" href="class_variablesstack__stackentry.html#s0">00367</a></a> enum eType { eContextMarker, 00368 eVariable, 00369 eParam, 00370 eActiveParam, 00371 eElementFrameMarker, 00372 eNextValue }; 00373 00377 explicit 00378 <a class="code" href="class_stackentry.html#b0">StackEntry</a>(); 00379 00383 <a class="code" href="class_stackentry.html#b0">StackEntry</a>( 00384 const <a class="code" href="class_xalanqname.html">XalanQName</a>* name, 00385 const <a class="code" href="class_xobjectptr.html">XObjectPtr</a>& val, 00386 bool isParam = false); 00387 00391 <a class="code" href="class_stackentry.html#b0">StackEntry</a>( 00392 const <a class="code" href="class_xalanqname.html">XalanQName</a>* name, 00393 const <a class="code" href="class_elemvariable.html">ElemVariable</a>* var, 00394 bool isParam = false); 00395 00399 <a class="code" href="class_stackentry.html#b0">StackEntry</a>(const <a class="code" href="class_elemtemplateelement.html">ElemTemplateElement</a>* elem); 00400 00401 00405 <a class="code" href="class_stackentry.html#b0">StackEntry</a>(const <a class="code" href="class_stackentry.html">StackEntry</a>& theSource); 00406 00410 <a class="code" href="class_stackentry.html#a0">~StackEntry</a>(); 00411 00417 eType <a name="l00418"><a class="code" href="class_variablesstack__stackentry.html#a6">00418</a></a> <a class="code" href="class_xslexception.html#a4">getType</a>() const 00419 { 00420 return m_type; 00421 } 00422 00428 const <a class="code" href="class_xalanqname.html">XalanQName</a>* <a name="l00429"><a class="code" href="class_variablesstack__stackentry.html#a7">00429</a></a> getName() const 00430 { 00431 return m_qname; 00432 } 00433 00439 const <a class="code" href="class_xobjectptr.html">XObjectPtr</a>& <a name="l00440"><a class="code" href="class_variablesstack__stackentry.html#a8">00440</a></a> getValue() const 00441 { 00442 return m_value; 00443 } 00444 00450 void <a name="l00451"><a class="code" href="class_variablesstack__stackentry.html#a9">00451</a></a> setValue(const <a class="code" href="class_xobjectptr.html">XObjectPtr</a>& theValue) 00452 { 00453 m_value = theValue; 00454 } 00455 00461 const <a class="code" href="class_elemvariable.html">ElemVariable</a>* <a name="l00462"><a class="code" href="class_variablesstack__stackentry.html#a10">00462</a></a> getVariable() const 00463 { 00464 return m_variable; 00465 } 00466 00467 void 00468 activate(); 00469 00470 void 00471 deactivate(); 00472 00478 const <a class="code" href="class_elemtemplateelement.html">ElemTemplateElement</a>* <a name="l00479"><a class="code" href="class_variablesstack__stackentry.html#a13">00479</a></a> getElement() const 00480 { 00481 return m_element; 00482 } 00483 00484 <a class="code" href="class_stackentry.html">StackEntry</a>& 00485 operator=(const <a class="code" href="class_stackentry.html">StackEntry</a>& theRHS); 00486 00487 bool 00488 operator==(const <a class="code" href="class_stackentry.html">StackEntry</a>& theRHS) const; 00489 00490 private: 00491 00492 // Data members... 00493 eType m_type; 00494 00495 const <a class="code" href="class_xalanqname.html">XalanQName</a>* m_qname; 00496 00497 <a class="code" href="class_xobjectptr.html">XObjectPtr</a> m_value; 00498 00499 const <a class="code" href="class_elemvariable.html">ElemVariable</a>* m_variable; 00500 00501 const <a class="code" href="class_elemtemplateelement.html">ElemTemplateElement</a>* m_element; 00502 }; 00503 00504 #if defined(XALAN_NO_NAMESPACES) 00505 typedef vector<<a class="code" href="class_stackentry.html">StackEntry</a>> VariableStackStackType; 00506 #else <a name="l00507"><a class="code" href="class_variablesstack.html#s2">00507</a></a> typedef std::vector<<a class="code" href="class_stackentry.html">StackEntry</a>> VariableStackStackType; 00508 #endif 00509 00510 enum { eDefaultStackSize = 100 }; 00511 00512 private: 00513 00521 bool 00522 elementFrameAlreadyPushed(const <a class="code" href="class_elemtemplateelement.html">ElemTemplateElement</a>* elem) const; 00523 00529 void 00530 push(const <a class="code" href="class_stackentry.html">StackEntry</a>& theEntry); 00531 00535 void 00536 pop(); 00537 00543 const <a class="code" href="class_stackentry.html">StackEntry</a>& 00544 back() const 00545 { 00546 assert(m_stack.empty() == false); 00547 00548 return m_stack.back(); 00549 } 00550 <a name="l00551"><a class="code" href="class_variablesstack.html#l0">00551</a></a> friend class CommitPushElementFrame; <a name="l00552"><a class="code" href="class_variablesstack.html#l1">00552</a></a> friend class EnsurePop; <a name="l00553"><a class="code" href="class_variablesstack.html#l2">00553</a></a> friend class PushParamFunctor; <a name="l00554"><a class="code" href="class_variablesstack.html#l3">00554</a></a> friend class SetAndRestoreForceGlobalSearch; 00555 00556 const <a class="code" href="class_xobjectptr.html">XObjectPtr</a> 00557 findXObject( 00558 const <a class="code" href="class_xalanqname.html">XalanQName</a>& name, 00559 <a class="code" href="class_stylesheetexecutioncontext.html">StylesheetExecutionContext</a>& executionContext, 00560 bool fIsParam, 00561 bool fSearchGlobalSpace, 00562 bool& fNameFound); 00563 00564 VariableStackStackType::size_type 00565 findEntry( 00566 const <a class="code" href="class_xalanqname.html">XalanQName</a>& name, 00567 bool fIsParam, 00568 bool fSearchGlobalSpace); 00569 00570 00571 VariableStackStackType m_stack; 00572 00573 int m_globalStackFrameIndex; 00574 00575 bool m_globalStackFrameMarked; 00576 00582 unsigned int m_currentStackFrameIndex; 00583 00589 RecursionGuardStackType m_guardStack; 00590 }; 00591 00592 00593 00594 #endif // #if !defined(XALAN_VARIABLESSTACK_HEADER_GUARD) </div></pre><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="images/dot.gif" width="1"></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.4</B><BR> Copyright © 2000, 2001, 2002 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"> </TD> </TR> </TABLE>