GroveNode — Base class for all XML grove nodes.
class GroveNode : : public RefCountedWrappedObjectSernaApi::RefCountedWrappedObject { public: enum NodeType { UNDEFINED_NODE = 0, ELEMENT_NODE = 1, ATTRIBUTE_NODE = 2, TEXT_NODE = 3, PI_NODE = 7, COMMENT_NODE = 8, DOCUMENT_NODE = 9, DOCUMENT_FRAGMENT_NODE = 11, MAX_DOM_NODETYPE = 12, MARKED_SECTION_START_NODE = 16, MARKED_SECTION_END_NODE = 24, ENTITY_REF_START_NODE = 17, ENTITY_REF_END_NODE = 25, REDLINE_START_NODE = 18, REDLINE_END_NODE = 26, DOCUMENT_PROLOG_NODE = 32, ENTITY_DECL_NODE, ELEMENT_DECL_NODE, ATTR_DECL_NODE, SSEP_NODE, CHOICE_NODE, MAX_NODETYPE }; // construct/copy/destruct GroveNode(SernaApiBase * = 0); ~GroveNode(); // public member functions NodeType nodeType() const; SString nodeName() const; GroveNode cloneNode(const bool, const GroveNode & = GroveNode()) const; GroveDocumentFragment takeAsFragment(const GroveNode & = GroveNode()) ; GroveDocumentFragment copyAsFragment(const GroveNode & = GroveNode()) const; Grove grove() const; GroveSectionRoot getGSR() const; void setGSR(const GroveSectionRoot &) ; GroveDocument document() const; void registerNodeWatcher(GroveNodeWatcher *, short = ~0) ; void deregisterNodeWatcher(GroveNodeWatcher *) ; void deregisterAllNodeWatchers() ; void dump() const; GroveNode firstChild() const; GroveNode lastChild() const; GroveNode getChild(int) const; int countChildren() const; void appendChild(const GroveNode &) ; void removeAllChildren() ; GroveNode nextSibling() const; GroveNode prevSibling() const; GroveNode parent() const; GroveNode root() const; void remove() ; void insertBefore(const GroveNode &) ; void insertAfter(const GroveNode &) ; void removeGroup(const GroveNode &) ; int siblingIndex() const; SString getTreelocString(const GroveNode & = GroveNode()) const; GroveNode getByTreelocString(const SString &) const; GroveSectionRoot asGroveSectionRoot() const; GroveDocument asGroveDocument() const; GroveDocumentFragment asGroveDocumentFragment() const; GroveNodeWithNamespace asGroveNodeWithNamespace() const; GroveElement asGroveElement() const; GroveAttr asGroveAttr() const; GroveText asGroveText() const; GroveComment asGroveComment() const; GrovePi asGrovePi() const; GroveErs asGroveErs() const; GroveEre asGroveEre() const; bool isReadOnly() const; void setReadOnly(bool, bool = true) ; GroveErs getErs() const; };
GroveNode
public member functionsReturns the type of the node.
SString nodeName() const;
Returns name of the node.
GroveNode cloneNode(const bool deep, const GroveNode & futureParent = GroveNode()) const;
Create (possibly deep) copy of a node, setting new parent, if needed. Please note that with this method you can only safely copy nodes which are not section nodes and whose chidlren does not contain any sections or entity references. If in doubt, use copyAsFragment() instead. futureParent is used to determine proper context when copying special nodes (entity refs etc), and is optional for other node types.
GroveDocumentFragment takeAsFragment(const GroveNode & endNode = GroveNode()) ;
Take nodes from current node to the endNode inclusive and move them into created DocumentFragment. Nodes must be on the same level (be the children of the same parent) and must not cross grove section boundaries. If any of these conditions occur, this function will do nothing and return 0.
GroveDocumentFragment copyAsFragment(const GroveNode & endNode = GroveNode()) const;
Same as takeAsFragment(), but does deep copy of the nodes instead of moving them to DocumentFragment.
Grove grove() const;
Returns governing grove.
GroveSectionRoot getGSR() const;
Returns GroveSectionRoot for this node.
Change governing GSR for the current node and it's children.
GroveDocument document() const;
Returns pointer to the governing document.
Register a NodeWatcher on a node. If visitor is already there, it is not added, but it's bitmask is OR'ed.
De-register a NodeWatcher.
Clean up node from all node visitors.
Dumps node.
GroveNode firstChild() const;
GroveNode lastChild() const;
GroveNode getChild(int n) const;
GroveNode nextSibling() const;
GroveNode prevSibling() const;
GroveNode parent() const;
GroveNode root() const;
SString getTreelocString(const GroveNode & = GroveNode()) const;
GroveNode getByTreelocString(const SString & ) const;
GroveSectionRoot asGroveSectionRoot() const;
Downcasts to GroveSectionRoot.
GroveDocument asGroveDocument() const;
Downcasts to GroveDocument.
GroveDocumentFragment asGroveDocumentFragment() const;
Downcasts to GroveDocumentFragment.
GroveNodeWithNamespace asGroveNodeWithNamespace() const;
Downcasts to GroveNodeWithNamespace.
GroveElement asGroveElement() const;
Downcasts to GroveElement.
GroveAttr asGroveAttr() const;
Downcasts to GroveAttr.
GroveText asGroveText() const;
Downcasts to GroveText.
GroveComment asGroveComment() const;
Downcasts to GroveComment.
GrovePi asGrovePi() const;
Downcasts to GrovePi.
GroveErs asGroveErs() const;
Downcasts to GroveErs (Entity Reference Start node).
GroveEre asGroveEre() const;
Downcasts to GroveEre (Entity Reference End node).
Check whether the content of this node is read-only.
Set the read-only status for the content of node.
GroveErs getErs() const;
Get current entity context.