IAttributes.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // Copyright (C) 2002-2012 Nikolaus Gebhardt
  2. // This file is part of the "Irrlicht Engine".
  3. // For conditions of distribution and use, see copyright notice in irrlicht.h
  4. #pragma once
  5. #include "IReferenceCounted.h"
  6. #include "EAttributes.h"
  7. // not needed here but I can't be bothered to clean the transitive includes up.
  8. #include "quaternion.h"
  9. namespace irr
  10. {
  11. namespace video
  12. {
  13. class ITexture;
  14. } // end namespace video
  15. namespace io
  16. {
  17. //! Provides a generic interface for attributes and their values and the possibility to serialize them
  18. class IAttributes : public virtual IReferenceCounted
  19. {
  20. public:
  21. //! Returns the type of an attribute
  22. //! \param attributeName: Name for the attribute
  23. virtual E_ATTRIBUTE_TYPE getAttributeType(const c8 *attributeName) const = 0;
  24. //! Returns if an attribute with a name exists
  25. virtual bool existsAttribute(const c8 *attributeName) const = 0;
  26. //! Removes all attributes
  27. virtual void clear() = 0;
  28. /*
  29. Integer Attribute
  30. */
  31. //! Adds an attribute as integer
  32. virtual void addInt(const c8 *attributeName, s32 value) = 0;
  33. //! Sets an attribute as integer value
  34. virtual void setAttribute(const c8 *attributeName, s32 value) = 0;
  35. //! Gets an attribute as integer value
  36. //! \param attributeName: Name of the attribute to get.
  37. //! \param defaultNotFound Value returned when attributeName was not found
  38. //! \return Returns value of the attribute previously set by setAttribute()
  39. virtual s32 getAttributeAsInt(const c8 *attributeName, irr::s32 defaultNotFound = 0) const = 0;
  40. /*
  41. Float Attribute
  42. */
  43. //! Adds an attribute as float
  44. virtual void addFloat(const c8 *attributeName, f32 value) = 0;
  45. //! Sets a attribute as float value
  46. virtual void setAttribute(const c8 *attributeName, f32 value) = 0;
  47. //! Gets an attribute as float value
  48. //! \param attributeName: Name of the attribute to get.
  49. //! \param defaultNotFound Value returned when attributeName was not found
  50. //! \return Returns value of the attribute previously set by setAttribute()
  51. virtual f32 getAttributeAsFloat(const c8 *attributeName, irr::f32 defaultNotFound = 0.f) const = 0;
  52. /*
  53. Bool Attribute
  54. */
  55. //! Adds an attribute as bool
  56. virtual void addBool(const c8 *attributeName, bool value) = 0;
  57. //! Sets an attribute as boolean value
  58. virtual void setAttribute(const c8 *attributeName, bool value) = 0;
  59. //! Gets an attribute as boolean value
  60. //! \param attributeName: Name of the attribute to get.
  61. //! \param defaultNotFound Value returned when attributeName was not found
  62. //! \return Returns value of the attribute previously set by setAttribute()
  63. virtual bool getAttributeAsBool(const c8 *attributeName, bool defaultNotFound = false) const = 0;
  64. };
  65. } // end namespace io
  66. } // end namespace irr