libhomegear-base
0.7
Base library for Homegear and Homegear family modules.
|
Class representing a node of XML document. More...
#include <rapidxml.h>
Public Member Functions | |
xml_node (node_type type) | |
Constructs an empty node with the specified type. More... | |
node_type | type () const |
Gets type of node. More... | |
xml_document * | document () const |
Gets document of which node is a child. More... | |
xml_node * | first_node (const char *name=nullptr, std::size_t name_size=0, bool case_sensitive=true) const |
Gets first child node, optionally matching node name. More... | |
xml_node * | last_node (const char *name=nullptr, std::size_t name_size=0, bool case_sensitive=true) const |
Gets last child node, optionally matching node name. More... | |
xml_node * | previous_sibling (const char *name=nullptr, std::size_t name_size=0, bool case_sensitive=true) const |
Gets previous sibling node, optionally matching node name. More... | |
xml_node * | next_sibling (const char *name=nullptr, std::size_t name_size=0, bool case_sensitive=true) const |
Gets next sibling node, optionally matching node name. More... | |
xml_attribute * | first_attribute (const char *name=nullptr, std::size_t name_size=0, bool case_sensitive=true) const |
Gets first attribute of node, optionally matching attribute name. More... | |
xml_attribute * | last_attribute (const char *name=nullptr, std::size_t name_size=0, bool case_sensitive=true) const |
Gets last attribute of node, optionally matching attribute name. More... | |
void | type (node_type type) |
Sets type of node. More... | |
void | prepend_node (xml_node *child) |
Prepends a new child node. More... | |
void | append_node (xml_node *child) |
Appends a new child node. More... | |
void | insert_node (xml_node *where, xml_node *child) |
Inserts a new child node at specified place inside the node. More... | |
void | remove_first_node () |
Removes first child node. More... | |
void | remove_last_node () |
Removes last child of the node. More... | |
void | remove_node (xml_node *where) |
Removes specified child from the node. More... | |
void | remove_all_nodes () |
Removes all child nodes (but not attributes). More... | |
void | prepend_attribute (xml_attribute *attribute) |
Prepends a new attribute to the node. More... | |
void | append_attribute (xml_attribute *attribute) |
Appends a new attribute to the node. More... | |
void | insert_attribute (xml_attribute *where, xml_attribute *attribute) |
Inserts a new attribute at specified place inside the node. More... | |
void | remove_first_attribute () |
Removes first attribute of the node. More... | |
void | remove_last_attribute () |
Removes last attribute of the node. More... | |
void | remove_attribute (xml_attribute *where) |
Removes specified attribute from node. More... | |
void | remove_all_attributes () |
Removes all attributes of node. More... | |
Public Member Functions inherited from rapidxml::xml_base | |
xml_base () | |
char * | name () const |
Gets name of the node. More... | |
std::size_t | name_size () const |
Gets size of node name, not including terminator character. More... | |
char * | value () const |
Gets value of node. More... | |
std::size_t | value_size () const |
Gets size of node value, not including terminator character. More... | |
void | name (const char *name, std::size_t size) |
Sets name of node to a non zero-terminated string. More... | |
void | name (const char *name) |
Sets name of node to a zero-terminated string. More... | |
void | value (const char *value, std::size_t size) |
Sets value of node to a non zero-terminated string. More... | |
void | value (const char *value) |
Sets value of node to a zero-terminated string. More... | |
xml_node * | parent () const |
Gets node parent. More... | |
Additional Inherited Members | |
Static Protected Member Functions inherited from rapidxml::xml_base | |
static char * | nullstr () |
Protected Attributes inherited from rapidxml::xml_base | |
char * | m_name |
char * | m_value |
std::size_t | m_name_size |
std::size_t | m_value_size |
xml_node * | m_parent |
Class representing a node of XML document.
Each node may have associated name and value strings, which are available through name() and value() functions. Interpretation of name and value depends on type of the node. Type of node can be determined by using type() function.
Note that after parse, both name and value of node, if any, will point interior of source text used for parsing. Thus, this text must persist in the memory for the lifetime of node.
Ch | Character type to use. |
rapidxml::xml_node::xml_node | ( | node_type | type | ) |
Constructs an empty node with the specified type.
Consider using memory_pool of appropriate document to allocate nodes manually.
type | Type of node to construct. |
void rapidxml::xml_node::append_attribute | ( | xml_attribute * | attribute | ) |
Appends a new attribute to the node.
attribute | Attribute to append. |
void rapidxml::xml_node::append_node | ( | xml_node * | child | ) |
Appends a new child node.
The appended child becomes the last child.
child | Node to append. |
xml_document * rapidxml::xml_node::document | ( | ) | const |
Gets document of which node is a child.
xml_attribute * rapidxml::xml_node::first_attribute | ( | const char * | name = nullptr , |
std::size_t | name_size = 0 , |
||
bool | case_sensitive = true |
||
) | const |
Gets first attribute of node, optionally matching attribute name.
name | Name of attribute to find, or 0 to return first attribute regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero |
name_size | Size of name, in characters, or 0 to have size calculated automatically from string |
case_sensitive | Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters |
xml_node * rapidxml::xml_node::first_node | ( | const char * | name = nullptr , |
std::size_t | name_size = 0 , |
||
bool | case_sensitive = true |
||
) | const |
Gets first child node, optionally matching node name.
name | Name of child to find, or 0 to return first child regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero |
name_size | Size of name, in characters, or 0 to have size calculated automatically from string |
case_sensitive | Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters |
void rapidxml::xml_node::insert_attribute | ( | xml_attribute * | where, |
xml_attribute * | attribute | ||
) |
Inserts a new attribute at specified place inside the node.
All attributes after and including the specified attribute are moved one position back.
where | Place where to insert the attribute, or 0 to insert at the back. |
attribute | Attribute to insert. |
Inserts a new child node at specified place inside the node.
All children after and including the specified node are moved one position back.
where | Place where to insert the child, or 0 to insert at the back. |
child | Node to insert. |
xml_attribute * rapidxml::xml_node::last_attribute | ( | const char * | name = nullptr , |
std::size_t | name_size = 0 , |
||
bool | case_sensitive = true |
||
) | const |
Gets last attribute of node, optionally matching attribute name.
name | Name of attribute to find, or 0 to return last attribute regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero |
name_size | Size of name, in characters, or 0 to have size calculated automatically from string |
case_sensitive | Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters |
xml_node * rapidxml::xml_node::last_node | ( | const char * | name = nullptr , |
std::size_t | name_size = 0 , |
||
bool | case_sensitive = true |
||
) | const |
Gets last child node, optionally matching node name.
Behaviour is undefined if node has no children. Use first_node() to test if node has children.
name | Name of child to find, or 0 to return last child regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero |
name_size | Size of name, in characters, or 0 to have size calculated automatically from string |
case_sensitive | Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters |
xml_node * rapidxml::xml_node::next_sibling | ( | const char * | name = nullptr , |
std::size_t | name_size = 0 , |
||
bool | case_sensitive = true |
||
) | const |
Gets next sibling node, optionally matching node name.
Behaviour is undefined if node has no parent. Use parent() to test if node has a parent.
name | Name of sibling to find, or 0 to return next sibling regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero |
name_size | Size of name, in characters, or 0 to have size calculated automatically from string |
case_sensitive | Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters |
void rapidxml::xml_node::prepend_attribute | ( | xml_attribute * | attribute | ) |
Prepends a new attribute to the node.
attribute | Attribute to prepend. |
void rapidxml::xml_node::prepend_node | ( | xml_node * | child | ) |
Prepends a new child node.
The prepended child becomes the first child, and all existing children are moved one position back.
child | Node to prepend. |
xml_node * rapidxml::xml_node::previous_sibling | ( | const char * | name = nullptr , |
std::size_t | name_size = 0 , |
||
bool | case_sensitive = true |
||
) | const |
Gets previous sibling node, optionally matching node name.
Behaviour is undefined if node has no parent. Use parent() to test if node has a parent.
name | Name of sibling to find, or 0 to return previous sibling regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero |
name_size | Size of name, in characters, or 0 to have size calculated automatically from string |
case_sensitive | Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters |
void rapidxml::xml_node::remove_all_attributes | ( | ) |
Removes all attributes of node.
void rapidxml::xml_node::remove_all_nodes | ( | ) |
Removes all child nodes (but not attributes).
void rapidxml::xml_node::remove_attribute | ( | xml_attribute * | where | ) |
Removes specified attribute from node.
where | Pointer to attribute to be removed. |
void rapidxml::xml_node::remove_first_attribute | ( | ) |
Removes first attribute of the node.
If node has no attributes, behaviour is undefined. Use first_attribute() to test if node has attributes.
void rapidxml::xml_node::remove_first_node | ( | ) |
Removes first child node.
If node has no children, behaviour is undefined. Use first_node() to test if node has children.
void rapidxml::xml_node::remove_last_attribute | ( | ) |
Removes last attribute of the node.
If node has no attributes, behaviour is undefined. Use first_attribute() to test if node has attributes.
void rapidxml::xml_node::remove_last_node | ( | ) |
Removes last child of the node.
If node has no children, behaviour is undefined. Use first_node() to test if node has children.
void rapidxml::xml_node::remove_node | ( | xml_node * | where | ) |
Removes specified child from the node.
node_type rapidxml::xml_node::type | ( | ) | const |
Gets type of node.
void rapidxml::xml_node::type | ( | node_type | type | ) |
Sets type of node.
type | Type of node to set. |