]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/IAttribute.h
Reduce IrrCompileConfig usage to files that actually need it
[irrlicht.git] / source / Irrlicht / IAttribute.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_ATTRIBUTE_H_INCLUDED__\r
6 #define __I_ATTRIBUTE_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 \r
28 \r
29 namespace irr\r
30 {\r
31 namespace io\r
32 {\r
33 \r
34 // All derived attribute types implement at least getter/setter for their own type (like CBoolAttribute will have setBool/getBool).\r
35 // Simple types will also implement getStringW and setString, but don't expect it to work for all types.\r
36 // String serialization makes no sense for some attribute-types (like stringw arrays or pointers), but is still useful for many types.\r
37 // (Note: I do _not_ know yet why the default string serialization is asymmetric with char* in set and wchar_t* in get).\r
38 // Additionally many attribute types will implement conversion functions like CBoolAttribute has p.E. getInt/setInt().\r
39 // The reason for conversion functions is likely to make reading old formats easier which have changed in the meantime. For example\r
40 // an old xml can contain a bool attribute which is an int in a newer format. You can still call getInt() even thought the attribute has the wrong type.\r
41 // And please do _not_ confuse these attributes here with the ones used in the xml-reader (aka SAttribute which is just a key-value pair).\r
42 \r
43 class IAttribute : public virtual IReferenceCounted\r
44 {\r
45 public:\r
46 \r
47         virtual ~IAttribute() {};\r
48 \r
49         virtual s32 getInt() const                               { return 0; }\r
50         virtual f32 getFloat() const                     { return 0; }\r
51         virtual bool getBool() const                    { return false; }\r
52 \r
53         virtual void setInt(s32 intValue)               {};\r
54         virtual void setFloat(f32 floatValue)           {};\r
55         virtual void setBool(bool boolValue)            {};\r
56 \r
57         core::stringc Name;\r
58 \r
59         virtual E_ATTRIBUTE_TYPE getType() const = 0;\r
60         virtual const wchar_t* getTypeString() const = 0;\r
61 };\r
62 \r
63 } // end namespace io\r
64 } // end namespace irr\r
65 \r
66 #endif\r