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  */
55  StylesheetConstructionContext& constructionContext,
56  Stylesheet& stylesheetTree,
57  XalanFileLoc lineNumber,
58  XalanFileLoc columnNumber,
59  int xslToken);
60 
61  virtual
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
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
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*
99  StylesheetExecutionContext& executionContext,
100  const ElemTemplateElement* currentElem) const;
101 
102  virtual const ElemTemplateElement*
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*
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
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
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
std::size_t size_type
Definition: ElemUse.hpp:41
virtual const ElemTemplateElement * getNextChildElemToExecute(StylesheetExecutionContext &executionContext, const ElemTemplateElement *currentElem) const
Returns the next sub-element (i.e.
virtual void endElement(StylesheetExecutionContext &executionContext) const
Completes "post-processing" afer any sub-elements are invoked (i.e.
const ElemTemplateElement * getNextAttributeSet(StylesheetExecutionContext &executionContext) const
Get the next attribute set to execute.
virtual void postConstruction(StylesheetConstructionContext &constructionContext, const NamespacesHandler &theParentHandler)
Called after construction is completed.
virtual void evaluateAVTs(StylesheetExecutionContext &executionContext) const
Evalute the AVTs for this element.
virtual const ElemTemplateElement * startElement(StylesheetExecutionContext &executionContext) const
Completes "pre-processing" before any sub-elements are invoked (i.e.
ElemUse(StylesheetConstructionContext &constructionContext, Stylesheet &stylesheetTree, XalanFileLoc lineNumber, XalanFileLoc columnNumber, int xslToken)
Construct an object corresponding to an "use-attribute-sets" attribute.
virtual const ElemTemplateElement * getFirstChildElemToExecute(StylesheetExecutionContext &executionContext) const
Returns the first sub-element (i.e.
bool processUseAttributeSets(StylesheetConstructionContext &constructionContext, const XalanDOMChar *attrName, const AttributeListType &atts, XalanSize_t which)
See if this is a use-attribute-sets attribute, and, if so, process it.
virtual const XalanDOMString & getElementName() const
Get a string for the name of the element.
virtual ~ElemUse()
This class represents the base stylesheet or an "import" stylesheet.
Definition: Stylesheet.hpp:87
Class to represent a qualified name.
Definition: XalanQName.hpp:71
xercesc::AttributeList AttributeListType