Xalan-C++ API Reference  1.12.0
XalanNode.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(XALANNODE_HEADER_GUARD_1357924680)
19 #define XALANNODE_HEADER_GUARD_1357924680
20 
21 
22 
24 
25 
26 
27 namespace XALAN_CPP_NAMESPACE {
28 
29 
30 
31 class XalanDOMString;
32 class XalanDocument;
33 class XalanNamedNodeMap;
34 class XalanNodeList;
35 
36 
37 
39 {
40 public:
41 
42  XalanNode();
43 
44  virtual
45  ~XalanNode();
46 
47  enum NodeType
48  {
49  UNKNOWN_NODE = 0,
50  ELEMENT_NODE = 1,
51  ATTRIBUTE_NODE = 2,
52  TEXT_NODE = 3,
53  CDATA_SECTION_NODE = 4,
54  ENTITY_REFERENCE_NODE = 5,
55  ENTITY_NODE = 6,
56  PROCESSING_INSTRUCTION_NODE = 7,
57  COMMENT_NODE = 8,
58  DOCUMENT_NODE = 9,
59  DOCUMENT_TYPE_NODE = 10,
60  DOCUMENT_FRAGMENT_NODE = 11,
61  NOTATION_NODE = 12
62  };
63 
64  typedef unsigned long IndexType;
65 
66  /**
67  * Gets the name of this node, depending on its type.
68  */
69  virtual const XalanDOMString&
70  getNodeName() const = 0;
71 
72  /**
73  * Gets the value of this node, depending on its type.
74  */
75  virtual const XalanDOMString&
76  getNodeValue() const = 0;
77 
78  /**
79  * An enum value representing the type of the underlying object.
80  */
81  virtual NodeType
82  getNodeType() const = 0;
83 
84  /**
85  * Gets the parent of this node.
86  *
87  * If there is no such node, this returns a null pointer.
88  */
89  virtual XalanNode*
90  getParentNode() const = 0;
91 
92  /**
93  * Gets a XalanNodeList that contains all children of this node.
94  *
95  * If there are no children, this is a XalanNodeList containing no nodes.
96  */
97  virtual const XalanNodeList*
98  getChildNodes() const = 0;
99 
100  /**
101  * Gets the first child of this node.
102  *
103  * If there is no such node, this returns a null pointer.
104  */
105  virtual XalanNode*
106  getFirstChild() const = 0;
107 
108  /**
109  * Gets the last child of this node.
110  *
111  * If there is no such node, this returns a null pointer.
112  */
113  virtual XalanNode*
114  getLastChild() const = 0;
115 
116  /**
117  * Gets the node immediately preceding this node.
118  *
119  * If there is no such node, this returns a null pointer.
120  */
121  virtual XalanNode*
122  getPreviousSibling() const = 0;
123 
124  /**
125  * Gets the node immediately following this node.
126  *
127  * If there is no such node, this returns a null pointer.
128  */
129  virtual XalanNode*
130  getNextSibling() const = 0;
131 
132  /**
133  * Gets a XalanNamedNodeMap containing the attributes of this node (if it
134  * is an XalanElement) or a null pointer otherwise.
135  */
136  virtual const XalanNamedNodeMap*
137  getAttributes() const = 0;
138 
139  /**
140  * Gets the XalanDocument object associated with this node. This may
141  * be a null pointer.
142  */
143  virtual XalanDocument*
144  getOwnerDocument() const = 0;
145 
146  /**
147  * Get the namespace URI of this node.
148  */
149  virtual const XalanDOMString&
150  getNamespaceURI() const = 0;
151 
152  /**
153  * Get the namespace prefix of this node.
154  */
155  virtual const XalanDOMString&
156  getPrefix() const = 0;
157 
158  /**
159  * Returns the local part of the qualified name of this node.
160  */
161  virtual const XalanDOMString&
162  getLocalName() const = 0;
163 
164  /**
165  * Determine if the document is node-order indexed.
166  *
167  * @return true if the document is indexed, otherwise false.
168  */
169  virtual bool
170  isIndexed() const = 0;
171 
172  /**
173  * Get the node's index. Valid only if the owner document
174  * reports that the document is node-order indexed.
175  *
176  * @return The index value, or 0 if the node is not indexed.
177  */
178  virtual IndexType
179  getIndex() const = 0;
180 
181 protected:
182 
183  XalanNode(const XalanNode& theSource);
184 
185  XalanNode&
186  operator=(const XalanNode& theSource);
187 
188  bool
189  operator==(const XalanNode& theRHS) const;
190 
191 private:
192 
193 #if !defined(NDEBUG)
194  static size_t s_instanceCount;
195 #endif
196 };
197 
198 
199 
200 }
201 
202 
203 
204 #endif // !defined(XALANNODE_HEADER_GUARD_1357924680)
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
xalanc::XalanNode::NodeType
NodeType
Definition: XalanNode.hpp:47
xalanc::XalanDocument
Definition: XalanDocument.hpp:36
xalanc::operator==
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
Definition: XalanVector.hpp:1118
xalanc::XalanNode::IndexType
unsigned long IndexType
Definition: XalanNode.hpp:64
xalanc::XalanNodeList
Definition: XalanNodeList.hpp:36
xalanc::XalanNamedNodeMap
Definition: XalanNamedNodeMap.hpp:36
XalanDOMDefinitions.hpp
XALAN_DOM_EXPORT
#define XALAN_DOM_EXPORT
Definition: XalanDOMDefinitions.hpp:37
xalanc::XalanDOMString
Definition: XalanDOMString.hpp:45