Name

GroveNode — Base class for all XML grove nodes.

Synopsis

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;
};

Description

GroveNode construct/copy/destruct

  1. GroveNode(SernaApiBase * = 0);


  2. ~GroveNode();


GroveNode public member functions

  1. NodeType nodeType() const;

    Returns the type of the node.


  2. SString nodeName() const;

    Returns name of the node.


  3. 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.


  4. 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.


  5. GroveDocumentFragment copyAsFragment(const GroveNode & endNode = GroveNode()) const;

    Same as takeAsFragment(), but does deep copy of the nodes instead of moving them to DocumentFragment.


  6. Grove grove() const;

    Returns governing grove.


  7. GroveSectionRoot getGSR() const;

    Returns GroveSectionRoot for this node.


  8. void setGSR(const GroveSectionRoot & ) ;

    Change governing GSR for the current node and it's children.


  9. GroveDocument document() const;

    Returns pointer to the governing document.


  10. void registerNodeWatcher(GroveNodeWatcher * nv, short bitmask = ~0) ;

    Register a NodeWatcher on a node. If visitor is already there, it is not added, but it's bitmask is OR'ed.


  11. void deregisterNodeWatcher(GroveNodeWatcher * nv) ;

    De-register a NodeWatcher.


  12. void deregisterAllNodeWatchers() ;

    Clean up node from all node visitors.


  13. void dump() const;

    Dumps node.


  14. GroveNode firstChild() const;


  15. GroveNode lastChild() const;


  16. GroveNode getChild(int n) const;


  17. int countChildren() const;


  18. void appendChild(const GroveNode & ) ;


  19. void removeAllChildren() ;


  20. GroveNode nextSibling() const;


  21. GroveNode prevSibling() const;


  22. GroveNode parent() const;


  23. GroveNode root() const;


  24. void remove() ;


  25. void insertBefore(const GroveNode & ) ;


  26. void insertAfter(const GroveNode & ) ;


  27. void removeGroup(const GroveNode & ) ;


  28. int siblingIndex() const;


  29. SString getTreelocString(const GroveNode & = GroveNode()) const;


  30. GroveNode getByTreelocString(const SString & ) const;


  31. GroveSectionRoot asGroveSectionRoot() const;

    Downcasts to GroveSectionRoot.


  32. GroveDocument asGroveDocument() const;

    Downcasts to GroveDocument.


  33. GroveDocumentFragment asGroveDocumentFragment() const;

    Downcasts to GroveDocumentFragment.


  34. GroveNodeWithNamespace asGroveNodeWithNamespace() const;

    Downcasts to GroveNodeWithNamespace.


  35. GroveElement asGroveElement() const;

    Downcasts to GroveElement.


  36. GroveAttr asGroveAttr() const;

    Downcasts to GroveAttr.


  37. GroveText asGroveText() const;

    Downcasts to GroveText.


  38. GroveComment asGroveComment() const;

    Downcasts to GroveComment.


  39. GrovePi asGrovePi() const;

    Downcasts to GrovePi.


  40. GroveErs asGroveErs() const;

    Downcasts to GroveErs (Entity Reference Start node)


  41. GroveEre asGroveEre() const;

    Downcasts to GroveEre (Entity Reference End node)


  42. bool isReadOnly() const;

    Check whether the content of this node is read-only.


  43. void setReadOnly(bool v, bool recursive = true) ;

    Set the read-only status for the content of node.


  44. GroveErs getErs() const;

    Get current entity context.