IAttributes.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. namespace irr
  8. {
  9. namespace video
  10. {
  11. class ITexture;
  12. } // end namespace video
  13. namespace io
  14. {
  15. //! Provides a generic interface for attributes and their values and the possibility to serialize them
  16. class IAttributes : public virtual IReferenceCounted
  17. {
  18. public:
  19. //! Returns the type of an attribute
  20. //! \param attributeName: Name for the attribute
  21. virtual E_ATTRIBUTE_TYPE getAttributeType(const c8 *attributeName) const = 0;
  22. //! Returns if an attribute with a name exists
  23. virtual bool existsAttribute(const c8 *attributeName) const = 0;
  24. //! Removes all attributes
  25. virtual void clear() = 0;
  26. /*
  27. Integer Attribute
  28. */
  29. //! Adds an attribute as integer
  30. virtual void addInt(const c8 *attributeName, s32 value) = 0;
  31. //! Sets an attribute as integer value
  32. virtual void setAttribute(const c8 *attributeName, s32 value) = 0;
  33. //! Gets an attribute as integer value
  34. //! \param attributeName: Name of the attribute to get.
  35. //! \param defaultNotFound Value returned when attributeName was not found
  36. //! \return Returns value of the attribute previously set by setAttribute()
  37. virtual s32 getAttributeAsInt(const c8 *attributeName, irr::s32 defaultNotFound = 0) const = 0;
  38. /*
  39. Float Attribute
  40. */
  41. //! Adds an attribute as float
  42. virtual void addFloat(const c8 *attributeName, f32 value) = 0;
  43. //! Sets a attribute as float value
  44. virtual void setAttribute(const c8 *attributeName, f32 value) = 0;
  45. //! Gets an attribute as float value
  46. //! \param attributeName: Name of the attribute to get.
  47. //! \param defaultNotFound Value returned when attributeName was not found
  48. //! \return Returns value of the attribute previously set by setAttribute()
  49. virtual f32 getAttributeAsFloat(const c8 *attributeName, irr::f32 defaultNotFound = 0.f) const = 0;
  50. /*
  51. Bool Attribute
  52. */
  53. //! Adds an attribute as bool
  54. virtual void addBool(const c8 *attributeName, bool value) = 0;
  55. //! Sets an attribute as boolean value
  56. virtual void setAttribute(const c8 *attributeName, bool value) = 0;
  57. //! Gets an attribute as boolean value
  58. //! \param attributeName: Name of the attribute to get.
  59. //! \param defaultNotFound Value returned when attributeName was not found
  60. //! \return Returns value of the attribute previously set by setAttribute()
  61. virtual bool getAttributeAsBool(const c8 *attributeName, bool defaultNotFound = false) const = 0;
  62. };
  63. } // end namespace io
  64. } // end namespace irr