XMLElement.pkg 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. $#include "XMLElement.h"
  2. /// Element in an XML file.
  3. class XMLElement
  4. {
  5. public:
  6. /// Return whether does not refer to an element or an XPath node.
  7. bool IsNull() const;
  8. /// Return whether refers to an element or an XPath node.
  9. bool NotNull() const;
  10. /// Return true if refers to an element or an XPath node.
  11. operator bool () const;
  12. /// Return element name (or attribute name if it is an attribute only XPath query result).
  13. String GetName() const;
  14. /// Return whether has a child element.
  15. bool HasChild(const char* name) const;
  16. /// Return whether has a child element.
  17. bool HasChild(const char* name) const;
  18. /// Return child element, or null if missing.
  19. XMLElement GetChild(const char* name) const;
  20. /// Return child element, or null if missing.
  21. XMLElement GetChild(const char* name) const;
  22. /// Return next sibling element.
  23. XMLElement GetNext(const char* name) const;
  24. /// Return next sibling element.
  25. XMLElement GetNext(const char* name) const;
  26. /// Return parent element.
  27. XMLElement GetParent() const;
  28. /// Return number of attributes.
  29. unsigned GetNumAttributes() const;
  30. /// Return whether has an attribute.
  31. bool HasAttribute(const char* name) const;
  32. /// Return whether has an attribute.
  33. bool HasAttribute(const char* name) const;
  34. /// Return bool attribute, or false if missing.
  35. bool GetBool(const char* name) const;
  36. /// Return bounding box attribute, or empty if missing.
  37. BoundingBox GetBoundingBox() const;
  38. /// Return a color attribute, or default if missing.
  39. Color GetColor(const char* name) const;
  40. /// Return a float attribute, or zero if missing.
  41. float GetFloat(const char* name) const;
  42. /// Return an unsigned integer attribute, or zero if missing.
  43. unsigned GetUInt(const char* name) const;
  44. /// Return an integer attribute, or zero if missing.
  45. int GetInt(const char* name) const;
  46. /// Return an IntRect attribute, or default if missing.
  47. IntRect GetIntRect(const char* name) const;
  48. /// Return an IntVector2 attribute, or default if missing.
  49. IntVector2 GetIntVector2(const char* name) const;
  50. /// Return a Rect attribute, or default if missing.
  51. Rect GetRect(const char* name) const;
  52. /// Return a quaternion attribute, or default if missing.
  53. Quaternion GetQuaternion(const char* name) const;
  54. /// Return a resource reference attribute, or empty if missing.
  55. ResourceRef GetResourceRef() const;
  56. /// Return a resource reference list attribute, or empty if missing.
  57. ResourceRefList GetResourceRefList() const;
  58. /// Return a Vector2 attribute, or default if missing.
  59. Vector2 GetVector2(const char* name) const;
  60. /// Return a Vector3 attribute, or default if missing.
  61. Vector3 GetVector3(const char* name) const;
  62. /// Return a Vector4 attribute, or default if missing.
  63. Vector4 GetVector4(const char* name) const;
  64. /// Return any Vector attribute as Vector4. Missing coordinates will be zero.
  65. Vector4 GetVector(const char* name) const;
  66. /// Return XML file.
  67. XMLFile* GetFile() const;
  68. /// Empty XMLElement.
  69. static const XMLElement EMPTY;
  70. };