Skip to content

Class lsl::xml_element

ClassList > lsl > xml_element

More...

  • #include <lsl_cpp.h>

Public Functions

Type Name
xml_element append_child (const std::string & name)
Append a child element with the specified name.
xml_element append_child_value (const std::string & name, const std::string & value)
xml_element append_copy (const xml_element & e)
Append a copy of the specified element as a child.
xml_element child (const std::string & name) const
Get a child with a specified name.
const char * child_value () const
Get child value (value of the first child that is text).
const char * child_value (const std::string & name) const
Get child value of a child with a specified name.
bool empty () const
Whether this node is empty.
xml_element first_child () const
Get the first child of the element.
bool is_text () const
Is this a text body (instead of an XML element)? True both for plain char data and CData.
xml_element last_child () const
Get the last child of the element.
const char * name () const
Name of the element.
xml_element next_sibling () const
Get the next sibling in the children list of the parent node.
xml_element next_sibling (const std::string & name) const
Get the next sibling with the specified name.
xml_element parent () const
Get the parent node.
xml_element prepend_child (const std::string & name)
Prepend a child element with the specified name.
xml_element prepend_child_value (const std::string & name, const std::string & value)
xml_element prepend_copy (const xml_element & e)
Prepend a child element with the specified name.
xml_element previous_sibling () const
Get the previous sibling in the children list of the parent node.
xml_element previous_sibling (const std::string & name) const
Get the previous sibling with the specified name.
void remove_child (const std::string & name)
Remove a child element with the specified name.
void remove_child (const xml_element & e)
Remove a specified child element.
bool set_child_value (const std::string & name, const std::string & value)
Set the text value of the (nameless) plain-text child of a named child node.
bool set_name (const std::string & rhs)
bool set_value (const std::string & rhs)
const char * value () const
Value of the element.
xml_element (lsl_xml_ptr obj=0)
Constructor.

Detailed Description

A lightweight XML element tree; models the .desc() field of stream_info.

Has a name and can have multiple named children or have text content as value; attributes are omitted. Insider note: The interface is modeled after a subset of pugixml's node type and is compatible with it. See also http://pugixml.googlecode.com/svn/tags/latest/docs/manual/access.html for additional documentation.

Public Functions Documentation

function append_child

Append a child element with the specified name.

inline xml_element lsl::xml_element::append_child (
    const std::string & name
) 


function append_child_value

inline xml_element lsl::xml_element::append_child_value (
    const std::string & name,
    const std::string & value
) 

Append a child node with a given name, which has a (nameless) plain-text child with the given text value.


function append_copy

Append a copy of the specified element as a child.

inline xml_element lsl::xml_element::append_copy (
    const xml_element & e
) 


function child

Get a child with a specified name.

inline xml_element lsl::xml_element::child (
    const std::string & name
) const


function child_value [1/2]

Get child value (value of the first child that is text).

inline const char * lsl::xml_element::child_value () const


function child_value [2/2]

Get child value of a child with a specified name.

inline const char * lsl::xml_element::child_value (
    const std::string & name
) const


function empty

Whether this node is empty.

inline bool lsl::xml_element::empty () const


function first_child

Get the first child of the element.

inline xml_element lsl::xml_element::first_child () const


function is_text

Is this a text body (instead of an XML element)? True both for plain char data and CData.

inline bool lsl::xml_element::is_text () const


function last_child

Get the last child of the element.

inline xml_element lsl::xml_element::last_child () const


function name

Name of the element.

inline const char * lsl::xml_element::name () const


function next_sibling [1/2]

Get the next sibling in the children list of the parent node.

inline xml_element lsl::xml_element::next_sibling () const


function next_sibling [2/2]

Get the next sibling with the specified name.

inline xml_element lsl::xml_element::next_sibling (
    const std::string & name
) const


function parent

Get the parent node.

inline xml_element lsl::xml_element::parent () const


function prepend_child

Prepend a child element with the specified name.

inline xml_element lsl::xml_element::prepend_child (
    const std::string & name
) 


function prepend_child_value

inline xml_element lsl::xml_element::prepend_child_value (
    const std::string & name,
    const std::string & value
) 

Prepend a child node with a given name, which has a (nameless) plain-text child with the given text value.


function prepend_copy

Prepend a child element with the specified name.

inline xml_element lsl::xml_element::prepend_copy (
    const xml_element & e
) 


function previous_sibling [1/2]

Get the previous sibling in the children list of the parent node.

inline xml_element lsl::xml_element::previous_sibling () const


function previous_sibling [2/2]

Get the previous sibling with the specified name.

inline xml_element lsl::xml_element::previous_sibling (
    const std::string & name
) const


function remove_child [1/2]

Remove a child element with the specified name.

inline void lsl::xml_element::remove_child (
    const std::string & name
) 


function remove_child [2/2]

Remove a specified child element.

inline void lsl::xml_element::remove_child (
    const xml_element & e
) 


function set_child_value

Set the text value of the (nameless) plain-text child of a named child node.

inline bool lsl::xml_element::set_child_value (
    const std::string & name,
    const std::string & value
) 


function set_name

inline bool lsl::xml_element::set_name (
    const std::string & rhs
) 

Set the element's name.

Returns:

False if the node is empty (or if out of memory).


function set_value

inline bool lsl::xml_element::set_value (
    const std::string & rhs
) 

Set the element's value.

Returns:

False if the node is empty (or if out of memory).


function value

Value of the element.

inline const char * lsl::xml_element::value () const


function xml_element

Constructor.

inline lsl::xml_element::xml_element (
    lsl_xml_ptr obj=0
) 



The documentation for this class was generated from the following file liblsl/include/lsl_cpp.h