@@ -39,6 +39,7 @@ class Context;
3939class Element ;
4040class ElementDocument ;
4141class NodeInstancer ;
42+ class NodePtrProxy ;
4243using OwnedNodeList = Vector<NodePtr>;
4344
4445/* *
@@ -62,34 +63,43 @@ class RMLUICORE_API Node : public ScriptInterface {
6263 // / @return True if the node has at least one DOM child, false otherwise.
6364 bool HasChildNodes () const ;
6465
66+ // / Returns the first child of this node.
67+ // / @return This node's first child, or nullptr if it contains no children.
68+ Node* GetFirstChild () const ;
69+ // / Gets the last child of this node.
70+ // / @return This node's last child, or nullptr if it contains no children.
71+ Node* GetLastChild () const ;
72+ // / Gets the node immediately following this one in the tree.
73+ // / @return This node's next sibling node, or nullptr if there is no sibling node.
74+ Node* GetNextSibling () const ;
75+ // / Gets the node immediately preceding this one in the tree.
76+ // / @return This node's previous sibling node, or nullptr if there is no sibling node.
77+ Node* GetPreviousSibling () const ;
78+
6579 // / Append a child to this node.
6680 // / @param[in] node The node to append as a child.
6781 // / @param[in] dom_node True if the node is to be part of the DOM, false otherwise. Only set this to false if you know what you're doing!
6882 // / @return A pointer to the just inserted node.
69- Node* AppendChild (NodePtr node, bool dom_node = true );
70- [[deprecated(" Use the NodePtr version of this function" )]] Element* AppendChild (ElementPtr element, bool dom_element = true );
83+ Node* AppendChild (NodePtrProxy node, bool dom_node = true );
7184 // / Adds a child to this node directly before the adjacent node. The new node inherits the DOM/non-DOM
7285 // / status from the adjacent node.
7386 // / @param[in] node Node to be inserted.
7487 // / @param[in] adjacent_node The reference node which the new node will be inserted before.
7588 // / @return A pointer to the just inserted node.
76- Node* InsertBefore (NodePtr node, Node* adjacent_node);
77- [[deprecated(" Use the NodePtr version of this function" )]] Element* InsertBefore (ElementPtr element, Element* adjacent_element);
89+ Node* InsertBefore (NodePtrProxy node, Node* adjacent_node);
7890 // / Replaces the second node with the first node.
7991 // / @param[in] inserted_node The node that will be inserted and replace the other node.
8092 // / @param[in] replaced_node The existing node that will be replaced. If this doesn't exist, inserted_node will be appended.
8193 // / @return A unique pointer to the replaced node if found, discard the result to immediately destroy.
82- NodePtr ReplaceChild (NodePtr inserted_node, Node* replaced_node);
83- [[deprecated(" Use the NodePtr version of this function" )]] ElementPtr ReplaceChild (ElementPtr inserted_element, Element* replaced_element);
94+ NodePtr ReplaceChild (NodePtrProxy inserted_node, Node* replaced_node);
8495 // / Remove a child node from this node.
8596 // / @param[in] node The node to remove.
8697 // / @return A unique pointer to the node if found, discard the result to immediately destroy.
8798 NodePtr RemoveChild (Node* node);
88- [[deprecated(" Use the NodePtr version of this function" )]] ElementPtr RemoveChild (Element* element);
8999
90100 // / Gets this nodes's parent node.
91101 // / @return This node's parent.
92- [[deprecated( " Use GetParentElement " )]] Element * GetParentNode () const ;
102+ Node * GetParentNode () const ;
93103 // / Gets this nodes's parent element.
94104 // / @return This node's parent if it is an element, otherwise false.
95105 Element* GetParentElement () const ;
@@ -311,6 +321,18 @@ class RMLUICORE_API Node : public ScriptInterface {
311321 friend class Rml ::Context;
312322};
313323
324+ class RMLUICORE_API NodePtrProxy {
325+ public:
326+ NodePtrProxy (NodePtr node);
327+ NodePtrProxy (ElementPtr element);
328+ Node* Get ();
329+ NodePtr Extract ();
330+ explicit operator bool () const ;
331+
332+ private:
333+ NodePtr node;
334+ };
335+
314336} // namespace Rml
315337
316338#endif
0 commit comments