Xalan-C++ API Reference  1.12.0
ElemVariable.hpp
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 #if !defined(XALAN_ELEMVARIABLE_HEADER_GUARD)
19 #define XALAN_ELEMVARIABLE_HEADER_GUARD
20 
21 
22 
23 // Base include file. Must be first.
24 #include "XSLTDefinitions.hpp"
25 
26 // Base class header file.
27 #include "ElemTemplateElement.hpp"
28 
29 
30 
31 #include <xalanc/XPath/XObject.hpp>
32 
33 
34 
36 
37 
38 
39 namespace XALAN_CPP_NAMESPACE {
40 
41 
42 
43 class XPath;
44 
45 
46 
48 {
49 public:
50 
52 
53  /**
54  * Construct an object corresponding to an "xsl:variable" element
55  *
56  * @param constructionContext context for construction of object
57  * @param stylesheetTree stylesheet containing element
58  * @param atts list of attributes for element
59  * @param lineNumber line number in document
60  * @param columnNumber column number in document
61  */
63  StylesheetConstructionContext& constructionContext,
64  Stylesheet& stylesheetTree,
65  const AttributeListType& atts,
66  XalanFileLoc lineNumber,
67  XalanFileLoc columnNumber);
68 
69  virtual
71 
72  /**
73  * Determines if this is a top level variable.
74  *
75  * @return true if it is a top level variable
76  */
77  bool
78  isTopLevel() const
79  {
80  return m_isTopLevel;
81  }
82 
83  // These methods are inherited from ElemTemplateElement ...
84 
85  virtual const XalanQName&
87 
88  virtual void
90  StylesheetConstructionContext& constructionContext,
91  Stylesheet& theStylesheet);
92 
93  virtual const XalanDOMString&
94  getElementName() const;
95 
96 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
97  const ElemTemplateElement*
98  startElement(StylesheetExecutionContext& executionContext) const;
99 
100  void
101  endElement(StylesheetExecutionContext& executionContext) const;
102 #else
103  virtual void
104  execute(StylesheetExecutionContext& executionContext) const;
105 #endif
106 
107  const XObjectPtr
109  StylesheetExecutionContext& executionContext,
110  XalanNode* sourceNode) const;
111 
112  virtual void
114 
115  virtual const XPath*
116  getXPath(XalanSize_t index) const;
117 
118 protected:
119 
120  /**
121  * Construct an object corresponding to an "xsl:variable" element
122  *
123  * @param constructionContext context for construction of object
124  * @param stylesheetTree stylesheet containing element
125  * @param atts list of attributes for element
126  * @param lineNumber line number in document
127  * @param columnNumber column number in document
128  */
130  StylesheetConstructionContext& constructionContext,
131  Stylesheet& stylesheetTree,
132  const AttributeListType& atts,
133  XalanFileLoc lineNumber,
134  XalanFileLoc columnNumber,
135  int xslToken);
136 
137  /**
138  * Do common initialization.
139  *
140  * @param constructionContext context for construction of object
141  * @param stylesheetTree stylesheet containing element
142  * @param atts list of attributes for element
143  */
144  void
146  StylesheetConstructionContext& constructionContext,
147  Stylesheet& stylesheetTree,
148  const AttributeListType& atts);
149 
150 
152 
153 private:
154 
155  // not implemented
156  ElemVariable(const ElemVariable &);
157 
158  ElemVariable&
159  operator=(const ElemVariable &);
160 
161  const XPath* m_selectPattern;
162 
163  bool m_isTopLevel;
164 
165  XObjectPtr m_value;
166 
167  XalanNode* m_varContext;
168 };
169 
170 
171 
172 }
173 
174 
175 
176 #endif // XALAN_ELEMVARIABLE_HEADER_GUARD
xalanc::ElemVariable::ElemVariable
ElemVariable(StylesheetConstructionContext &constructionContext, Stylesheet &stylesheetTree, const AttributeListType &atts, XalanFileLoc lineNumber, XalanFileLoc columnNumber, int xslToken)
Construct an object corresponding to an "xsl:variable" element.
XALAN_CPP_NAMESPACE
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Definition: XalanVersion.hpp:76
xalanc::AttributeListType
xercesc::AttributeList AttributeListType
Definition: AttributeListImpl.hpp:41
xalanc::ElemVariable::ElemVariable
ElemVariable(StylesheetConstructionContext &constructionContext, Stylesheet &stylesheetTree, const AttributeListType &atts, XalanFileLoc lineNumber, XalanFileLoc columnNumber)
Construct an object corresponding to an "xsl:variable" element.
xalanc::StylesheetExecutionContext
Definition: StylesheetExecutionContext.hpp:107
xalanc::XalanNode
Definition: XalanNode.hpp:39
xalanc::ElemVariable::~ElemVariable
virtual ~ElemVariable()
xalanc::ElemVariable::addToStylesheet
virtual void addToStylesheet(StylesheetConstructionContext &constructionContext, Stylesheet &theStylesheet)
Called during compilation when an instance is not parented by another element, and thus,...
xalanc::XPath
Definition: XPath.hpp:68
xalanc::ElemTemplateElement
Definition: ElemTemplateElement.hpp:80
xalanc::ElemVariable::ParentType
ElemTemplateElement ParentType
Definition: ElemVariable.hpp:51
xalanc::ElemVariable::init
void init(StylesheetConstructionContext &constructionContext, Stylesheet &stylesheetTree, const AttributeListType &atts)
Do common initialization.
xalanc::XObjectPtr
Class to hold XObjectPtr return types.
Definition: XObject.hpp:884
xalanc::ElemVariable::isTopLevel
bool isTopLevel() const
Determines if this is a top level variable.
Definition: ElemVariable.hpp:78
xalanc::ElemVariable::setParentNodeElem
virtual void setParentNodeElem(ElemTemplateElement *theParent)
Set the parent node.
xalanc::StylesheetConstructionContext
Definition: StylesheetConstructionContext.hpp:84
xalanc::ElemVariable::startElement
const ElemTemplateElement * startElement(StylesheetExecutionContext &executionContext) const
Completes "pre-processing" before any sub-elements are invoked (i.e.
Constants.hpp
ElemTemplateElement.hpp
xalanc::ElemVariable
Definition: ElemVariable.hpp:48
xalanc::ElemVariable::getNameAttribute
virtual const XalanQName & getNameAttribute() const
Get the QName associated with any name attribute of this element.
xalanc::ElemVariable::getXPath
virtual const XPath * getXPath(XalanSize_t index) const
Get XPath pattern/expression of one of the element atribute.
XSLTDefinitions.hpp
xalanc::ElemVariable::getElementName
virtual const XalanDOMString & getElementName() const
Get a string for the name of the element.
xalanc::ElemVariable::getValue
const XObjectPtr getValue(StylesheetExecutionContext &executionContext, XalanNode *sourceNode) const
xalanc::Stylesheet
This class represents the base stylesheet or an "import" stylesheet.
Definition: Stylesheet.hpp:87
xalanc::XalanQName
Class to represent a qualified name.
Definition: XalanQName.hpp:71
xalanc::ElemVariable::m_qname
const XalanQName * m_qname
Definition: ElemVariable.hpp:151
xalanc::XalanDOMString
Definition: XalanDOMString.hpp:46
xalanc::ElemVariable::endElement
void endElement(StylesheetExecutionContext &executionContext) const
Completes "post-processing" afer any sub-elements are invoked (i.e.
XObject.hpp