cphot 0.1
A C++ tool for computing photometry from spectra.
rapidxml::xml_node< Ch > Class Template Reference

Class representing a node of XML document. More...

#include <rapidxml.hpp>

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...
 
void prefix (const Ch *prefix, std::size_t size)
 
void prefix (const Ch *prefix)
 
Ch * prefix () const
 
std::size_t prefix_size () const
 
Ch * xmlns () const
 
void xmlns_lookup (Ch *&xmlns, size_t &xmlns_size, Ch *prefix, size_t prefix_size) const
 
std::size_t xmlns_size () const
 
xml_document< Ch > * document () const
 Gets document of which node is a child. More...
 
xml_node< Ch > * first_node (const Ch *name=0, const Ch *xmlns=0, std::size_t name_size=0, std::size_t xmlns_size=0, bool case_sensitive=true) const
 Gets first child node, optionally matching node name. More...
 
xml_node< Ch > * last_node (const Ch *name=0, const Ch *xmlns=0, std::size_t name_size=0, std::size_t xmlns_size=0, bool case_sensitive=true) const
 Gets last child node, optionally matching node name. More...
 
xml_node< Ch > * previous_sibling (const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
 Gets previous sibling node, optionally matching node name. More...
 
xml_node< Ch > * next_sibling (const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
 Gets next sibling node, optionally matching node name. More...
 
xml_attribute< Ch > * first_attribute (const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
 Gets first attribute of node, optionally matching attribute name. More...
 
xml_attribute< Ch > * last_attribute (const Ch *name=0, 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< Ch > *child)
 Prepends a new child node. More...
 
void append_node (xml_node< Ch > *child)
 Appends a new child node. More...
 
void insert_node (xml_node< Ch > *where, xml_node< Ch > *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< 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)
 Prepends a new attribute to the node. More...
 
void append_attribute (xml_attribute< Ch > *attribute)
 Appends a new attribute to the node. More...
 
void insert_attribute (xml_attribute< Ch > *where, xml_attribute< Ch > *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< Ch > *where)
 Removes specified attribute from node. More...
 
void remove_all_attributes ()
 Removes all attributes of node. More...
 
void validate () const
 

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 140 of file rapidxml.hpp.

Constructor & Destructor Documentation

◆ xml_node()

template<class Ch = char>
rapidxml::xml_node< Ch >::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 985 of file rapidxml.hpp.

Member Function Documentation

◆ append_attribute()

template<class Ch = char>
void rapidxml::xml_node< Ch >::append_attribute ( xml_attribute< Ch > *  attribute)
inline

Appends a new attribute to the node.

Parameters
attributeAttribute to append.

Definition at line 1400 of file rapidxml.hpp.

◆ append_node()

template<class Ch = char>
void rapidxml::xml_node< Ch >::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 1280 of file rapidxml.hpp.

◆ document()

template<class Ch = char>
xml_document<Ch>* rapidxml::xml_node< 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 1102 of file rapidxml.hpp.

◆ first_attribute()

template<class Ch = char>
xml_attribute<Ch>* rapidxml::xml_node< 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 1208 of file rapidxml.hpp.

◆ first_node()

template<class Ch = char>
xml_node<Ch>* rapidxml::xml_node< Ch >::first_node ( const Ch *  name = 0,
const Ch *  xmlns = 0,
std::size_t  name_size = 0,
std::size_t  xmlns_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 1115 of file rapidxml.hpp.

◆ insert_attribute()

template<class Ch = char>
void rapidxml::xml_node< Ch >::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 1422 of file rapidxml.hpp.

◆ insert_node()

template<class Ch = char>
void rapidxml::xml_node< Ch >::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 1302 of file rapidxml.hpp.

◆ last_attribute()

template<class Ch = char>
xml_attribute<Ch>* rapidxml::xml_node< 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 1228 of file rapidxml.hpp.

◆ last_node()

template<class Ch = char>
xml_node<Ch>* rapidxml::xml_node< Ch >::last_node ( const Ch *  name = 0,
const Ch *  xmlns = 0,
std::size_t  name_size = 0,
std::size_t  xmlns_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 1139 of file rapidxml.hpp.

◆ next_sibling()

template<class Ch = char>
xml_node<Ch>* rapidxml::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 1187 of file rapidxml.hpp.

◆ prefix() [1/3]

template<class Ch = char>
Ch* rapidxml::xml_node< Ch >::prefix ( ) const
inline

Definition at line 1014 of file rapidxml.hpp.

◆ prefix() [2/3]

template<class Ch = char>
void rapidxml::xml_node< Ch >::prefix ( const Ch *  prefix)
inline

Definition at line 1009 of file rapidxml.hpp.

◆ prefix() [3/3]

template<class Ch = char>
void rapidxml::xml_node< Ch >::prefix ( const Ch *  prefix,
std::size_t  size 
)
inline

Definition at line 1004 of file rapidxml.hpp.

◆ prefix_size()

template<class Ch = char>
std::size_t rapidxml::xml_node< Ch >::prefix_size ( ) const
inline

Definition at line 1019 of file rapidxml.hpp.

◆ prepend_attribute()

template<class Ch = char>
void rapidxml::xml_node< Ch >::prepend_attribute ( xml_attribute< Ch > *  attribute)
inline

Prepends a new attribute to the node.

Parameters
attributeAttribute to prepend.

Definition at line 1380 of file rapidxml.hpp.

◆ prepend_node()

template<class Ch = char>
void rapidxml::xml_node< Ch >::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 1259 of file rapidxml.hpp.

◆ previous_sibling()

template<class Ch = char>
xml_node<Ch>* rapidxml::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 1164 of file rapidxml.hpp.

◆ remove_all_attributes()

template<class Ch = char>
void rapidxml::xml_node< Ch >::remove_all_attributes ( )
inline

Removes all attributes of node.

Definition at line 1492 of file rapidxml.hpp.

◆ remove_all_nodes()

template<class Ch = char>
void rapidxml::xml_node< Ch >::remove_all_nodes ( )
inline

Removes all child nodes (but not attributes).

Definition at line 1371 of file rapidxml.hpp.

◆ remove_attribute()

template<class Ch = char>
void rapidxml::xml_node< Ch >::remove_attribute ( xml_attribute< Ch > *  where)
inline

Removes specified attribute from node.

Parameters
wherePointer to attribute to be removed.

Definition at line 1476 of file rapidxml.hpp.

◆ remove_first_attribute()

template<class Ch = char>
void rapidxml::xml_node< Ch >::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 1443 of file rapidxml.hpp.

◆ remove_first_node()

template<class Ch = char>
void rapidxml::xml_node< Ch >::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 1323 of file rapidxml.hpp.

◆ remove_last_attribute()

template<class Ch = char>
void rapidxml::xml_node< Ch >::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 1460 of file rapidxml.hpp.

◆ remove_last_node()

template<class Ch = char>
void rapidxml::xml_node< Ch >::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 1338 of file rapidxml.hpp.

◆ remove_node()

template<class Ch = char>
void rapidxml::xml_node< Ch >::remove_node ( xml_node< Ch > *  where)
inline

Removes specified child from the node.

Definition at line 1354 of file rapidxml.hpp.

◆ type() [1/2]

template<class Ch = char>
node_type rapidxml::xml_node< Ch >::type ( ) const
inline

Gets type of node.

Returns
Type of node.

Definition at line 999 of file rapidxml.hpp.

◆ type() [2/2]

template<class Ch = char>
void rapidxml::xml_node< Ch >::type ( node_type  type)
inline

Sets type of node.

Parameters
typeType of node to set.

Definition at line 1248 of file rapidxml.hpp.

◆ validate()

template<class Ch = char>
void rapidxml::xml_node< Ch >::validate ( ) const
inline

Definition at line 1499 of file rapidxml.hpp.

◆ xmlns()

template<class Ch = char>
Ch* rapidxml::xml_node< Ch >::xmlns ( ) const
inline

Definition at line 1024 of file rapidxml.hpp.

◆ xmlns_lookup()

template<class Ch = char>
void rapidxml::xml_node< Ch >::xmlns_lookup ( Ch *&  xmlns,
size_t &  xmlns_size,
Ch *  prefix,
size_t  prefix_size 
) const
inline

Definition at line 1031 of file rapidxml.hpp.

◆ xmlns_size()

template<class Ch = char>
std::size_t rapidxml::xml_node< Ch >::xmlns_size ( ) const
inline

Definition at line 1090 of file rapidxml.hpp.


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