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

Base class for xml_node and xml_attribute implementing common functions: name(), name_size(), value(), value_size() and parent(). More...

#include <rapidxml.hpp>

Public Member Functions

 xml_base ()
 
Ch * name () const
 Gets name of the node. More...
 
std::size_t name_size () const
 Gets size of node name, not including terminator character. More...
 
Ch * 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 Ch *name, std::size_t size)
 Sets name of node to a non zero-terminated string. More...
 
void name (const Ch *name)
 Sets name of node to a zero-terminated string. More...
 
void value (const Ch *value, std::size_t size)
 Sets value of node to a non zero-terminated string. More...
 
void value (const Ch *value)
 Sets value of node to a zero-terminated string. More...
 
xml_node< Ch > * parent () const
 Gets node parent. More...
 

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
 

Detailed Description

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

Base class for xml_node and xml_attribute implementing common functions: name(), name_size(), value(), value_size() and parent().

Parameters
ChCharacter type to use

Definition at line 703 of file rapidxml.hpp.

Constructor & Destructor Documentation

◆ xml_base()

template<class Ch = char>
rapidxml::xml_base< Ch >::xml_base ( )
inline

Definition at line 712 of file rapidxml.hpp.

Member Function Documentation

◆ name() [1/3]

template<class Ch = char>
Ch* rapidxml::xml_base< Ch >::name ( ) const
inline

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

◆ name() [2/3]

template<class Ch = char>
void rapidxml::xml_base< Ch >::name ( const Ch *  name)
inline

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

◆ name() [3/3]

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

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

◆ name_size()

template<class Ch = char>
std::size_t rapidxml::xml_base< Ch >::name_size ( ) const
inline

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

◆ parent()

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

Gets node parent.

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

Definition at line 823 of file rapidxml.hpp.

◆ value() [1/3]

template<class Ch = char>
Ch* rapidxml::xml_base< Ch >::value ( ) const
inline

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

◆ value() [2/3]

template<class Ch = char>
void rapidxml::xml_base< Ch >::value ( const Ch *  value)
inline

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

◆ value() [3/3]

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

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

◆ value_size()

template<class Ch = char>
std::size_t rapidxml::xml_base< Ch >::value_size ( ) const
inline

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

Member Data Documentation

◆ m_name

template<class Ch = char>
Ch* rapidxml::xml_base< Ch >::m_name
protected

Definition at line 829 of file rapidxml.hpp.

◆ m_name_size

template<class Ch = char>
std::size_t rapidxml::xml_base< Ch >::m_name_size
protected

Definition at line 831 of file rapidxml.hpp.

◆ m_parent

template<class Ch = char>
xml_node<Ch>* rapidxml::xml_base< Ch >::m_parent
protected

Definition at line 833 of file rapidxml.hpp.

◆ m_value

template<class Ch = char>
Ch* rapidxml::xml_base< Ch >::m_value
protected

Definition at line 830 of file rapidxml.hpp.

◆ m_value_size

template<class Ch = char>
std::size_t rapidxml::xml_base< Ch >::m_value_size
protected

Definition at line 832 of file rapidxml.hpp.


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