]> git.lizzy.rs Git - irrlicht.git/blob - include/IAttributes.h
Return nullptr pointer for empty core::array
[irrlicht.git] / include / IAttributes.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 __I_ATTRIBUTES_H_INCLUDED__\r
6 #define __I_ATTRIBUTES_H_INCLUDED__\r
7 \r
8 #include "IReferenceCounted.h"\r
9 #include "SColor.h"\r
10 #include "vector3d.h"\r
11 #include "vector2d.h"\r
12 #include "line2d.h"\r
13 #include "line3d.h"\r
14 #include "triangle3d.h"\r
15 #include "position2d.h"\r
16 #include "rect.h"\r
17 #include "dimension2d.h"\r
18 #include "matrix4.h"\r
19 #include "quaternion.h"\r
20 #include "plane3d.h"\r
21 #include "triangle3d.h"\r
22 #include "line2d.h"\r
23 #include "line3d.h"\r
24 #include "irrString.h"\r
25 #include "irrArray.h"\r
26 #include "EAttributes.h"\r
27 #include "path.h"\r
28 \r
29 namespace irr\r
30 {\r
31 namespace video\r
32 {\r
33         class ITexture;\r
34 } // end namespace video\r
35 namespace io\r
36 {\r
37 \r
38 //! Provides a generic interface for attributes and their values and the possibility to serialize them\r
39 class IAttributes : public virtual IReferenceCounted\r
40 {\r
41 public:\r
42 \r
43         //! Returns amount of attributes in this collection of attributes.\r
44         virtual u32 getAttributeCount() const = 0;\r
45 \r
46         //! Returns attribute name by index.\r
47         //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
48         virtual const c8* getAttributeName(s32 index) const = 0;\r
49 \r
50         //! Returns the type of an attribute\r
51         //! \param attributeName: Name for the attribute\r
52         virtual E_ATTRIBUTE_TYPE getAttributeType(const c8* attributeName) const = 0;\r
53 \r
54         //! Returns attribute type by index.\r
55         //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
56         virtual E_ATTRIBUTE_TYPE getAttributeType(s32 index) const = 0;\r
57 \r
58         //! Returns the type string of the attribute\r
59         //! \param attributeName: String for the attribute type\r
60         //! \param defaultNotFound Value returned when attributeName was not found\r
61         virtual const wchar_t* getAttributeTypeString(const c8* attributeName, const wchar_t* defaultNotFound = L"unknown") const = 0;\r
62 \r
63         //! Returns the type string of the attribute by index.\r
64         //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
65         //! \param defaultNotFound Value returned for an invalid index\r
66         virtual const wchar_t* getAttributeTypeString(s32 index, const wchar_t* defaultNotFound = L"unknown") const = 0;\r
67 \r
68         //! Returns if an attribute with a name exists\r
69         virtual bool existsAttribute(const c8* attributeName) const = 0;\r
70 \r
71         //! Returns attribute index from name, -1 if not found\r
72         virtual s32 findAttribute(const c8* attributeName) const = 0;\r
73 \r
74         //! Removes all attributes\r
75         virtual void clear() = 0;\r
76 \r
77 \r
78         /*\r
79 \r
80                 Integer Attribute\r
81 \r
82         */\r
83 \r
84         //! Adds an attribute as integer\r
85         virtual void addInt(const c8* attributeName, s32 value) = 0;\r
86 \r
87         //! Sets an attribute as integer value\r
88         virtual void setAttribute(const c8* attributeName, s32 value) = 0;\r
89 \r
90         //! Gets an attribute as integer value\r
91         //! \param attributeName: Name of the attribute to get.\r
92         //! \param defaultNotFound Value returned when attributeName was not found\r
93         //! \return Returns value of the attribute previously set by setAttribute()\r
94         virtual s32 getAttributeAsInt(const c8* attributeName, irr::s32 defaultNotFound=0) const = 0;\r
95 \r
96         //! Gets an attribute as integer value\r
97         //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
98         virtual s32 getAttributeAsInt(s32 index) const = 0;\r
99 \r
100         //! Sets an attribute as integer value\r
101         virtual void setAttribute(s32 index, s32 value) = 0;\r
102 \r
103         /*\r
104 \r
105                 Float Attribute\r
106 \r
107         */\r
108 \r
109         //! Adds an attribute as float\r
110         virtual void addFloat(const c8* attributeName, f32 value) = 0;\r
111 \r
112         //! Sets a attribute as float value\r
113         virtual void setAttribute(const c8* attributeName, f32 value) = 0;\r
114 \r
115         //! Gets an attribute as float value\r
116         //! \param attributeName: Name of the attribute to get.\r
117         //! \param defaultNotFound Value returned when attributeName was not found\r
118         //! \return Returns value of the attribute previously set by setAttribute()\r
119         virtual f32 getAttributeAsFloat(const c8* attributeName, irr::f32 defaultNotFound=0.f) const = 0;\r
120 \r
121         //! Gets an attribute as float value\r
122         //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
123         virtual f32 getAttributeAsFloat(s32 index) const = 0;\r
124 \r
125         //! Sets an attribute as float value\r
126         virtual void setAttribute(s32 index, f32 value) = 0;\r
127 \r
128 \r
129         /*\r
130                 Bool Attribute\r
131         */\r
132 \r
133         //! Adds an attribute as bool\r
134         virtual void addBool(const c8* attributeName, bool value) = 0;\r
135 \r
136         //! Sets an attribute as boolean value\r
137         virtual void setAttribute(const c8* attributeName, bool value) = 0;\r
138 \r
139         //! Gets an attribute as boolean value\r
140         //! \param attributeName: Name of the attribute to get.\r
141         //! \param defaultNotFound Value returned when attributeName was not found\r
142         //! \return Returns value of the attribute previously set by setAttribute()\r
143         virtual bool getAttributeAsBool(const c8* attributeName, bool defaultNotFound=false) const = 0;\r
144 \r
145         //! Gets an attribute as boolean value\r
146         //! \param index: Index value, must be between 0 and getAttributeCount()-1.\r
147         virtual bool getAttributeAsBool(s32 index) const = 0;\r
148 \r
149         //! Sets an attribute as boolean value\r
150         virtual void setAttribute(s32 index, bool value) = 0;\r
151 \r
152 };\r
153 \r
154 } // end namespace io\r
155 } // end namespace irr\r
156 \r
157 #endif\r