Xalan-C++ API Reference  1.12.0
XalanSourceTreeElement.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(XALANSOURCETREEELEMENT_HEADER_GUARD_1357924680)
19 #define XALANSOURCETREEELEMENT_HEADER_GUARD_1357924680
20 
21 
22 
24 
25 
26 
30 
31 
32 
33 namespace XALAN_CPP_NAMESPACE {
34 
35 
36 
37 class XalanSourceTreeAttr;
38 class XalanSourceTreeComment;
39 class XalanSourceTreeDocument;
40 class XalanSourceTreeDocumentFragment;
41 class XalanSourceTreeProcessingInstruction;
42 class XalanSourceTreeText;
43 
44 
45 
47 {
48 public:
49 
50  /**
51  * Constructor.
52  *
53  * @param theTagName The tag name of the element
54  * @param theOwnerDocument The document that owns the instance
55  * @param theAttributes An array of pointers to the attribute instances for the element
56  * @param theAttributeCount The number of attributes.
57  * @param theParentNode The parent node, if any.
58  * @param thePreviousSibling The previous sibling, if any.
59  * @param theNextSibling The next sibling, if any.
60  * @param theIndex The document-order index of the node.
61  */
63  MemoryManager& theManager,
64  const XalanDOMString& theTagName,
65  XalanSourceTreeDocument* theOwnerDocument,
66  XalanNode* theParentNode = 0,
67  XalanNode* thePreviousSibling = 0,
68  XalanNode* theNextSibling = 0,
69  IndexType theIndex = 0);
70 
71  virtual
73 
74  MemoryManager&
76  {
77  return m_memoryManager;
78  }
79 
80  // These interfaces are inherited from XalanElement...
81 
82  virtual const XalanDOMString&
83  getNodeName() const;
84 
85  virtual const XalanDOMString&
86  getNodeValue() const;
87 
88  virtual NodeType
89  getNodeType() const;
90 
91  virtual XalanNode*
92  getParentNode() const;
93 
94  virtual const XalanNodeList*
95  getChildNodes() const;
96 
97  virtual XalanNode*
98  getFirstChild() const;
99 
100  virtual XalanNode*
101  getLastChild() const;
102 
103  virtual XalanNode*
104  getPreviousSibling() const;
105 
106  virtual XalanNode*
107  getNextSibling() const;
108 
109  virtual const XalanNamedNodeMap*
110  getAttributes() const = 0;
111 
112  virtual XalanDocument*
113  getOwnerDocument() const;
114 
115  virtual const XalanDOMString&
116  getNamespaceURI() const = 0;
117 
118  virtual const XalanDOMString&
119  getPrefix() const = 0;
120 
121  virtual const XalanDOMString&
122  getLocalName() const = 0;
123 
124  virtual bool
125  isIndexed() const;
126 
127  virtual IndexType
128  getIndex() const;
129 
130  virtual const XalanDOMString&
131  getTagName() const;
132 
133  // public interfaces not inherited from XalanElement...
134 
136  getDocument() const
137  {
138  return m_ownerDocument;
139  }
140 
141  void
143  {
144  m_parentNode = theParent;
145  }
146 
147  void
148  setParent(XalanSourceTreeDocumentFragment* theParent);
149 
150  void
151  setPreviousSibling(XalanSourceTreeComment* thePreviousSibling);
152 
153  void
154  setPreviousSibling(XalanSourceTreeElement* thePreviousSibling);
155 
156  void
157  setPreviousSibling(XalanSourceTreeProcessingInstruction* thePreviousSibling);
158 
159  void
160  setPreviousSibling(XalanSourceTreeText* thePreviousSibling);
161 
162  void
163  appendSiblingNode(XalanSourceTreeComment* theSibling);
164 
165  void
166  appendSiblingNode(XalanSourceTreeElement* theSibling);
167 
168  void
169  appendSiblingNode(XalanSourceTreeProcessingInstruction* theSibling);
170 
171  void
172  appendSiblingNode(XalanSourceTreeText* theSibling);
173 
174  void
175  appendChildNode(XalanSourceTreeComment* theChild);
176 
177  void
178  appendChildNode(XalanSourceTreeElement* theChild);
179 
180  void
181  appendChildNode(XalanSourceTreeProcessingInstruction* theChild);
182 
183  void
184  appendChildNode(XalanSourceTreeText* theChild);
185 
186  void
187  setIndex(IndexType theIndex)
188  {
189  m_index = theIndex;
190  }
191 
192  /**
193  * Removes all of the children. Since the owner document controls the
194  * lifetime of all nodes in the document, this just sets the first child
195  * to 0.
196  */
197  void
199  {
200  m_firstChild = 0;
201  }
202 
203 protected:
204 
205  /*
206  XalanSourceTreeElement(
207  MemoryManager& theManager,
208  const XalanSourceTreeElement& theSource,
209  bool deep = false);
210  */
212 
213  // Data members...
215 
216 private:
217 
218  // Not implemented...
220 
222  operator=(const XalanSourceTreeElement& theSource);
223 
224  bool
225  operator==(const XalanSourceTreeElement& theRHS) const;
226 
227 
228  // Data members...
229  MemoryManager& m_memoryManager;
230 
231  XalanSourceTreeDocument* m_ownerDocument;
232 
233  XalanNode* m_parentNode;
234 
235  XalanNode* m_previousSibling;
236 
237  XalanNode* m_nextSibling;
238 
239  XalanNode* m_firstChild;
240 
241  IndexType m_index;
242 };
243 
244 
245 
246 }
247 
248 
249 
250 #endif // !defined(XALANSOURCETREEELEMENT_HEADER_GUARD_1357924680)
xalanc::XalanSourceTreeElement::getDocument
XalanSourceTreeDocument * getDocument() const
Definition: XalanSourceTreeElement.hpp:136
xalanc::XalanSourceTreeDocumentFragment
Definition: XalanSourceTreeDocumentFragment.hpp:49
XALAN_CPP_NAMESPACE
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Definition: XalanVersion.hpp:76
xalanc::XalanNode
Definition: XalanNode.hpp:38
XalanElement.hpp
XalanDOMString.hpp
xalanc::XalanSourceTreeElement::setParent
void setParent(XalanSourceTreeElement *theParent)
Definition: XalanSourceTreeElement.hpp:142
xalanc::XalanDocument
Definition: XalanDocument.hpp:36
xalanc::operator==
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
Definition: XalanVector.hpp:1118
xalanc::XalanSourceTreeElement::m_tagName
const XalanDOMString & m_tagName
Definition: XalanSourceTreeElement.hpp:214
xalanc::XalanSourceTreeElement::clearChildren
void clearChildren()
Removes all of the children.
Definition: XalanSourceTreeElement.hpp:198
xalanc::XalanNode::IndexType
unsigned long IndexType
Definition: XalanNode.hpp:64
xalanc::XalanSourceTreeComment
Definition: XalanSourceTreeComment.hpp:47
xalanc::XalanSourceTreeElement::getMemoryManager
MemoryManager & getMemoryManager()
Definition: XalanSourceTreeElement.hpp:75
xalanc::XalanNodeList
Definition: XalanNodeList.hpp:36
XalanSourceTreeDefinitions.hpp
xalanc::XalanSourceTreeElement::s_emptyString
static const XalanDOMString s_emptyString
Definition: XalanSourceTreeElement.hpp:211
XalanNamedNodeMap.hpp
xalanc::XalanElement
Definition: XalanElement.hpp:44
xalanc::XalanNamedNodeMap
Definition: XalanNamedNodeMap.hpp:36
xalanc::XalanSourceTreeText
Definition: XalanSourceTreeText.hpp:46
XALAN_XALANSOURCETREE_EXPORT
#define XALAN_XALANSOURCETREE_EXPORT
Definition: XalanSourceTreeDefinitions.hpp:35
xalanc::XalanSourceTreeElement
Definition: XalanSourceTreeElement.hpp:46
xalanc::XalanSourceTreeElement::setIndex
void setIndex(IndexType theIndex)
Definition: XalanSourceTreeElement.hpp:187
xalanc::XalanDOMString
Definition: XalanDOMString.hpp:45
xalanc::XalanSourceTreeDocument
Definition: XalanSourceTreeDocument.hpp:78
xalanc::XalanSourceTreeProcessingInstruction
Definition: XalanSourceTreeProcessingInstruction.hpp:47