Xalan-C++ API Reference  1.12.0
ElemUse.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_ELEMUSE_HEADER_GUARD)
19 #define XALAN_ELEMUSE_HEADER_GUARD
20 
21 
22 
23 // Base include file. Must be first.
24 #include "XSLTDefinitions.hpp"
25 
26 
27 
28 // Base class header file.
29 #include "ElemTemplateElement.hpp"
30 
31 
32 
33 namespace XALAN_CPP_NAMESPACE {
34 
35 
36 
38 {
39 public:
40 
41  typedef std::size_t size_type;
42 
43  /**
44  * Construct an object corresponding to an "use-attribute-sets" attribute.
45  * This is a base class for "xsl:element," "xsl:copy" and
46  * "xsl:attribute-set" elements, which may specify attribute sets to use.
47  *
48  * @param constructionContext context for construction of object
49  * @param stylesheetTree stylesheet containing element
50  * @param atts list of attributes for element
51  * @param lineNumber line number in document
52  * @param columnNumber column number in document
53  */
54  ElemUse(
55  StylesheetConstructionContext& constructionContext,
56  Stylesheet& stylesheetTree,
57  XalanFileLoc lineNumber,
58  XalanFileLoc columnNumber,
59  int xslToken);
60 
61  virtual
62  ~ElemUse();
63 
64  /**
65  * See if this is a use-attribute-sets attribute, and, if so, process it.
66  *
67  * @param attrName qualified name of attribute
68  * @param atts attribute list where the element comes from (not used at
69  * this time)
70  * @param which index into the attribute list (not used at this time)
71  * @return true if this is a use-attribute-sets attribute
72  */
73  bool
74  processUseAttributeSets(
75  StylesheetConstructionContext& constructionContext,
76  const XalanDOMChar* attrName,
77  const AttributeListType& atts,
78  XalanSize_t which);
79 
80  // These methods are inherited from ElemTemplateElement ...
81 
82  virtual const XalanDOMString&
83  getElementName() const;
84 
85  virtual void
86  postConstruction(
87  StylesheetConstructionContext& constructionContext,
88  const NamespacesHandler& theParentHandler);
89 
90 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
91  virtual const ElemTemplateElement*
92  startElement(StylesheetExecutionContext& executionContext) const;
93 
94  virtual void
95  endElement(StylesheetExecutionContext& executionContext) const;
96 
97  virtual const ElemTemplateElement*
98  getNextChildElemToExecute(
99  StylesheetExecutionContext& executionContext,
100  const ElemTemplateElement* currentElem) const;
101 
102  virtual const ElemTemplateElement*
103  getFirstChildElemToExecute(
104  StylesheetExecutionContext& executionContext) const;
105 #else
106  virtual void
107  execute(StylesheetExecutionContext& executionContext) const;
108 #endif
109 
110 
111 protected:
112 
113 #if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
114  /**
115  * Get the next attribute set to execute.
116  *
117  * @param executionContext context to execute this element
118  * @returns a pointer to the attribute set element, 0 if no more attribute sets
119  */
120  const ElemTemplateElement*
121  getNextAttributeSet(
122  StylesheetExecutionContext& executionContext) const;
123 
124  /**
125  * Evalute the AVTs for this element
126  *
127  * @param executionContext context to execute this element
128  */
129  virtual void
130  evaluateAVTs(
131  StylesheetExecutionContext& executionContext) const;
132 #else
133  /**
134  * Execute and conditionally apply any attribute sets. To be used
135  * by deriving classes who want ElemUse to do any default execution
136  * but skip applying attribute sets. Typically, this would be done
137  * when attempting to recover from an error.
138  *
139  * @param executionContext The current execution context.
140  * @param applyAttributeSets If true, attribute sets will be applied.
141  */
142  virtual void
143  doExecute(
144  StylesheetExecutionContext& executionContext,
145  bool applyAttributeSets) const;
146 #endif
147 
148 private:
149 
150  const XalanQName** m_attributeSetsNames;
151 
152  size_type m_attributeSetsNamesCount;
153 };
154 
155 
156 
157 }
158 
159 
160 
161 #endif // XALAN_ELEMUSE_HEADER_GUARD
XALAN_CPP_NAMESPACE
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Definition: XalanVersion.hpp:76
xalanc::ElemUse::size_type
std::size_t size_type
Definition: ElemUse.hpp:41
xalanc::AttributeListType
xercesc::AttributeList AttributeListType
Definition: AttributeListImpl.hpp:41
xalanc::StylesheetExecutionContext
Definition: StylesheetExecutionContext.hpp:106
xalanc::ElemTemplateElement
Definition: ElemTemplateElement.hpp:79
xalanc::NamespacesHandler
Definition: NamespacesHandler.hpp:52
xalanc::StylesheetConstructionContext
Definition: StylesheetConstructionContext.hpp:83
ElemTemplateElement.hpp
xalanc::ElemUse
Definition: ElemUse.hpp:37
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::XalanDOMString
Definition: XalanDOMString.hpp:45