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
8 #include "IrrCompileConfig.h"
\r
10 #include "IAttributes.h"
\r
11 #include "IAttribute.h"
\r
24 //! Implementation of the IAttributes interface
\r
25 class CAttributes : public IAttributes
\r
29 CAttributes(video::IVideoDriver* driver=0);
\r
32 //! Returns amount of attributes in this collection of attributes.
\r
33 u32 getAttributeCount() const override;
\r
35 //! Returns attribute name by index.
\r
36 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
\r
37 const c8* getAttributeName(s32 index) const override;
\r
39 //! Returns the type of an attribute
\r
40 //! \param attributeName: Name for the attribute
\r
41 E_ATTRIBUTE_TYPE getAttributeType(const c8* attributeName) const override;
\r
43 //! Returns attribute type by index.
\r
44 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
\r
45 E_ATTRIBUTE_TYPE getAttributeType(s32 index) const override;
\r
47 //! Returns the type string of the attribute
\r
48 //! \param attributeName: String for the attribute type
\r
49 //! \param defaultNotFound Value returned when attributeName was not found
\r
50 const wchar_t* getAttributeTypeString(const c8* attributeName, const wchar_t* defaultNotFound = L"unknown") const override;
\r
52 //! Returns the type string of the attribute by index.
\r
53 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
\r
54 const wchar_t* getAttributeTypeString(s32 index, const wchar_t* defaultNotFound = L"unknown") const override;
\r
56 //! Returns if an attribute with a name exists
\r
57 bool existsAttribute(const c8* attributeName) const override;
\r
59 //! Returns attribute index from name, -1 if not found
\r
60 s32 findAttribute(const c8* attributeName) const override;
\r
62 //! Removes all attributes
\r
63 void clear() override;
\r
72 //! Adds an attribute as integer
\r
73 void addInt(const c8* attributeName, s32 value) override;
\r
75 //! Sets an attribute as integer value
\r
76 void setAttribute(const c8* attributeName, s32 value) override;
\r
78 //! Gets an attribute as integer value
\r
79 //! \param attributeName: Name of the attribute to get.
\r
80 //! \param defaultNotFound Value returned when attributeName was not found
\r
81 //! \return Returns value of the attribute previously set by setAttribute()
\r
82 s32 getAttributeAsInt(const c8* attributeName, irr::s32 defaultNotFound=0) const override;
\r
84 //! Gets an attribute as integer value
\r
85 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
\r
86 s32 getAttributeAsInt(s32 index) const override;
\r
88 //! Sets an attribute as integer value
\r
89 void setAttribute(s32 index, s32 value) override;
\r
97 //! Adds an attribute as float
\r
98 void addFloat(const c8* attributeName, f32 value) override;
\r
100 //! Sets a attribute as float value
\r
101 void setAttribute(const c8* attributeName, f32 value) override;
\r
103 //! Gets an attribute as float value
\r
104 //! \param attributeName: Name of the attribute to get.
\r
105 //! \param defaultNotFound Value returned when attributeName was not found
\r
106 //! \return Returns value of the attribute previously set by setAttribute()
\r
107 f32 getAttributeAsFloat(const c8* attributeName, irr::f32 defaultNotFound=0.f) const override;
\r
109 //! Gets an attribute as float value
\r
110 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
\r
111 f32 getAttributeAsFloat(s32 index) const override;
\r
113 //! Sets an attribute as float value
\r
114 void setAttribute(s32 index, f32 value) override;
\r
121 //! Adds an attribute as bool
\r
122 void addBool(const c8* attributeName, bool value) override;
\r
124 //! Sets an attribute as boolean value
\r
125 void setAttribute(const c8* attributeName, bool value) override;
\r
127 //! Gets an attribute as boolean value
\r
128 //! \param attributeName: Name of the attribute to get.
\r
129 //! \param defaultNotFound Value returned when attributeName was not found
\r
130 //! \return Returns value of the attribute previously set by setAttribute()
\r
131 bool getAttributeAsBool(const c8* attributeName, bool defaultNotFound=false) const override;
\r
133 //! Gets an attribute as boolean value
\r
134 //! \param index: Index value, must be between 0 and getAttributeCount()-1.
\r
135 bool getAttributeAsBool(s32 index) const override;
\r
137 //! Sets an attribute as boolean value
\r
138 void setAttribute(s32 index, bool value) override;
\r
142 core::array<IAttribute*> Attributes;
\r
144 IAttribute* getAttributeP(const c8* attributeName) const;
\r
146 video::IVideoDriver* Driver;
\r
149 } // end namespace io
\r
150 } // end namespace irr
\r