#include <ticpp.h>

Public Member Functions | |
| Element () | |
| Default Constructor. | |
| Element (const std::string &value) | |
| Default Constructor. | |
| Element (const char *value) | |
| Default Constructor. | |
| Element (TiXmlElement *element) | |
| Constructor. | |
| template<class T> | |
| Element (const std::string &value, const T &text) | |
| Constructor that allows you to set the element text. | |
| Attribute * | FirstAttribute (bool throwIfNoAttributes=true) const |
| Access the first attribute in this element. | |
| Attribute * | LastAttribute (bool throwIfNoAttributes=true) const |
| Access the last attribute in this element. | |
| template<class T> | |
| void | SetAttribute (const std::string &name, const T &value) |
| Sets an attribute of name to a given value. | |
| std::string | GetText (bool throwIfNotFound=true) const |
| Gets the text of an Element. | |
| std::string | GetTextOrDefault (const std::string &defaultValue) const |
| Gets the text of an Element, if it doesn't exist it will return the defaultValue. | |
| template<class T, class DefaultT> | |
| void | GetTextOrDefault (T *value, const DefaultT &defaultValue) const |
| Gets the text value of an Element, if it doesn't exist it will return the defaultValue. | |
| template<class T> | |
| void | GetText (T *value, bool throwIfNotFound=true) const |
| Gets the text of an Element. | |
| template<class T> | |
| void | SetText (const T &value) |
| Convenience function to set the text of an element. | |
| template<class T, class DefaulT> | |
| void | GetAttributeOrDefault (const std::string &name, T *value, const DefaulT &defaultValue) const |
| Gets an attribute of name from an element, if it doesn't exist it will return the defaultValue. | |
| std::string | GetAttributeOrDefault (const std::string &name, const std::string &defaultValue) const |
| Gets an attribute of name from an element, if it doesn't exist it will return the defaultValue. | |
| template<class T> | |
| T | GetAttribute (const std::string &name, bool throwIfNotFound=true) const |
| Returns an attribute of name from an element. | |
| template<class T> | |
| void | GetAttribute (const std::string &name, T *value, bool throwIfNotFound=true) const |
| Gets an attribute of name from an element. | |
| std::string | GetAttribute (const std::string &name) const |
| Gets an attribute of name from an element. | |
| bool | HasAttribute (const std::string &name) const |
| Returns true, if attribute exists. | |
| void | RemoveAttribute (const std::string &name) |
| Removes attribute from element. | |
| ticpp::Element::Element | ( | const std::string & | value | ) |
Default Constructor.
Initializes all the variables.
| value | The value of the element. |
| ticpp::Element::Element | ( | const char * | value | ) |
Default Constructor.
Initializes all the variables.
| value | The value of the element. |
| ticpp::Element::Element | ( | const std::string & | value, | |
| const T & | text | |||
| ) | [inline] |
Constructor that allows you to set the element text.
| value | The value of the element. | |
| text | The text to set. |
References ticpp::Base::m_impRC, and SetText().
| Attribute* ticpp::Element::FirstAttribute | ( | bool | throwIfNoAttributes = true |
) | const |
Access the first attribute in this element.
| throwIfNoAttributes | [DEF] If true, throws when there are no attributes |
| Attribute* ticpp::Element::LastAttribute | ( | bool | throwIfNoAttributes = true |
) | const |
Access the last attribute in this element.
| throwIfNoAttributes | [DEF] If true, throws when there are no attributes |
| void ticpp::Element::SetAttribute | ( | const std::string & | name, | |
| const T & | value | |||
| ) | [inline] |
Sets an attribute of name to a given value.
The attribute will be created if it does not exist, or changed if it does. Uses ToString to convert the value to a string, so there is no need to use any other SetAttribute methods.
References ticpp::NodeImp< TiXmlElement >::m_tiXmlPointer, TiXmlElement::SetAttribute(), and ticpp::Base::ToString().
| std::string ticpp::Element::GetText | ( | bool | throwIfNotFound = true |
) | const [inline] |
Gets the text of an Element.
| throwIfNotFound | [DEF] If true, will throw an exception if there is no text in this element |
| Exception | When there is no text and throwIfNotFound is true |
GetTextOrDefault( T* value, const DefaultT& defaultValue )
| std::string ticpp::Element::GetTextOrDefault | ( | const std::string & | defaultValue | ) | const [inline] |
Gets the text of an Element, if it doesn't exist it will return the defaultValue.
| defaultValue | What to put in 'value' if there is no text in this element |
| void ticpp::Element::GetTextOrDefault | ( | T * | value, | |
| const DefaultT & | defaultValue | |||
| ) | const [inline] |
Gets the text value of an Element, if it doesn't exist it will return the defaultValue.
Uses FromString to convert the string to the type of choice
| value | [OUT] The container for the returned value | |
| defaultValue | What to put in 'value' if there is no text in this element |
This only works if the Text is the FirstChild node
GetText( T* value, bool throwIfNotFound = false )
GetTextOrDefault( const std::string& defaultValue )
References ticpp::Base::FromString().
| void ticpp::Element::GetText | ( | T * | value, | |
| bool | throwIfNotFound = true | |||
| ) | const [inline] |
Gets the text of an Element.
Uses FromString to convert the string to the type of choice.
| value | [OUT] The container for the returned value | |
| throwIfNotFound | [DEF] If true, will throw an exception if there is no text in this element |
This only works if the Text is the FirstChild node
| Exception | When there is no text and throwIfNotFound is true |
GetTextOrDefault( T* value, const DefaultT& defaultValue )
References ticpp::Base::FromString().
| void ticpp::Element::SetText | ( | const T & | value | ) | [inline] |
Convenience function to set the text of an element.
Creates a Text node and inserts it as the first child. Uses ToString to convert the parameter to a string.
| value | The text to set. |
References TiXmlNode::FirstChild(), TiXmlElement::GetText(), TiXmlNode::InsertBeforeChild(), TiXmlNode::LinkEndChild(), ticpp::NodeImp< TiXmlElement >::m_tiXmlPointer, TiXmlNode::NoChildren(), TiXmlNode::SetValue(), and ticpp::Base::ToString().
Referenced by Element().
| void ticpp::Element::GetAttributeOrDefault | ( | const std::string & | name, | |
| T * | value, | |||
| const DefaulT & | defaultValue | |||
| ) | const [inline] |
Gets an attribute of name from an element, if it doesn't exist it will return the defaultValue.
Uses FromString to convert the string to the type of choice.
| name | The name of the attribute you are querying. | |
| value | [OUT] The container for the returned value. | |
| defaultValue | What to put in value if there is no attribute in this element. |
| Exception |
References ticpp::Base::FromString().
| std::string ticpp::Element::GetAttributeOrDefault | ( | const std::string & | name, | |
| const std::string & | defaultValue | |||
| ) | const |
Gets an attribute of name from an element, if it doesn't exist it will return the defaultValue.
| name | The name of the attribute you are querying. | |
| defaultValue | What to put in value if there is no attribute in this element. |
| T ticpp::Element::GetAttribute | ( | const std::string & | name, | |
| bool | throwIfNotFound = true | |||
| ) | const [inline] |
Returns an attribute of name from an element.
Uses FromString to convert the string to the type of choice.
| name | The name of the attribute you are querying. | |
| throwIfNotFound | [DEF] If true, will throw an exception if the attribute doesn't exist |
| Exception | When the attribute doesn't exist and throwIfNotFound is true |
References ticpp::Base::FromString().
| void ticpp::Element::GetAttribute | ( | const std::string & | name, | |
| T * | value, | |||
| bool | throwIfNotFound = true | |||
| ) | const [inline] |
Gets an attribute of name from an element.
Uses FromString to convert the string to the type of choice.
| name | The name of the attribute you are querying. | |
| value | [OUT] The container for the returned value | |
| throwIfNotFound | [DEF] If true, will throw an exception if the attribute doesn't exist |
| Exception | When the attribute doesn't exist and throwIfNotFound is true |
References ticpp::Base::FromString().
| std::string ticpp::Element::GetAttribute | ( | const std::string & | name | ) | const |
Gets an attribute of name from an element.
Returns an empty string if the attribute does not exist.
| name | The name of the attribute you are querying. |
| bool ticpp::Element::HasAttribute | ( | const std::string & | name | ) | const |
Returns true, if attribute exists.
| name | The name of the attribute you are checking. |
| void ticpp::Element::RemoveAttribute | ( | const std::string & | name | ) |
Removes attribute from element.
| name | The name of the attribute to remove. |
1.5.6