Name

GrovePos — GrovePos denotes a position in the XML tree (grove).

Synopsis

class GrovePos:
  

  enum Type { UNKNOWN_POS, ELEMENT_POS, TEXT_POS };
  # construct/copy/destruct
  __init__()
  __init__(const GroveNode &)
  __init__(const GroveNode &, const GroveNode &)
  __init__(const GroveText &, long)
  __init__(const SString &, const GroveNode &)

  # public member functions

  SString asString() const
  bool isNull() const
  Type type() const
  GroveNode node() const
  GroveNode before() const
  GroveText text() const
  long idx() const
  GroveErs getErs() const
  None dump() const

Description

There are two kinds of GrovePos: TEXT_POS and ELEMENT_POS. For TEXT_POS, position consists of reference to text node and offset in text; for ELEMENT_POS, position consists of parent node and "before" node (position in tree is assumed just before "before" node; of before node is NULL, then position is right after the last child of the parent node).

GrovePos construct/copy/destruct

  1. __init__()

    Construct NULL GrovePos.


  2. __init__(const GroveNode & node)

    Constructs ELEMENT_POS.


  3. __init__(const GroveNode & node, const GroveNode & before)

    Constructs ELEMENT_POS.


  4. __init__(const GroveText & text, long idx)

    Constructs TEXT_POS (idx means offset in text, starting from 0)


  5. __init__(const SString & , const GroveNode & root)

    Constructs GrovePos from text representation (path starting at root)


GrovePos public member functions

  1. SString asString() const

    Returns text representation of GrovePos (like "xpath path")


  2. bool isNull() const

    Returns true if position is not initialized.


  3. Type type() const

    Return type of grove position, see Type enum.


  4. GroveNode node() const

    These are returned for ELEMENT_POS.


  5. GroveNode before() const

    These are returned for ELEMENT_POS.


  6. GroveText text() const

    These are returned for TEXT_POS.


  7. long idx() const

    These are returned for TEXT_POS.


  8. GroveErs getErs() const

    Get current entity context for this position.


  9. None dump() const

    Dump GrovePos.