]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/CAttributes.h
7156b8eee3a97754dac626627b5e8376596cccc1
[irrlicht.git] / source / Irrlicht / CAttributes.h
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
4 \r
5 #ifndef __C_ATTRIBUTES_H_INCLUDED__\r
6 #define __C_ATTRIBUTES_H_INCLUDED__\r
7 \r
8 #include "IrrCompileConfig.h"\r
9 \r
10 #include "IAttributes.h"\r
11 #include "IAttribute.h"\r
12 \r
13 namespace irr\r
14 {\r
15 namespace video\r
16 {\r
17         class ITexture;\r
18         class IVideoDriver;\r
19 }\r
20 namespace io\r
21 {\r
22 \r
23 \r
24 //! Implementation of the IAttributes interface\r
25 class CAttributes : public IAttributes\r
26 {\r
27 public:\r
28 \r
29         CAttributes(video::IVideoDriver* driver=0);\r
30         ~CAttributes();\r
31 \r
32         //! Returns amount of attributes in this collection of attributes.\r
33         u32 getAttributeCount() const override;\r
34 \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
38 \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
42 \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
46 \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
51 \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
55 \r
56         //! Returns if an attribute with a name exists\r
57         bool existsAttribute(const c8* attributeName) const override;\r
58 \r
59         //! Returns attribute index from name, -1 if not found\r
60         s32 findAttribute(const c8* attributeName) const override;\r
61 \r
62         //! Removes all attributes\r
63         void clear() override;\r
64 \r
65 \r
66         /*\r
67 \r
68                 Integer Attribute\r
69 \r
70         */\r
71 \r
72         //! Adds an attribute as integer\r
73         void addInt(const c8* attributeName, s32 value) override;\r
74 \r
75         //! Sets an attribute as integer value\r
76         void setAttribute(const c8* attributeName, s32 value) override;\r
77 \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
83 \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
87 \r
88         //! Sets an attribute as integer value\r
89         void setAttribute(s32 index, s32 value) override;\r
90 \r
91         /*\r
92 \r
93                 Float Attribute\r
94 \r
95         */\r
96 \r
97         //! Adds an attribute as float\r
98         void addFloat(const c8* attributeName, f32 value) override;\r
99 \r
100         //! Sets a attribute as float value\r
101         void setAttribute(const c8* attributeName, f32 value) override;\r
102 \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
108 \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
112 \r
113         //! Sets an attribute as float value\r
114         void setAttribute(s32 index, f32 value) override;\r
115 \r
116 \r
117         /*\r
118                 Bool Attribute\r
119         */\r
120 \r
121         //! Adds an attribute as bool\r
122         void addBool(const c8* attributeName, bool value) override;\r
123 \r
124         //! Sets an attribute as boolean value\r
125         void setAttribute(const c8* attributeName, bool value) override;\r
126 \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
132 \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
136 \r
137         //! Sets an attribute as boolean value\r
138         void setAttribute(s32 index, bool value) override;\r
139 \r
140 protected:\r
141 \r
142         core::array<IAttribute*> Attributes;\r
143 \r
144         IAttribute* getAttributeP(const c8* attributeName) const;\r
145 \r
146         video::IVideoDriver* Driver;\r
147 };\r
148 \r
149 } // end namespace io\r
150 } // end namespace irr\r
151 \r
152 #endif\r
153 \r