Urho3D
Public Member Functions | Static Public Attributes | Private Attributes
Urho3D::XMLElement Class Reference

Element in an XML file. More...

#include <XMLElement.h>

List of all members.

Public Member Functions

 XMLElement ()
 Construct null element.
 XMLElement (XMLFile *file, pugi::xml_node_struct *node)
 Construct with document and node pointers.
 XMLElement (const XMLElement &rhs)
 Copy-construct from another element.
 ~XMLElement ()
 Destruct.
XMLElement CreateChild (const String &name)
 Create a child element.
XMLElement CreateChild (const char *name)
 Create a child element.
bool RemoveChild (const XMLElement &element)
 Remove a child element. Return true if successful.
bool RemoveChild (const String &name)
 Remove a child element by name. Return true if successful.
bool RemoveChild (const char *name)
 Remove a child element by name. Return true if successful.
bool RemoveChildren (const String &name=String())
 Remove child elements of certain name, or all child elements if name is empty. Return true if successful.
bool RemoveChildren (const char *name)
 Remove child elements of certain name, or all child elements if name is empty. Return true if successful.
bool SetAttribute (const String &name, const String &value)
 Set an attribute.
bool SetAttribute (const char *name, const char *value)
 Set an attribute.
bool SetBool (const String &name, bool value)
 Set a bool attribute.
bool SetBoundingBox (const BoundingBox &value)
 Set a BoundingBox attribute.
bool SetBuffer (const String &name, const void *data, unsigned size)
 Set a buffer attribute.
bool SetBuffer (const String &name, const PODVector< unsigned char > &value)
 Set a buffer attribute.
bool SetColor (const String &name, const Color &value)
 Set a color attribute.
bool SetFloat (const String &name, float value)
 Set a float attribute.
bool SetInt (const String &name, int value)
 Set an integer attribute.
bool SetIntRect (const String &name, const IntRect &value)
 Set an IntRect attribute.
bool SetIntVector2 (const String &name, const IntVector2 &value)
 Set an IntVector2 attribute.
bool SetRect (const String &name, const Rect &value)
 Set a Rect attribute.
bool SetQuaternion (const String &name, const Quaternion &value)
 Set a quaternion attribute.
bool SetString (const String &name, const String &value)
 Set a string attribute.
bool SetVariant (const Variant &value)
 Set a variant attribute.
bool SetVariantValue (const Variant &value)
 Set a variant attribute excluding the type.
bool SetResourceRef (const ResourceRef &value)
 Set a resource reference attribute.
bool SetResourceRefList (const ResourceRefList &value)
 Set a resource referene list attribute.
bool SetVariantVector (const VariantVector &value)
 Set a variant vector attribute. Creates child elements as necessary.
bool SetVariantMap (const VariantMap &value)
 Set a variant map attribute. Creates child elements as necessary.
bool SetVector2 (const String &name, const Vector2 &value)
 Set a Vector2 attribute.
bool SetVector3 (const String &name, const Vector3 &value)
 Set a Vector3 attribute.
bool SetVector4 (const String &name, const Vector4 &value)
 Set a Vector4 attribute.
bool IsNull () const
 Return whether does not refer to an element.
bool NotNull () const
 Return whether refers to an element.
 operator bool () const
 Return true if refers to an element.
String GetName () const
 Return element name.
bool HasChild (const String &name) const
 Return whether has a child element.
bool HasChild (const char *name) const
 Return whether has a child element.
XMLElement GetChild (const String &name=String()) const
 Return child element, or null if missing.
XMLElement GetChild (const char *name) const
 Return child element, or null if missing.
XMLElement GetNext (const String &name=String()) const
 Return next sibling element.
XMLElement GetNext (const char *name) const
 Return next sibling element.
XMLElement GetParent () const
 Return parent element.
unsigned GetNumAttributes () const
 Return number of attributes.
bool HasAttribute (const String &name) const
 Return whether has an attribute.
bool HasAttribute (const char *name) const
 Return whether has an attribute.
String GetAttribute (const String &name) const
 Return attribute, or empty if missing.
const char * GetAttribute (const char *name) const
 Return attribute, or empty if missing.
String GetAttributeLower (const String &name) const
 Return attribute in lowercase, or empty if missing.
String GetAttributeLower (const char *name) const
 Return attribute in lowercase, or empty if missing.
String GetAttributeUpper (const String &name) const
 Return attribute in lowercase, or empty if missing.
String GetAttributeUpper (const char *name) const
 Return attribute in lowercase, or empty if missing.
Vector< StringGetAttributeNames () const
 Return names of all attributes.
bool GetBool (const String &name) const
 Return bool attribute, or false if missing.
PODVector< unsigned char > GetBuffer (const String &name) const
 Return buffer attribute, or empty if missing.
bool GetBuffer (const String &name, void *dest, unsigned size) const
 Copy buffer attribute into a supplied buffer. Return true if buffer was large enough.
BoundingBox GetBoundingBox () const
 Return bounding box attribute, or empty if missing.
Color GetColor (const String &name) const
 Return a color attribute, or default if missing.
float GetFloat (const String &name) const
 Return a float attribute, or zero if missing.
int GetInt (const String &name) const
 Return an integer attribute, or zero if missing.
IntRect GetIntRect (const String &name) const
 Return an IntRect attribute, or default if missing.
IntVector2 GetIntVector2 (const String &name) const
 Return an IntVector2 attribute, or default if missing.
Rect GetRect (const String &name) const
 Return a Rect attribute, or default if missing.
Quaternion GetQuaternion (const String &name) const
 Return a quaternion attribute, or default if missing.
Variant GetVariant () const
 Return a variant attribute, or empty if missing.
Variant GetVariantValue (VariantType type) const
 Return a variant attribute with static type.
ResourceRef GetResourceRef () const
 Return a resource reference attribute, or empty if missing.
ResourceRefList GetResourceRefList () const
 Return a resource reference list attribute, or empty if missing.
VariantVector GetVariantVector () const
 Return a variant vector attribute, or empty if missing.
VariantMap GetVariantMap () const
 Return a variant map attribute, or empty if missing.
Vector2 GetVector2 (const String &name) const
 Return a Vector2 attribute, or default if missing.
Vector3 GetVector3 (const String &name) const
 Return a Vector3 attribute, or default if missing.
Vector4 GetVector4 (const String &name) const
 Return a Vector4 attribute, or default if missing.
Vector4 GetVector (const String &name) const
 Return any Vector attribute as Vector4. Missing coordinates will be zero.
XMLFileGetFile () const
 Return XML file.
pugi::xml_node_struct * GetNode () const
 Return pugixml node.s.

Static Public Attributes

static const XMLElement EMPTY
 Empty XMLElement.

Private Attributes

WeakPtr< XMLFilefile_
 XML file.
pugi::xml_node_struct * node_
 Pugixml node.

Detailed Description

Element in an XML file.


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