1 | // |
2 | // AbstractContainerNode.h |
3 | // |
4 | // Library: XML |
5 | // Package: DOM |
6 | // Module: DOM |
7 | // |
8 | // Definition of the AbstractContainerNode class. |
9 | // |
10 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. |
11 | // and Contributors. |
12 | // |
13 | // SPDX-License-Identifier: BSL-1.0 |
14 | // |
15 | |
16 | |
17 | #ifndef DOM_AbstractContainerNode_INCLUDED |
18 | #define DOM_AbstractContainerNode_INCLUDED |
19 | |
20 | |
21 | #include "Poco/XML/XML.h" |
22 | #include "Poco/DOM/AbstractNode.h" |
23 | |
24 | |
25 | namespace Poco { |
26 | namespace XML { |
27 | |
28 | |
29 | class XML_API AbstractContainerNode: public AbstractNode |
30 | /// AbstractContainerNode is an implementation of Node |
31 | /// that stores and manages child nodes. |
32 | /// |
33 | /// Child nodes are organized in a single linked list. |
34 | { |
35 | public: |
36 | // Node |
37 | Node* firstChild() const; |
38 | Node* lastChild() const; |
39 | Node* insertBefore(Node* newChild, Node* refChild); |
40 | Node* replaceChild(Node* newChild, Node* oldChild); |
41 | Node* removeChild(Node* oldChild); |
42 | Node* appendChild(Node* newChild); |
43 | bool hasChildNodes() const; |
44 | bool hasAttributes() const; |
45 | Node* getNodeByPath(const XMLString& path) const; |
46 | Node* getNodeByPathNS(const XMLString& path, const NSMap& nsMap) const; |
47 | |
48 | protected: |
49 | AbstractContainerNode(Document* pOwnerDocument); |
50 | AbstractContainerNode(Document* pOwnerDocument, const AbstractContainerNode& node); |
51 | ~AbstractContainerNode(); |
52 | |
53 | void dispatchNodeRemovedFromDocument(); |
54 | void dispatchNodeInsertedIntoDocument(); |
55 | |
56 | static const Node* findNode(XMLString::const_iterator& it, const XMLString::const_iterator& end, const Node* pNode, const NSMap* pNSMap); |
57 | static const Node* findElement(const XMLString& name, const Node* pNode, const NSMap* pNSMap); |
58 | static const Node* findElement(int index, const Node* pNode, const NSMap* pNSMap); |
59 | static const Node* findElement(const XMLString& attr, const XMLString& value, const Node* pNode, const NSMap* pNSMap); |
60 | static const Attr* findAttribute(const XMLString& name, const Node* pNode, const NSMap* pNSMap); |
61 | bool hasAttributeValue(const XMLString& name, const XMLString& value, const NSMap* pNSMap) const; |
62 | static bool namesAreEqual(const Node* pNode1, const Node* pNode2, const NSMap* pNSMap); |
63 | static bool namesAreEqual(const Node* pNode, const XMLString& name, const NSMap* pNSMap); |
64 | |
65 | static const XMLString WILDCARD; |
66 | |
67 | private: |
68 | AbstractNode* _pFirstChild; |
69 | |
70 | friend class AbstractNode; |
71 | friend class NodeAppender; |
72 | }; |
73 | |
74 | |
75 | } } // namespace Poco::XML |
76 | |
77 | |
78 | #endif // DOM_AbstractContainerNode_INCLUDED |
79 | |