IN2OSM  1.0.1
xml_node< Ch >

#include <rapidxml.hpp>

Inheritance diagram for xml_node< Ch >:
Inheritance graph
Collaboration diagram for xml_node< Ch >:
Collaboration graph

Public Member Functions

 xml_node (node_type type)
 
node_type type () const
 
xml_document< Ch > * document () const
 
xml_node< Ch > * first_node (const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
 
xml_node< Ch > * last_node (const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
 
xml_node< Ch > * previous_sibling (const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
 
xml_node< Ch > * next_sibling (const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
 
xml_attribute< Ch > * first_attribute (const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
 
xml_attribute< Ch > * last_attribute (const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
 
void type (node_type type)
 
void prepend_node (xml_node< Ch > *child)
 
void append_node (xml_node< Ch > *child)
 
void insert_node (xml_node< Ch > *where, xml_node< Ch > *child)
 
void remove_first_node ()
 
void remove_last_node ()
 
void remove_node (xml_node< Ch > *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< Ch > *attribute)
 
void append_attribute (xml_attribute< Ch > *attribute)
 
void insert_attribute (xml_attribute< Ch > *where, xml_attribute< Ch > *attribute)
 
void remove_first_attribute ()
 
void remove_last_attribute ()
 
void remove_attribute (xml_attribute< Ch > *where)
 
void remove_all_attributes ()
 Removes all attributes of node. More...
 
Ch * name () const
 
void name (const Ch *name, std::size_t size)
 
void name (const Ch *name)
 
std::size_t name_size () const
 
Ch * value () const
 
void value (const Ch *value, std::size_t size)
 
void value (const Ch *value)
 
std::size_t value_size () const
 
xml_node< Ch > * parent () const
 

Static Protected Member Functions

static Ch * nullstr ()
 

Protected Attributes

Ch * m_name
 
Ch * m_value
 
std::size_t m_name_size
 
std::size_t m_value_size
 
xml_node< Ch > * m_parent
 

Private Member Functions

 xml_node (const xml_node &)
 
void operator= (const xml_node &)
 

Private Attributes

node_type m_type
 
xml_node< Ch > * m_first_node
 
xml_node< Ch > * m_last_node
 
xml_attribute< Ch > * m_first_attribute
 
xml_attribute< Ch > * m_last_attribute
 
xml_node< Ch > * m_prev_sibling
 
xml_node< Ch > * m_next_sibling
 

Detailed Description

template<class Ch = char>
class rapidxml::xml_node< Ch >

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.

Parameters
ChCharacter type to use.

Definition at line 137 of file rapidxml.hpp.

Constructor & Destructor Documentation

◆ xml_node() [1/2]

xml_node ( node_type  type)
inline

Constructs an empty node with the specified type. Consider using memory_pool of appropriate document to allocate nodes manually.

Parameters
typeType of node to construct.

Definition at line 901 of file rapidxml.hpp.

902  : m_type(type)
903  , m_first_node(0)
904  , m_first_attribute(0)
905  {
906  }
xml_node< Ch > * m_first_node
Definition: rapidxml.hpp:1338
xml_attribute< Ch > * m_first_attribute
Definition: rapidxml.hpp:1340
node_type type() const
Definition: rapidxml.hpp:913

◆ xml_node() [2/2]

xml_node ( const xml_node< Ch > &  )
private

Member Function Documentation

◆ append_attribute()

void append_attribute ( xml_attribute< Ch > *  attribute)
inline

Appends a new attribute to the node.

Parameters
attributeAttribute to append.

Definition at line 1217 of file rapidxml.hpp.

1218  {
1219  assert(attribute && !attribute->parent());
1220  if (first_attribute())
1221  {
1222  attribute->m_prev_attribute = m_last_attribute;
1223  m_last_attribute->m_next_attribute = attribute;
1224  }
1225  else
1226  {
1227  attribute->m_prev_attribute = 0;
1228  m_first_attribute = attribute;
1229  }
1230  m_last_attribute = attribute;
1231  attribute->m_parent = this;
1232  attribute->m_next_attribute = 0;
1233  }
xml_attribute< Ch > * m_last_attribute
Definition: rapidxml.hpp:1341
xml_attribute< Ch > * m_first_attribute
Definition: rapidxml.hpp:1340
xml_attribute< Ch > * first_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Definition: rapidxml.hpp:1025
Here is the call graph for this function:
Here is the caller graph for this function:

◆ append_node()

void append_node ( xml_node< Ch > *  child)
inline

Appends a new child node. The appended child becomes the last child.

Parameters
childNode to append.

Definition at line 1097 of file rapidxml.hpp.

1098  {
1099  assert(child && !child->parent() && child->type() != node_document);
1100  if (first_node())
1101  {
1102  child->m_prev_sibling = m_last_node;
1103  m_last_node->m_next_sibling = child;
1104  }
1105  else
1106  {
1107  child->m_prev_sibling = 0;
1108  m_first_node = child;
1109  }
1110  m_last_node = child;
1111  child->m_parent = this;
1112  child->m_next_sibling = 0;
1113  }
xml_node< Ch > * m_first_node
Definition: rapidxml.hpp:1338
xml_node< Ch > * m_last_node
Definition: rapidxml.hpp:1339
A document node. Name and value are empty.
Definition: rapidxml.hpp:145
xml_node< Ch > * first_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Definition: rapidxml.hpp:936
Here is the call graph for this function:
Here is the caller graph for this function:

◆ document()

xml_document<Ch>* document ( ) const
inline

Gets document of which node is a child.

Returns
Pointer to document that contains this node, or 0 if there is no parent document.

Definition at line 923 of file rapidxml.hpp.

924  {
925  xml_node<Ch> *node = const_cast<xml_node<Ch> *>(this);
926  while (node->parent())
927  node = node->parent();
928  return node->type() == node_document ? static_cast<xml_document<Ch> *>(node) : 0;
929  }
A document node. Name and value are empty.
Definition: rapidxml.hpp:145
Here is the call graph for this function:

◆ first_attribute()

xml_attribute<Ch>* first_attribute ( const Ch *  name = 0,
std::size_t  name_size = 0,
bool  case_sensitive = true 
) const
inline

Gets first attribute of node, optionally matching attribute name.

Parameters
nameName 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_sizeSize of name, in characters, or 0 to have size calculated automatically from string
case_sensitiveShould name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters
Returns
Pointer to found attribute, or 0 if not found.

Definition at line 1025 of file rapidxml.hpp.

1026  {
1027  if (name)
1028  {
1029  if (name_size == 0)
1030  name_size = internal::measure(name);
1031  for (xml_attribute<Ch> *attribute = m_first_attribute; attribute; attribute = attribute->m_next_attribute)
1032  if (internal::compare(attribute->name(), attribute->name_size(), name, name_size, case_sensitive))
1033  return attribute;
1034  return 0;
1035  }
1036  else
1037  return m_first_attribute;
1038  }
xml_attribute< Ch > * m_first_attribute
Definition: rapidxml.hpp:1340
Ch * name() const
Definition: rapidxml.hpp:673
std::size_t name_size() const
Definition: rapidxml.hpp:681
Here is the caller graph for this function:

◆ first_node()

xml_node<Ch>* first_node ( const Ch *  name = 0,
std::size_t  name_size = 0,
bool  case_sensitive = true 
) const
inline

Gets first child node, optionally matching node name.

Parameters
nameName 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_sizeSize of name, in characters, or 0 to have size calculated automatically from string
case_sensitiveShould name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters
Returns
Pointer to found child, or 0 if not found.

Definition at line 936 of file rapidxml.hpp.

937  {
938  if (name)
939  {
940  if (name_size == 0)
941  name_size = internal::measure(name);
942  for (xml_node<Ch> *child = m_first_node; child; child = child->next_sibling())
943  if (internal::compare(child->name(), child->name_size(), name, name_size, case_sensitive))
944  return child;
945  return 0;
946  }
947  else
948  return m_first_node;
949  }
xml_node< Ch > * m_first_node
Definition: rapidxml.hpp:1338
Ch * name() const
Definition: rapidxml.hpp:673
std::size_t name_size() const
Definition: rapidxml.hpp:681
Here is the call graph for this function:
Here is the caller graph for this function:

◆ insert_attribute()

void insert_attribute ( xml_attribute< Ch > *  where,
xml_attribute< Ch > *  attribute 
)
inline

Inserts a new attribute at specified place inside the node. All attributes after and including the specified attribute are moved one position back.

Parameters
wherePlace where to insert the attribute, or 0 to insert at the back.
attributeAttribute to insert.

Definition at line 1239 of file rapidxml.hpp.

1240  {
1241  assert(!where || where->parent() == this);
1242  assert(attribute && !attribute->parent());
1243  if (where == m_first_attribute)
1244  prepend_attribute(attribute);
1245  else if (where == 0)
1246  append_attribute(attribute);
1247  else
1248  {
1249  attribute->m_prev_attribute = where->m_prev_attribute;
1250  attribute->m_next_attribute = where;
1251  where->m_prev_attribute->m_next_attribute = attribute;
1252  where->m_prev_attribute = attribute;
1253  attribute->m_parent = this;
1254  }
1255  }
void append_attribute(xml_attribute< Ch > *attribute)
Definition: rapidxml.hpp:1217
void prepend_attribute(xml_attribute< Ch > *attribute)
Definition: rapidxml.hpp:1197
xml_attribute< Ch > * m_first_attribute
Definition: rapidxml.hpp:1340
Here is the call graph for this function:

◆ insert_node()

void insert_node ( xml_node< Ch > *  where,
xml_node< Ch > *  child 
)
inline

Inserts a new child node at specified place inside the node. All children after and including the specified node are moved one position back.

Parameters
wherePlace where to insert the child, or 0 to insert at the back.
childNode to insert.

Definition at line 1119 of file rapidxml.hpp.

1120  {
1121  assert(!where || where->parent() == this);
1122  assert(child && !child->parent() && child->type() != node_document);
1123  if (where == m_first_node)
1124  prepend_node(child);
1125  else if (where == 0)
1126  append_node(child);
1127  else
1128  {
1129  child->m_prev_sibling = where->m_prev_sibling;
1130  child->m_next_sibling = where;
1131  where->m_prev_sibling->m_next_sibling = child;
1132  where->m_prev_sibling = child;
1133  child->m_parent = this;
1134  }
1135  }
xml_node< Ch > * m_first_node
Definition: rapidxml.hpp:1338
void prepend_node(xml_node< Ch > *child)
Definition: rapidxml.hpp:1076
void append_node(xml_node< Ch > *child)
Definition: rapidxml.hpp:1097
A document node. Name and value are empty.
Definition: rapidxml.hpp:145
Here is the call graph for this function:

◆ last_attribute()

xml_attribute<Ch>* last_attribute ( const Ch *  name = 0,
std::size_t  name_size = 0,
bool  case_sensitive = true 
) const
inline

Gets last attribute of node, optionally matching attribute name.

Parameters
nameName 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_sizeSize of name, in characters, or 0 to have size calculated automatically from string
case_sensitiveShould name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters
Returns
Pointer to found attribute, or 0 if not found.

Definition at line 1045 of file rapidxml.hpp.

1046  {
1047  if (name)
1048  {
1049  if (name_size == 0)
1050  name_size = internal::measure(name);
1051  for (xml_attribute<Ch> *attribute = m_last_attribute; attribute; attribute = attribute->m_prev_attribute)
1052  if (internal::compare(attribute->name(), attribute->name_size(), name, name_size, case_sensitive))
1053  return attribute;
1054  return 0;
1055  }
1056  else
1057  return m_first_attribute ? m_last_attribute : 0;
1058  }
xml_attribute< Ch > * m_last_attribute
Definition: rapidxml.hpp:1341
xml_attribute< Ch > * m_first_attribute
Definition: rapidxml.hpp:1340
Ch * name() const
Definition: rapidxml.hpp:673
std::size_t name_size() const
Definition: rapidxml.hpp:681

◆ last_node()

xml_node<Ch>* last_node ( const Ch *  name = 0,
std::size_t  name_size = 0,
bool  case_sensitive = true 
) const
inline

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.

Parameters
nameName 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_sizeSize of name, in characters, or 0 to have size calculated automatically from string
case_sensitiveShould name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters
Returns
Pointer to found child, or 0 if not found.

Definition at line 958 of file rapidxml.hpp.

959  {
960  assert(m_first_node); // Cannot query for last child if node has no children
961  if (name)
962  {
963  if (name_size == 0)
964  name_size = internal::measure(name);
965  for (xml_node<Ch> *child = m_last_node; child; child = child->previous_sibling())
966  if (internal::compare(child->name(), child->name_size(), name, name_size, case_sensitive))
967  return child;
968  return 0;
969  }
970  else
971  return m_last_node;
972  }
xml_node< Ch > * m_first_node
Definition: rapidxml.hpp:1338
xml_node< Ch > * m_last_node
Definition: rapidxml.hpp:1339
Ch * name() const
Definition: rapidxml.hpp:673
std::size_t name_size() const
Definition: rapidxml.hpp:681
Here is the call graph for this function:

◆ name() [1/3]

Ch* name ( ) const
inlineinherited

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.

Definition at line 673 of file rapidxml.hpp.

674  {
675  return m_name ? m_name : nullstr();
676  }
static Ch * nullstr()
Definition: rapidxml.hpp:778
Here is the caller graph for this function:

◆ name() [2/3]

void name ( const Ch *  name,
std::size_t  size 
)
inlineinherited

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
nameName of node to set. Does not have to be zero terminated.
sizeSize of name, in characters. This does not include zero terminator, if one is present.

Definition at line 721 of file rapidxml.hpp.

722  {
723  m_name = const_cast<Ch *>(name);
724  m_name_size = size;
725  }
std::size_t m_name_size
Definition: rapidxml.hpp:786
Ch * name() const
Definition: rapidxml.hpp:673

◆ name() [3/3]

void name ( const Ch *  name)
inlineinherited

Sets name of node to a zero-terminated string. See also ownership_of_strings and xml_node::name(const Ch *, std::size_t).

Parameters
nameName of node to set. Must be zero terminated.

Definition at line 730 of file rapidxml.hpp.

731  {
732  this->name(name, internal::measure(name));
733  }
Ch * name() const
Definition: rapidxml.hpp:673

◆ name_size()

std::size_t name_size ( ) const
inlineinherited

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.

Definition at line 681 of file rapidxml.hpp.

682  {
683  return m_name ? m_name_size : 0;
684  }
std::size_t m_name_size
Definition: rapidxml.hpp:786
Here is the caller graph for this function:

◆ next_sibling()

xml_node<Ch>* next_sibling ( const Ch *  name = 0,
std::size_t  name_size = 0,
bool  case_sensitive = true 
) const
inline

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.

Parameters
nameName 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_sizeSize of name, in characters, or 0 to have size calculated automatically from string
case_sensitiveShould name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters
Returns
Pointer to found sibling, or 0 if not found.

Definition at line 1004 of file rapidxml.hpp.

1005  {
1006  assert(this->m_parent); // Cannot query for siblings if node has no parent
1007  if (name)
1008  {
1009  if (name_size == 0)
1010  name_size = internal::measure(name);
1011  for (xml_node<Ch> *sibling = m_next_sibling; sibling; sibling = sibling->m_next_sibling)
1012  if (internal::compare(sibling->name(), sibling->name_size(), name, name_size, case_sensitive))
1013  return sibling;
1014  return 0;
1015  }
1016  else
1017  return m_next_sibling;
1018  }
xml_node< Ch > * m_parent
Definition: rapidxml.hpp:788
xml_node< Ch > * m_next_sibling
Definition: rapidxml.hpp:1343
Ch * name() const
Definition: rapidxml.hpp:673
std::size_t name_size() const
Definition: rapidxml.hpp:681
Here is the caller graph for this function:

◆ nullstr()

static Ch* nullstr ( )
inlinestaticprotectedinherited

Definition at line 778 of file rapidxml.hpp.

779  {
780  static Ch zero = Ch('\0');
781  return &zero;
782  }

◆ operator=()

void operator= ( const xml_node< Ch > &  )
private

◆ parent()

xml_node<Ch>* parent ( ) const
inlineinherited

Gets node parent.

Returns
Pointer to parent node, or 0 if there is no parent.

Definition at line 770 of file rapidxml.hpp.

771  {
772  return m_parent;
773  }
xml_node< Ch > * m_parent
Definition: rapidxml.hpp:788
Here is the caller graph for this function:

◆ prepend_attribute()

void prepend_attribute ( xml_attribute< Ch > *  attribute)
inline

Prepends a new attribute to the node.

Parameters
attributeAttribute to prepend.

Definition at line 1197 of file rapidxml.hpp.

1198  {
1199  assert(attribute && !attribute->parent());
1200  if (first_attribute())
1201  {
1202  attribute->m_next_attribute = m_first_attribute;
1203  m_first_attribute->m_prev_attribute = attribute;
1204  }
1205  else
1206  {
1207  attribute->m_next_attribute = 0;
1208  m_last_attribute = attribute;
1209  }
1210  m_first_attribute = attribute;
1211  attribute->m_parent = this;
1212  attribute->m_prev_attribute = 0;
1213  }
xml_attribute< Ch > * m_last_attribute
Definition: rapidxml.hpp:1341
xml_attribute< Ch > * m_first_attribute
Definition: rapidxml.hpp:1340
xml_attribute< Ch > * first_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Definition: rapidxml.hpp:1025
Here is the call graph for this function:

◆ prepend_node()

void prepend_node ( xml_node< Ch > *  child)
inline

Prepends a new child node. The prepended child becomes the first child, and all existing children are moved one position back.

Parameters
childNode to prepend.

Definition at line 1076 of file rapidxml.hpp.

1077  {
1078  assert(child && !child->parent() && child->type() != node_document);
1079  if (first_node())
1080  {
1081  child->m_next_sibling = m_first_node;
1082  m_first_node->m_prev_sibling = child;
1083  }
1084  else
1085  {
1086  child->m_next_sibling = 0;
1087  m_last_node = child;
1088  }
1089  m_first_node = child;
1090  child->m_parent = this;
1091  child->m_prev_sibling = 0;
1092  }
xml_node< Ch > * m_first_node
Definition: rapidxml.hpp:1338
xml_node< Ch > * m_last_node
Definition: rapidxml.hpp:1339
A document node. Name and value are empty.
Definition: rapidxml.hpp:145
xml_node< Ch > * first_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Definition: rapidxml.hpp:936
Here is the call graph for this function:

◆ previous_sibling()

xml_node<Ch>* previous_sibling ( const Ch *  name = 0,
std::size_t  name_size = 0,
bool  case_sensitive = true 
) const
inline

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.

Parameters
nameName 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_sizeSize of name, in characters, or 0 to have size calculated automatically from string
case_sensitiveShould name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters
Returns
Pointer to found sibling, or 0 if not found.

Definition at line 981 of file rapidxml.hpp.

982  {
983  assert(this->m_parent); // Cannot query for siblings if node has no parent
984  if (name)
985  {
986  if (name_size == 0)
987  name_size = internal::measure(name);
988  for (xml_node<Ch> *sibling = m_prev_sibling; sibling; sibling = sibling->m_prev_sibling)
989  if (internal::compare(sibling->name(), sibling->name_size(), name, name_size, case_sensitive))
990  return sibling;
991  return 0;
992  }
993  else
994  return m_prev_sibling;
995  }
xml_node< Ch > * m_parent
Definition: rapidxml.hpp:788
xml_node< Ch > * m_prev_sibling
Definition: rapidxml.hpp:1342
Ch * name() const
Definition: rapidxml.hpp:673
std::size_t name_size() const
Definition: rapidxml.hpp:681
Here is the caller graph for this function:

◆ remove_all_attributes()

void remove_all_attributes ( )
inline

Removes all attributes of node.

Definition at line 1309 of file rapidxml.hpp.

1310  {
1311  for (xml_attribute<Ch> *attribute = first_attribute(); attribute; attribute = attribute->m_next_attribute)
1312  attribute->m_parent = 0;
1313  m_first_attribute = 0;
1314  }
xml_attribute< Ch > * m_first_attribute
Definition: rapidxml.hpp:1340
xml_attribute< Ch > * first_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Definition: rapidxml.hpp:1025

◆ remove_all_nodes()

void remove_all_nodes ( )
inline

Removes all child nodes (but not attributes).

Definition at line 1188 of file rapidxml.hpp.

1189  {
1190  for (xml_node<Ch> *node = first_node(); node; node = node->m_next_sibling)
1191  node->m_parent = 0;
1192  m_first_node = 0;
1193  }
xml_node< Ch > * m_first_node
Definition: rapidxml.hpp:1338
xml_node< Ch > * first_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Definition: rapidxml.hpp:936

◆ remove_attribute()

void remove_attribute ( xml_attribute< Ch > *  where)
inline

Removes specified attribute from node.

Parameters
wherePointer to attribute to be removed.

Definition at line 1293 of file rapidxml.hpp.

1294  {
1295  assert(first_attribute() && where->parent() == this);
1296  if (where == m_first_attribute)
1298  else if (where == m_last_attribute)
1300  else
1301  {
1302  where->m_prev_attribute->m_next_attribute = where->m_next_attribute;
1303  where->m_next_attribute->m_prev_attribute = where->m_prev_attribute;
1304  where->m_parent = 0;
1305  }
1306  }
void remove_first_attribute()
Definition: rapidxml.hpp:1260
xml_attribute< Ch > * m_last_attribute
Definition: rapidxml.hpp:1341
void remove_last_attribute()
Definition: rapidxml.hpp:1277
xml_attribute< Ch > * m_first_attribute
Definition: rapidxml.hpp:1340
xml_attribute< Ch > * first_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Definition: rapidxml.hpp:1025
Here is the call graph for this function:

◆ remove_first_attribute()

void remove_first_attribute ( )
inline

Removes first attribute of the node. If node has no attributes, behaviour is undefined. Use first_attribute() to test if node has attributes.

Definition at line 1260 of file rapidxml.hpp.

1261  {
1262  assert(first_attribute());
1263  xml_attribute<Ch> *attribute = m_first_attribute;
1264  if (attribute->m_next_attribute)
1265  {
1266  attribute->m_next_attribute->m_prev_attribute = 0;
1267  }
1268  else
1269  m_last_attribute = 0;
1270  attribute->m_parent = 0;
1271  m_first_attribute = attribute->m_next_attribute;
1272  }
xml_attribute< Ch > * m_last_attribute
Definition: rapidxml.hpp:1341
xml_attribute< Ch > * m_first_attribute
Definition: rapidxml.hpp:1340
xml_attribute< Ch > * first_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Definition: rapidxml.hpp:1025

◆ remove_first_node()

void remove_first_node ( )
inline

Removes first child node. If node has no children, behaviour is undefined. Use first_node() to test if node has children.

Definition at line 1140 of file rapidxml.hpp.

1141  {
1142  assert(first_node());
1143  xml_node<Ch> *child = m_first_node;
1144  m_first_node = child->m_next_sibling;
1145  if (child->m_next_sibling)
1146  child->m_next_sibling->m_prev_sibling = 0;
1147  else
1148  m_last_node = 0;
1149  child->m_parent = 0;
1150  }
xml_node< Ch > * m_first_node
Definition: rapidxml.hpp:1338
xml_node< Ch > * m_last_node
Definition: rapidxml.hpp:1339
xml_node< Ch > * first_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Definition: rapidxml.hpp:936

◆ remove_last_attribute()

void remove_last_attribute ( )
inline

Removes last attribute of the node. If node has no attributes, behaviour is undefined. Use first_attribute() to test if node has attributes.

Definition at line 1277 of file rapidxml.hpp.

1278  {
1279  assert(first_attribute());
1280  xml_attribute<Ch> *attribute = m_last_attribute;
1281  if (attribute->m_prev_attribute)
1282  {
1283  attribute->m_prev_attribute->m_next_attribute = 0;
1284  m_last_attribute = attribute->m_prev_attribute;
1285  }
1286  else
1287  m_first_attribute = 0;
1288  attribute->m_parent = 0;
1289  }
xml_attribute< Ch > * m_last_attribute
Definition: rapidxml.hpp:1341
xml_attribute< Ch > * m_first_attribute
Definition: rapidxml.hpp:1340
xml_attribute< Ch > * first_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Definition: rapidxml.hpp:1025

◆ remove_last_node()

void remove_last_node ( )
inline

Removes last child of the node. If node has no children, behaviour is undefined. Use first_node() to test if node has children.

Definition at line 1155 of file rapidxml.hpp.

1156  {
1157  assert(first_node());
1158  xml_node<Ch> *child = m_last_node;
1159  if (child->m_prev_sibling)
1160  {
1161  m_last_node = child->m_prev_sibling;
1162  child->m_prev_sibling->m_next_sibling = 0;
1163  }
1164  else
1165  m_first_node = 0;
1166  child->m_parent = 0;
1167  }
xml_node< Ch > * m_first_node
Definition: rapidxml.hpp:1338
xml_node< Ch > * m_last_node
Definition: rapidxml.hpp:1339
xml_node< Ch > * first_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Definition: rapidxml.hpp:936

◆ remove_node()

void remove_node ( xml_node< Ch > *  where)
inline

Removes specified child from the node.

Definition at line 1171 of file rapidxml.hpp.

1172  {
1173  assert(where && where->parent() == this);
1174  assert(first_node());
1175  if (where == m_first_node)
1177  else if (where == m_last_node)
1178  remove_last_node();
1179  else
1180  {
1181  where->m_prev_sibling->m_next_sibling = where->m_next_sibling;
1182  where->m_next_sibling->m_prev_sibling = where->m_prev_sibling;
1183  where->m_parent = 0;
1184  }
1185  }
void remove_first_node()
Definition: rapidxml.hpp:1140
xml_node< Ch > * m_first_node
Definition: rapidxml.hpp:1338
xml_node< Ch > * m_last_node
Definition: rapidxml.hpp:1339
xml_node< Ch > * first_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Definition: rapidxml.hpp:936
Here is the call graph for this function:

◆ type() [1/2]

node_type type ( ) const
inline

Gets type of node.

Returns
Type of node.

Definition at line 913 of file rapidxml.hpp.

914  {
915  return m_type;
916  }
Here is the caller graph for this function:

◆ type() [2/2]

void type ( node_type  type)
inline

Sets type of node.

Parameters
typeType of node to set.

Definition at line 1065 of file rapidxml.hpp.

1066  {
1067  m_type = type;
1068  }
node_type type() const
Definition: rapidxml.hpp:913

◆ value() [1/3]

Ch* value ( ) const
inlineinherited

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.

Definition at line 692 of file rapidxml.hpp.

693  {
694  return m_value ? m_value : nullstr();
695  }
static Ch * nullstr()
Definition: rapidxml.hpp:778
Here is the caller graph for this function:

◆ value() [2/3]

void value ( const Ch *  value,
std::size_t  size 
)
inlineinherited

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
valuevalue of node to set. Does not have to be zero terminated.
sizeSize of value, in characters. This does not include zero terminator, if one is present.

Definition at line 751 of file rapidxml.hpp.

752  {
753  m_value = const_cast<Ch *>(value);
754  m_value_size = size;
755  }
Ch * value() const
Definition: rapidxml.hpp:692
std::size_t m_value_size
Definition: rapidxml.hpp:787

◆ value() [3/3]

void value ( const Ch *  value)
inlineinherited

Sets value of node to a zero-terminated string. See also ownership_of_strings and xml_node::value(const Ch *, std::size_t).

Parameters
valueVame of node to set. Must be zero terminated.

Definition at line 760 of file rapidxml.hpp.

761  {
762  this->value(value, internal::measure(value));
763  }
Ch * value() const
Definition: rapidxml.hpp:692

◆ value_size()

std::size_t value_size ( ) const
inlineinherited

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.

Definition at line 700 of file rapidxml.hpp.

701  {
702  return m_value ? m_value_size : 0;
703  }
std::size_t m_value_size
Definition: rapidxml.hpp:787
Here is the caller graph for this function:

Member Data Documentation

◆ m_first_attribute

xml_attribute<Ch>* m_first_attribute
private

Definition at line 1340 of file rapidxml.hpp.

◆ m_first_node

xml_node<Ch>* m_first_node
private

Definition at line 1338 of file rapidxml.hpp.

◆ m_last_attribute

xml_attribute<Ch>* m_last_attribute
private

Definition at line 1341 of file rapidxml.hpp.

◆ m_last_node

xml_node<Ch>* m_last_node
private

Definition at line 1339 of file rapidxml.hpp.

◆ m_name

Ch* m_name
protectedinherited

Definition at line 784 of file rapidxml.hpp.

◆ m_name_size

std::size_t m_name_size
protectedinherited

Definition at line 786 of file rapidxml.hpp.

◆ m_next_sibling

xml_node<Ch>* m_next_sibling
private

Definition at line 1343 of file rapidxml.hpp.

◆ m_parent

xml_node<Ch>* m_parent
protectedinherited

Definition at line 788 of file rapidxml.hpp.

◆ m_prev_sibling

xml_node<Ch>* m_prev_sibling
private

Definition at line 1342 of file rapidxml.hpp.

◆ m_type

node_type m_type
private

Definition at line 1337 of file rapidxml.hpp.

◆ m_value

Ch* m_value
protectedinherited

Definition at line 785 of file rapidxml.hpp.

◆ m_value_size

std::size_t m_value_size
protectedinherited

Definition at line 787 of file rapidxml.hpp.


The documentation for this class was generated from the following file: