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 __I_ATTRIBUTE_H_INCLUDED__
\r
6 #define __I_ATTRIBUTE_H_INCLUDED__
\r
8 #include "IReferenceCounted.h"
\r
10 #include "vector3d.h"
\r
11 #include "vector2d.h"
\r
14 #include "triangle3d.h"
\r
15 #include "position2d.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
24 #include "irrString.h"
\r
25 #include "irrArray.h"
\r
26 #include "EAttributes.h"
\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
43 class IAttribute : public virtual IReferenceCounted
\r
47 virtual ~IAttribute() {};
\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
53 virtual void setInt(s32 intValue) {};
\r
54 virtual void setFloat(f32 floatValue) {};
\r
55 virtual void setBool(bool boolValue) {};
\r
59 virtual E_ATTRIBUTE_TYPE getType() const = 0;
\r
60 virtual const wchar_t* getTypeString() const = 0;
\r
63 } // end namespace io
\r
64 } // end namespace irr
\r