Class DOMElemPtr


  • public class DOMElemPtr
    extends java.lang.Object
    Ptr stores a pointer and optionally takes ownership of the value.
    • Constructor Detail

      • DOMElemPtr

        public DOMElemPtr​(long cPtr,
                          boolean cMemoryOwn)
      • DOMElemPtr

        public DOMElemPtr()
        Default constructor yielding a NULL-pointer.
      • DOMElemPtr

        public DOMElemPtr​(DOMElem ptr)
        Do not take ownership of ptr.

        ptr can be null.

        The constructor is implicit on purpose.
    • Method Detail

      • getCPtr

        public static long getCPtr​(DOMElemPtr obj)
      • delete

        public void delete()
      • deref

        public DOMElem deref()
        The pointer stored in the object.
      • __ref__

        public DOMElem __ref__()
        Dereferencing operator.
      • getDeref

        public DOMElem getDeref()
        Member access operator.
      • equals

        public boolean equals​(DOMElem p)
      • isShared

        public boolean isShared()
        check if this Ptr has shared ownership or none
        ownership
        Returns:
        true if Ptr has shared ownership, false if it has no ownership.
      • isNull

        public boolean isNull()
        checks if the pointer is null
        Returns:
        Returns true if the pointer is null
      • isName

        public boolean isName​(java.lang.String elemname)
        test if name of this elem equals elemname
        Parameters:
        elemname - [in] string name to test with
        Returns:
        true if elemname equals name of this DOMElem, false otherwise
      • getName

        public java.lang.String getName()
        get name of this DOMElem
        Returns:
        name of DOMElem
      • getValue

        public java.lang.String getValue()
        get string value of this DOMElem
        Returns:
        string value of this elem
      • getValueAsInt

        public int getValueAsInt()
        get value as an integer, throws an exception if this is not an
        int value.
        Returns:
        the int value
      • getValueAsDouble

        public double getValueAsDouble()
        get value as an double floating point, throws an exception if this is not an
        double value.
        Returns:
        the double value
      • getValueAsStringList

        public vector_s getValueAsStringList​(char stringseperator)
        get value as a list of strings, throws an exception if this is not a
        list of strings. The default string seperator is semicolon (;).
        Returns:
        list of strings
      • getValueAsStringList

        public vector_s getValueAsStringList()
        get value as a list of strings, throws an exception if this is not a
        list of strings. The default string seperator is semicolon (;).
        Returns:
        list of strings
      • getValueAsDoubleList

        public vector_d getValueAsDoubleList()
        get value as a list of doubles, throws an exception if this is not a
        list of doubles. The default string seperator is space ( ).
        Returns:
        list of doubles
      • getValueAsDoubleList

        public vector_d getValueAsDoubleList​(int N)
        get value as a list of N doubles, throws an exception if this is not a
        list of N doubles. The default string seperator is space ( ).
        Returns:
        list of N doubles
      • getChild

        public DOMElemPtr getChild​(java.lang.String name,
                                   boolean optional)
        get a child with a specific name. If more children with the same name occur then
        it cannot be guaranteed which is returned. If optional is false then an exception will be
        thrown if the child cannot be found. If optional is true then NULL is returned if child
        is not found.
        Parameters:
        name - [in] name of the child to find
        optional - [in]
        Returns:
        the DOMElem child if found, else either NULL (is optional) or an exception is
        thrown.
      • getChild

        public DOMElemPtr getChild​(java.lang.String name)
        get a child with a specific name. If more children with the same name occur then
        it cannot be guaranteed which is returned. If optional is false then an exception will be
        thrown if the child cannot be found. If optional is true then NULL is returned if child
        is not found.
        Parameters:
        name - [in] name of the child to find

        Returns:
        the DOMElem child if found, else either NULL (is optional) or an exception is
        thrown.
      • getAttribute

        public DOMElemPtr getAttribute​(java.lang.String name,
                                       boolean optional)
        get a attribute with a specific name. If more attributes with the same name occur
        then it cannot be guaranteed which is returned. If optional is false then an exception
        will be thrown if the child cannot be found. If optional is true then NULL is returned if
        child is not found.
        Parameters:
        name - [in] name of the attribute to find
        optional - [in]
        Returns:
        the DOMElem attribute if found, else either NULL (is optional) or an exception is
        thrown.
      • getAttribute

        public DOMElemPtr getAttribute​(java.lang.String name)
        get a attribute with a specific name. If more attributes with the same name occur
        then it cannot be guaranteed which is returned. If optional is false then an exception
        will be thrown if the child cannot be found. If optional is true then NULL is returned if
        child is not found.
        Parameters:
        name - [in] name of the attribute to find

        Returns:
        the DOMElem attribute if found, else either NULL (is optional) or an exception is
        thrown.
      • hasChild

        public boolean hasChild​(java.lang.String name)
        test if this DOMElem has a child by name name.
        Parameters:
        name - [in] name of the child DOMElem
        Returns:
        true if this DOMElem has a child with name name
      • hasChildren

        public boolean hasChildren()
        test if this DOMElem has any children
        Returns:
        true if this DOMElem has any children
      • hasAttribute

        public boolean hasAttribute​(java.lang.String name)
        test if this DOMElem has an attribute by name name.
        Parameters:
        name - [in] name of the attribute DOMElem
        Returns:
        true if this DOMElem has an attribute with name name
      • getAttributeValue

        public java.lang.String getAttributeValue​(java.lang.String name)
        Get the value of attribute as a string.
        Parameters:
        name - [in] the name of the attribute.
        Returns:
        the value.
      • getAttributeValue

        public java.lang.String getAttributeValue​(java.lang.String name,
                                                  java.lang.String default_value)
        std::string&)
        Parameters:
        default_value - [in] a default value to return if attibute is not found.
      • getAttributeValueAsInt

        public int getAttributeValueAsInt​(java.lang.String name)
        Get the value of attribute as an integer.
        Parameters:
        name - [in] the name of the attribute.
        Returns:
        the value.
      • getAttributeValueAsInt

        public int getAttributeValueAsInt​(java.lang.String name,
                                          int default_value)
        std::string&)
        Parameters:
        default_value - [in] a default value to return if attibute is not found.
      • getAttributeValueAsDouble

        public double getAttributeValueAsDouble​(java.lang.String name)
        Get the value of attribute as an double.
        Parameters:
        name - [in] the name of the attribute.
        Returns:
        the value.
      • getAttributeValueAsDouble

        public double getAttributeValueAsDouble​(java.lang.String name,
                                                double default_value)
        std::string&)
        Parameters:
        default_value - [in] a default value to return if attibute is not found.
      • getValueAsBool

        public boolean getValueAsBool()
        Get the value as a boolean.
        Returns:
        boolean value.
      • getAttributeValueAsBool

        public boolean getAttributeValueAsBool​(java.lang.String name)
        Get the value of attribute as an boolean.
        Parameters:
        name - [in] the name of the attribute.
        Returns:
        the value.
      • getAttributeValueAsBool

        public boolean getAttributeValueAsBool​(java.lang.String name,
                                               boolean default_value)
        std::string&)
        Parameters:
        default_value - [in] a default value to return if attibute is not found.
      • begin

        public DOMElem.Iterator begin()
        Get iterator to first child element.
        Returns:
        iterator.
      • end

        public DOMElem.Iterator end()
        Get iterator to last child element.
        Returns:
        iterator.
      • addChild

        public DOMElemPtr addChild()
        Add a child with an empty name.
        Returns:
        pointer to the new child element.
      • addChild

        public DOMElemPtr addChild​(java.lang.String name)
        Add a child element.
        Parameters:
        name - [in] name of child.
        Returns:
        pointer to the new child element.
      • addAttribute

        public DOMElemPtr addAttribute​(java.lang.String name)
        Add an attribute element.
        Parameters:
        name - [in] name of the attribute.
        Returns:
        pointer to the new attribute.
      • setValue

        public void setValue​(java.lang.String val)
        Set the value of this element.
        Parameters:
        val - [in] new value.
      • setValue

        public void setValue​(boolean val)
        std::string&)
      • setValue

        public void setValue​(int val)
        std::string&)
      • setValue

        public void setValue​(double val)
        std::string&)
      • setName

        public void setName​(java.lang.String val)
        Set the name of this element.
        Parameters:
        val - [in] new name.
      • setValueString

        public void setValueString​(java.lang.String val)
        std::string&)