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
70  ~ElemVariable();
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&
86  getNameAttribute() const;
87 
88  virtual void
89  addToStylesheet(
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
108  getValue(
109  StylesheetExecutionContext& executionContext,
110  XalanNode* sourceNode) const;
111 
112  virtual void
113  setParentNodeElem(ElemTemplateElement* theParent);
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  */
129  ElemVariable(
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
145  init(
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
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::StylesheetExecutionContext
Definition: StylesheetExecutionContext.hpp:106
xalanc::XalanNode
Definition: XalanNode.hpp:38
xalanc::XPath
Definition: XPath.hpp:67
xalanc::ElemTemplateElement
Definition: ElemTemplateElement.hpp:79
xalanc::ElemVariable::ParentType
ElemTemplateElement ParentType
Definition: ElemVariable.hpp:51
xalanc::XObjectPtr
Class to hold XObjectPtr return types.
Definition: XObject.hpp:883
xalanc::ElemVariable::isTopLevel
bool isTopLevel() const
Determines if this is a top level variable.
Definition: ElemVariable.hpp:78
xalanc::StylesheetConstructionContext
Definition: StylesheetConstructionContext.hpp:83
Constants.hpp
ElemTemplateElement.hpp
xalanc::ElemVariable
Definition: ElemVariable.hpp:47
XSLTDefinitions.hpp
xalanc::Stylesheet
This class represents the base stylesheet or an "import" stylesheet.
Definition: Stylesheet.hpp:86
xalanc::XalanQName
Class to represent a qualified name.
Definition: XalanQName.hpp:70
xalanc::ElemVariable::m_qname
const XalanQName * m_qname
Definition: ElemVariable.hpp:151
xalanc::XalanDOMString
Definition: XalanDOMString.hpp:45
XObject.hpp