A TiXmlHandle is a class that wraps a node pointer with null checks; this is an incredibly useful thing. Note that TiXmlHandle is not part of the TinyXml DOM structure. It is a separate utility class. Take an example: @verbatim @endverbatim Assuming y
| 1636 | @endverbatim |
| 1637 | */ |
| 1638 | class TiXmlHandle |
| 1639 | { |
| 1640 | public: |
| 1641 | /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. |
| 1642 | TiXmlHandle( TiXmlNode* _node ) { this->node = _node; } |
| 1643 | /// Copy constructor |
| 1644 | TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; } |
| 1645 | TiXmlHandle operator=( const TiXmlHandle& ref ) { if ( &ref != this ) this->node = ref.node; return *this; } |
| 1646 | |
| 1647 | /// Return a handle to the first child node. |
| 1648 | TiXmlHandle FirstChild() const; |
| 1649 | /// Return a handle to the first child node with the given name. |
| 1650 | TiXmlHandle FirstChild( const char * value ) const; |
| 1651 | /// Return a handle to the first child element. |
| 1652 | TiXmlHandle FirstChildElement() const; |
| 1653 | /// Return a handle to the first child element with the given name. |
| 1654 | TiXmlHandle FirstChildElement( const char * value ) const; |
| 1655 | |
| 1656 | /** Return a handle to the "index" child with the given name. |
| 1657 | The first child is 0, the second 1, etc. |
| 1658 | */ |
| 1659 | TiXmlHandle Child( const char* value, int index ) const; |
| 1660 | /** Return a handle to the "index" child. |
| 1661 | The first child is 0, the second 1, etc. |
| 1662 | */ |
| 1663 | TiXmlHandle Child( int index ) const; |
| 1664 | /** Return a handle to the "index" child element with the given name. |
| 1665 | The first child element is 0, the second 1, etc. Note that only TiXmlElements |
| 1666 | are indexed: other types are not counted. |
| 1667 | */ |
| 1668 | TiXmlHandle ChildElement( const char* value, int index ) const; |
| 1669 | /** Return a handle to the "index" child element. |
| 1670 | The first child element is 0, the second 1, etc. Note that only TiXmlElements |
| 1671 | are indexed: other types are not counted. |
| 1672 | */ |
| 1673 | TiXmlHandle ChildElement( int index ) const; |
| 1674 | |
| 1675 | #ifdef TIXML_USE_STL |
| 1676 | TiXmlHandle FirstChild( const std::string& _value ) const { return FirstChild( _value.c_str() ); } |
| 1677 | TiXmlHandle FirstChildElement( const std::string& _value ) const { return FirstChildElement( _value.c_str() ); } |
| 1678 | |
| 1679 | TiXmlHandle Child( const std::string& _value, int index ) const { return Child( _value.c_str(), index ); } |
| 1680 | TiXmlHandle ChildElement( const std::string& _value, int index ) const { return ChildElement( _value.c_str(), index ); } |
| 1681 | #endif |
| 1682 | |
| 1683 | /** Return the handle as a TiXmlNode. This may return null. |
| 1684 | */ |
| 1685 | TiXmlNode* ToNode() const { return node; } |
| 1686 | /** Return the handle as a TiXmlElement. This may return null. |
| 1687 | */ |
| 1688 | TiXmlElement* ToElement() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); } |
| 1689 | /** Return the handle as a TiXmlText. This may return null. |
| 1690 | */ |
| 1691 | TiXmlText* ToText() const { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); } |
| 1692 | /** Return the handle as a TiXmlUnknown. This may return null. |
| 1693 | */ |
| 1694 | TiXmlUnknown* ToUnknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); } |
| 1695 |
no outgoing calls
no test coverage detected