1 // Copyright (C) 2002-2012 Nikolaus Gebhardt
\r
2 // This file is part of the "Irrlicht Engine".
\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
\r
5 #ifndef __C_ATTRIBUTES_H_INCLUDED__
\r
6 #define __C_ATTRIBUTES_H_INCLUDED__
\r
9 #include "IAttributes.h"
\r
10 #include "IAttribute.h"
\r
23 //! Implementation of the IAttributes interface
\r
24 class CAttributes : public IAttributes
\r
28 CAttributes(video::IVideoDriver* driver=0);
\r
31 //! Returns amount of attributes in this collection of attributes.
\r
32 u32 getAttributeCount() const override;
\r
34 //! Returns attribute name by index.
\r
35 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
\r
36 const c8* getAttributeName(s32 index) const override;
\r
38 //! Returns the type of an attribute
\r
39 //! \param attributeName: Name for the attribute
\r
40 E_ATTRIBUTE_TYPE getAttributeType(const c8* attributeName) const override;
\r
42 //! Returns attribute type by index.
\r
43 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
\r
44 E_ATTRIBUTE_TYPE getAttributeType(s32 index) const override;
\r
46 //! Returns the type string of the attribute
\r
47 //! \param attributeName: String for the attribute type
\r
48 //! \param defaultNotFound Value returned when attributeName was not found
\r
49 const wchar_t* getAttributeTypeString(const c8* attributeName, const wchar_t* defaultNotFound = L"unknown") const override;
\r
51 //! Returns the type string of the attribute by index.
\r
52 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
\r
53 const wchar_t* getAttributeTypeString(s32 index, const wchar_t* defaultNotFound = L"unknown") const override;
\r
55 //! Returns if an attribute with a name exists
\r
56 bool existsAttribute(const c8* attributeName) const override;
\r
58 //! Returns attribute index from name, -1 if not found
\r
59 s32 findAttribute(const c8* attributeName) const override;
\r
61 //! Removes all attributes
\r
62 void clear() override;
\r
71 //! Adds an attribute as integer
\r
72 void addInt(const c8* attributeName, s32 value) override;
\r
74 //! Sets an attribute as integer value
\r
75 void setAttribute(const c8* attributeName, s32 value) override;
\r
77 //! Gets an attribute as integer value
\r
78 //! \param attributeName: Name of the attribute to get.
\r
79 //! \param defaultNotFound Value returned when attributeName was not found
\r
80 //! \return Returns value of the attribute previously set by setAttribute()
\r
81 s32 getAttributeAsInt(const c8* attributeName, irr::s32 defaultNotFound=0) const override;
\r
83 //! Gets an attribute as integer value
\r
84 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
\r
85 s32 getAttributeAsInt(s32 index) const override;
\r
87 //! Sets an attribute as integer value
\r
88 void setAttribute(s32 index, s32 value) override;
\r
96 //! Adds an attribute as float
\r
97 void addFloat(const c8* attributeName, f32 value) override;
\r
99 //! Sets a attribute as float value
\r
100 void setAttribute(const c8* attributeName, f32 value) override;
\r
102 //! Gets an attribute as float value
\r
103 //! \param attributeName: Name of the attribute to get.
\r
104 //! \param defaultNotFound Value returned when attributeName was not found
\r
105 //! \return Returns value of the attribute previously set by setAttribute()
\r
106 f32 getAttributeAsFloat(const c8* attributeName, irr::f32 defaultNotFound=0.f) const override;
\r
108 //! Gets an attribute as float value
\r
109 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
\r
110 f32 getAttributeAsFloat(s32 index) const override;
\r
112 //! Sets an attribute as float value
\r
113 void setAttribute(s32 index, f32 value) override;
\r
120 //! Adds an attribute as bool
\r
121 void addBool(const c8* attributeName, bool value) override;
\r
123 //! Sets an attribute as boolean value
\r
124 void setAttribute(const c8* attributeName, bool value) override;
\r
126 //! Gets an attribute as boolean value
\r
127 //! \param attributeName: Name of the attribute to get.
\r
128 //! \param defaultNotFound Value returned when attributeName was not found
\r
129 //! \return Returns value of the attribute previously set by setAttribute()
\r
130 bool getAttributeAsBool(const c8* attributeName, bool defaultNotFound=false) const override;
\r
132 //! Gets an attribute as boolean value
\r
133 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
\r
134 bool getAttributeAsBool(s32 index) const override;
\r
136 //! Sets an attribute as boolean value
\r
137 void setAttribute(s32 index, bool value) override;
\r
141 core::array<IAttribute*> Attributes;
\r
143 IAttribute* getAttributeP(const c8* attributeName) const;
\r
145 video::IVideoDriver* Driver;
\r
148 } // end namespace io
\r
149 } // end namespace irr
\r