YAGE  v0.1.1
Yet Another Game Engine
rapidxml::xml_attribute< Ch > Class Template Reference

Class representing attribute node of XML document. Each attribute has name and value strings, which are available through name() and value() functions (inherited from xml_base). Note that after parse, both name and value of attribute will point to interior of source text used for parsing. Thus, this text must persist in memory for the lifetime of attribute. More...

#include <rapidxml.h>

Inheritance diagram for rapidxml::xml_attribute< Ch >:
rapidxml::xml_base< Ch >

Public Member Functions

 xml_attribute ()
 Constructs an empty attribute with the specified type. Consider using memory_pool of appropriate xml_document if allocating attributes manually. More...
 
xml_document< Ch > * document () const
 Gets document of which attribute is a child. More...
 
xml_attribute< Ch > * previous_attribute (const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
 Gets previous attribute, optionally matching attribute name. More...
 
xml_attribute< Ch > * next_attribute (const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
 Gets next attribute, optionally matching attribute name. More...
 
- Public Member Functions inherited from rapidxml::xml_base< Ch >
 xml_base ()
 
Ch * 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. More...
 
std::size_t 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. More...
 
Ch * 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. More...
 
std::size_t 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. More...
 
void name (const Ch *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). More...
 
void name (const Ch *name)
 Sets name of node to a zero-terminated string. See also ownership_of_strings and xml_node::name(const Ch *, std::size_t). More...
 
void value (const Ch *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. More...
 
void value (const Ch *value)
 Sets value of node to a zero-terminated string. See also ownership_of_strings and xml_node::value(const Ch *, std::size_t). More...
 
xml_node< Ch > * parent () const
 Gets node parent. More...
 

Private Attributes

xml_attribute< Ch > * m_prev_attribute
 
xml_attribute< Ch > * m_next_attribute
 

Friends

class xml_node< Ch >
 

Additional Inherited Members

- Static Protected Member Functions inherited from rapidxml::xml_base< Ch >
static Ch * nullstr ()
 
- Protected Attributes inherited from rapidxml::xml_base< Ch >
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_attribute< Ch >

Parameters
ChCharacter type to use.

Constructor & Destructor Documentation

◆ xml_attribute()

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

Member Function Documentation

◆ document()

template<class Ch = char>
xml_document<Ch>* rapidxml::xml_attribute< Ch >::document ( ) const
inline
Returns
Pointer to document that contains this attribute, or 0 if there is no parent document.

◆ next_attribute()

template<class Ch = char>
xml_attribute<Ch>* rapidxml::xml_attribute< Ch >::next_attribute ( const Ch *  name = 0,
std::size_t  name_size = 0,
bool  case_sensitive = true 
) const
inline
Parameters
nameName of attribute to find, or 0 to return next 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.

◆ previous_attribute()

template<class Ch = char>
xml_attribute<Ch>* rapidxml::xml_attribute< Ch >::previous_attribute ( const Ch *  name = 0,
std::size_t  name_size = 0,
bool  case_sensitive = true 
) const
inline
Parameters
nameName of attribute to find, or 0 to return previous 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.

Friends And Related Function Documentation

◆ xml_node< Ch >

template<class Ch = char>
friend class xml_node< Ch >
friend

Member Data Documentation

◆ m_next_attribute

template<class Ch = char>
xml_attribute<Ch>* rapidxml::xml_attribute< Ch >::m_next_attribute
private

◆ m_prev_attribute

template<class Ch = char>
xml_attribute<Ch>* rapidxml::xml_attribute< Ch >::m_prev_attribute
private

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