Base class for xml_node and xml_attribute implementing common functions: name(), name_size(), value(), value_size() and parent().
More...
#include <rapidxml.h>
|
| 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...
|
|
Base class for xml_node and xml_attribute implementing common functions: name(), name_size(), value(), value_size() and parent().
- Parameters
-
§ xml_base()
rapidxml::xml_base::xml_base |
( |
| ) |
|
§ name() [1/3]
char * rapidxml::xml_base::name |
( |
| ) |
const |
Gets name of the node.
Interpretation of name depends on type of node. Note that name will not be zero-terminated if rapidxml::parse_no_string_terminators option was selected during parse.
Use name_size() function to determine length of the name.
- Returns
- Name of node, or empty string if node has no name.
§ name() [2/3]
void rapidxml::xml_base::name |
( |
const char * |
name, |
|
|
std::size_t |
size |
|
) |
| |
Sets name of node to a non zero-terminated string.
See ownership_of_strings.
Note that node does not own its name or value, it only stores a pointer to it. It will not delete or otherwise free the pointer on destruction. It is reponsibility of the user to properly manage lifetime of the string. The easiest way to achieve it is to use memory_pool of the document to allocate the string - on destruction of the document the string will be automatically freed.
Size of name must be specified separately, because name does not have to be zero terminated. Use name(const Ch *) function to have the length automatically calculated (string must be zero terminated).
- Parameters
-
name | Name of node to set. Does not have to be zero terminated. |
size | Size of name, in characters. This does not include zero terminator, if one is present. |
§ name() [3/3]
void rapidxml::xml_base::name |
( |
const char * |
name | ) |
|
Sets name of node to a zero-terminated string.
See also ownership_of_strings and xml_node::name(const Ch *, std::size_t).
- Parameters
-
name | Name of node to set. Must be zero terminated. |
§ name_size()
std::size_t rapidxml::xml_base::name_size |
( |
| ) |
const |
Gets size of node name, not including terminator character.
This function works correctly irrespective of whether name is or is not zero terminated.
- Returns
- Size of node name, in characters.
§ nullstr()
char * rapidxml::xml_base::nullstr |
( |
| ) |
|
|
staticprotected |
§ parent()
xml_node * rapidxml::xml_base::parent |
( |
| ) |
const |
Gets node parent.
- Returns
- Pointer to parent node, or 0 if there is no parent.
§ value() [1/3]
char * rapidxml::xml_base::value |
( |
| ) |
const |
Gets value of node.
Interpretation of value depends on type of node. Note that value will not be zero-terminated if rapidxml::parse_no_string_terminators option was selected during parse.
Use value_size() function to determine length of the value.
- Returns
- Value of node, or empty string if node has no value.
§ value() [2/3]
void rapidxml::xml_base::value |
( |
const char * |
value, |
|
|
std::size_t |
size |
|
) |
| |
Sets value of node to a non zero-terminated string.
See ownership_of_strings.
Note that node does not own its name or value, it only stores a pointer to it. It will not delete or otherwise free the pointer on destruction. It is reponsibility of the user to properly manage lifetime of the string. The easiest way to achieve it is to use memory_pool of the document to allocate the string - on destruction of the document the string will be automatically freed.
Size of value must be specified separately, because it does not have to be zero terminated. Use value(const Ch *) function to have the length automatically calculated (string must be zero terminated).
If an element has a child node of type node_data, it will take precedence over element value when printing. If you want to manipulate data of elements using values, use parser flag rapidxml::parse_no_data_nodes to prevent creation of data nodes by the parser.
- Parameters
-
value | value of node to set. Does not have to be zero terminated. |
size | Size of value, in characters. This does not include zero terminator, if one is present. |
§ value() [3/3]
void rapidxml::xml_base::value |
( |
const char * |
value | ) |
|
Sets value of node to a zero-terminated string.
See also ownership_of_strings and xml_node::value(const Ch *, std::size_t).
- Parameters
-
value | Vame of node to set. Must be zero terminated. |
§ value_size()
std::size_t rapidxml::xml_base::value_size |
( |
| ) |
const |
Gets size of node value, not including terminator character.
This function works correctly irrespective of whether value is or is not zero terminated.
- Returns
- Size of node value, in characters.
§ m_name
char* rapidxml::xml_base::m_name |
|
protected |
§ m_name_size
std::size_t rapidxml::xml_base::m_name_size |
|
protected |
§ m_parent
§ m_value
char* rapidxml::xml_base::m_value |
|
protected |
§ m_value_size
std::size_t rapidxml::xml_base::m_value_size |
|
protected |
The documentation for this class was generated from the following files: