Commit c2d2390e authored by cutealien's avatar cutealien

IAttributes::getAttributeAs functions now can have a customizable...

IAttributes::getAttributeAs functions now can have a customizable default-parameter to return when attributeName is not found. This makes it easier to work correctly with old serialized data when adding new variables. Also it would probably be worth it passing generally in all serialization the old value as default-parameter, then it can handle missing serialization data as well.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4427 dfc29bdd-3216-0410-991c-e03cc46cb475
parent ba95913a
-------------------------- --------------------------
Changes in 1.9 (not yet released) Changes in 1.9 (not yet released)
- IAttributes::getAttributeAs functions now can have a customizable default-parameter to return when attributeName is not found
- Added ECFN_DISABLED value (it works like ECFN_NEVER worked before) and changed ECFN_NEVER behaviour - Added ECFN_DISABLED value (it works like ECFN_NEVER worked before) and changed ECFN_NEVER behaviour
(it works like its equivalent value in OpenGL/Direct3D). (it works like its equivalent value in OpenGL/Direct3D).
- Removed boolean interface from IShaderConstantSetCallBack, please use integer interface instead of them. - Removed boolean interface from IShaderConstantSetCallBack, please use integer interface instead of them.
......
...@@ -59,11 +59,13 @@ public: ...@@ -59,11 +59,13 @@ public:
//! Returns the type string of the attribute //! Returns the type string of the attribute
//! \param attributeName: String for the attribute type //! \param attributeName: String for the attribute type
virtual const wchar_t* getAttributeTypeString(const c8* attributeName) = 0; //! \param defaultNotFound Value returned when attributeName was not found
virtual const wchar_t* getAttributeTypeString(const c8* attributeName, const wchar_t* defaultNotFound = L"unknown") = 0;
//! Returns the type string of the attribute by index. //! Returns the type string of the attribute by index.
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual const wchar_t* getAttributeTypeString(s32 index) = 0; //! \param defaultNotFound Value returned for an invalid index
virtual const wchar_t* getAttributeTypeString(s32 index, const wchar_t* defaultNotFound = L"unknown") = 0;
//! Returns if an attribute with a name exists //! Returns if an attribute with a name exists
virtual bool existsAttribute(const c8* attributeName) = 0; virtual bool existsAttribute(const c8* attributeName) = 0;
...@@ -103,8 +105,9 @@ public: ...@@ -103,8 +105,9 @@ public:
//! Gets an attribute as integer value //! Gets an attribute as integer value
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual s32 getAttributeAsInt(const c8* attributeName) const =0; virtual s32 getAttributeAsInt(const c8* attributeName, irr::s32 defaultNotFound=0) const =0;
//! Gets an attribute as integer value //! Gets an attribute as integer value
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -127,8 +130,9 @@ public: ...@@ -127,8 +130,9 @@ public:
//! Gets an attribute as float value //! Gets an attribute as float value
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual f32 getAttributeAsFloat(const c8* attributeName) = 0; virtual f32 getAttributeAsFloat(const c8* attributeName, irr::f32 defaultNotFound=0.f) = 0;
//! Gets an attribute as float value //! Gets an attribute as float value
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -153,9 +157,10 @@ public: ...@@ -153,9 +157,10 @@ public:
//! Gets an attribute as string. //! Gets an attribute as string.
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
//! or 0 if attribute is not set. //! or defaultNotFound if attribute is not set.
virtual core::stringc getAttributeAsString(const c8* attributeName) = 0; virtual core::stringc getAttributeAsString(const c8* attributeName, const core::stringc& defaultNotFound=core::stringc()) = 0;
//! Gets an attribute as string. //! Gets an attribute as string.
//! \param attributeName Name of the attribute to get. //! \param attributeName Name of the attribute to get.
...@@ -183,9 +188,10 @@ public: ...@@ -183,9 +188,10 @@ public:
//! Gets an attribute as string. //! Gets an attribute as string.
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
//! or 0 if attribute is not set. //! or defaultNotFound if attribute is not set.
virtual core::stringw getAttributeAsStringW(const c8* attributeName) = 0; virtual core::stringw getAttributeAsStringW(const c8* attributeName, const core::stringw& defaultNotFound = core::stringw()) = 0;
//! Gets an attribute as string. //! Gets an attribute as string.
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
...@@ -245,9 +251,10 @@ public: ...@@ -245,9 +251,10 @@ public:
//! Gets an attribute as an array of wide strings. //! Gets an attribute as an array of wide strings.
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
//! or 0 if attribute is not set. //! or defaultNotFound if attribute is not set.
virtual core::array<core::stringw> getAttributeAsArray(const c8* attributeName) = 0; virtual core::array<core::stringw> getAttributeAsArray(const c8* attributeName, const core::array<core::stringw>& defaultNotFound = core::array<core::stringw>()) = 0;
//! Returns attribute value as an array of wide strings by index. //! Returns attribute value as an array of wide strings by index.
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -271,8 +278,9 @@ public: ...@@ -271,8 +278,9 @@ public:
//! Gets an attribute as boolean value //! Gets an attribute as boolean value
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual bool getAttributeAsBool(const c8* attributeName) = 0; virtual bool getAttributeAsBool(const c8* attributeName, bool defaultNotFound=false) = 0;
//! Gets an attribute as boolean value //! Gets an attribute as boolean value
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -298,8 +306,9 @@ public: ...@@ -298,8 +306,9 @@ public:
//! Gets an attribute as enumeration //! Gets an attribute as enumeration
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual const c8* getAttributeAsEnumeration(const c8* attributeName) = 0; virtual const c8* getAttributeAsEnumeration(const c8* attributeName, const c8* defaultNotFound = 0) = 0;
//! Gets an attribute as enumeration //! Gets an attribute as enumeration
/** \param attributeName: Name of the attribute to get. /** \param attributeName: Name of the attribute to get.
...@@ -354,8 +363,9 @@ public: ...@@ -354,8 +363,9 @@ public:
//! Gets an attribute as color //! Gets an attribute as color
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual video::SColor getAttributeAsColor(const c8* attributeName) = 0; virtual video::SColor getAttributeAsColor(const c8* attributeName, const video::SColor& defaultNotFound = video::SColor(0)) = 0;
//! Gets an attribute as color //! Gets an attribute as color
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -378,8 +388,9 @@ public: ...@@ -378,8 +388,9 @@ public:
//! Gets an attribute as floating point color //! Gets an attribute as floating point color
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual video::SColorf getAttributeAsColorf(const c8* attributeName) = 0; virtual video::SColorf getAttributeAsColorf(const c8* attributeName, const video::SColorf& defaultNotFound = video::SColorf(0)) = 0;
//! Gets an attribute as floating point color //! Gets an attribute as floating point color
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -403,8 +414,9 @@ public: ...@@ -403,8 +414,9 @@ public:
//! Gets an attribute as 3d vector //! Gets an attribute as 3d vector
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::vector3df getAttributeAsVector3d(const c8* attributeName) = 0; virtual core::vector3df getAttributeAsVector3d(const c8* attributeName, const core::vector3df& defaultNotFound=core::vector3df(0,0,0)) = 0;
//! Gets an attribute as 3d vector //! Gets an attribute as 3d vector
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -427,8 +439,9 @@ public: ...@@ -427,8 +439,9 @@ public:
//! Gets an attribute as vector //! Gets an attribute as vector
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::vector2df getAttributeAsVector2d(const c8* attributeName) = 0; virtual core::vector2df getAttributeAsVector2d(const c8* attributeName, const core::vector2df& defaultNotFound=core::vector2df(0,0)) = 0;
//! Gets an attribute as position //! Gets an attribute as position
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -451,8 +464,9 @@ public: ...@@ -451,8 +464,9 @@ public:
//! Gets an attribute as position //! Gets an attribute as position
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::position2di getAttributeAsPosition2d(const c8* attributeName) = 0; virtual core::position2di getAttributeAsPosition2d(const c8* attributeName, const core::position2di& defaultNotFound=core::position2di(0,0)) = 0;
//! Gets an attribute as position //! Gets an attribute as position
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -475,8 +489,9 @@ public: ...@@ -475,8 +489,9 @@ public:
//! Gets an attribute as rectangle //! Gets an attribute as rectangle
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::rect<s32> getAttributeAsRect(const c8* attributeName) = 0; virtual core::rect<s32> getAttributeAsRect(const c8* attributeName, const core::rect<s32>& defaultNotFound = core::rect<s32>()) = 0;
//! Gets an attribute as rectangle //! Gets an attribute as rectangle
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -500,8 +515,9 @@ public: ...@@ -500,8 +515,9 @@ public:
//! Gets an attribute as dimension2d //! Gets an attribute as dimension2d
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::dimension2d<u32> getAttributeAsDimension2d(const c8* attributeName) = 0; virtual core::dimension2d<u32> getAttributeAsDimension2d(const c8* attributeName, const core::dimension2d<u32>& defaultNotFound = core::dimension2d<u32>()) = 0;
//! Gets an attribute as dimension2d //! Gets an attribute as dimension2d
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -523,8 +539,9 @@ public: ...@@ -523,8 +539,9 @@ public:
//! Gets an attribute as a matrix4 //! Gets an attribute as a matrix4
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::matrix4 getAttributeAsMatrix(const c8* attributeName) = 0; virtual core::matrix4 getAttributeAsMatrix(const c8* attributeName, const core::matrix4& defaultNotFound=core::matrix4()) = 0;
//! Gets an attribute as matrix //! Gets an attribute as matrix
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -546,8 +563,9 @@ public: ...@@ -546,8 +563,9 @@ public:
//! Gets an attribute as a quaternion //! Gets an attribute as a quaternion
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::quaternion getAttributeAsQuaternion(const c8* attributeName) = 0; virtual core::quaternion getAttributeAsQuaternion(const c8* attributeName, const core::quaternion& defaultNotFound=core::quaternion(0,1,0, 0)) = 0;
//! Gets an attribute as quaternion //! Gets an attribute as quaternion
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -570,8 +588,9 @@ public: ...@@ -570,8 +588,9 @@ public:
//! Gets an attribute as a axis aligned bounding box //! Gets an attribute as a axis aligned bounding box
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::aabbox3df getAttributeAsBox3d(const c8* attributeName) = 0; virtual core::aabbox3df getAttributeAsBox3d(const c8* attributeName, const core::aabbox3df& defaultNotFound=core::aabbox3df(0,0,0, 0,0,0)) = 0;
//! Gets an attribute as axis aligned bounding box //! Gets an attribute as axis aligned bounding box
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -594,8 +613,9 @@ public: ...@@ -594,8 +613,9 @@ public:
//! Gets an attribute as a 3d plane //! Gets an attribute as a 3d plane
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::plane3df getAttributeAsPlane3d(const c8* attributeName) = 0; virtual core::plane3df getAttributeAsPlane3d(const c8* attributeName, const core::plane3df& defaultNotFound=core::plane3df(0,0,0, 0,1,0)) = 0;
//! Gets an attribute as 3d plane //! Gets an attribute as 3d plane
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -619,8 +639,9 @@ public: ...@@ -619,8 +639,9 @@ public:
//! Gets an attribute as a 3d triangle //! Gets an attribute as a 3d triangle
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::triangle3df getAttributeAsTriangle3d(const c8* attributeName) = 0; virtual core::triangle3df getAttributeAsTriangle3d(const c8* attributeName, const core::triangle3df& defaultNotFound = core::triangle3df(core::vector3df(0,0,0), core::vector3df(0,0,0), core::vector3df(0,0,0))) = 0;
//! Gets an attribute as 3d triangle //! Gets an attribute as 3d triangle
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -644,8 +665,9 @@ public: ...@@ -644,8 +665,9 @@ public:
//! Gets an attribute as a 2d line //! Gets an attribute as a 2d line
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::line2df getAttributeAsLine2d(const c8* attributeName) = 0; virtual core::line2df getAttributeAsLine2d(const c8* attributeName, const core::line2df& defaultNotFound = core::line2df(0,0, 0,0)) = 0;
//! Gets an attribute as a 2d line //! Gets an attribute as a 2d line
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -669,8 +691,9 @@ public: ...@@ -669,8 +691,9 @@ public:
//! Gets an attribute as a 3d line //! Gets an attribute as a 3d line
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::line3df getAttributeAsLine3d(const c8* attributeName) = 0; virtual core::line3df getAttributeAsLine3d(const c8* attributeName, const core::line3df& defaultNotFound=core::line3df(0,0,0, 0,0,0)) = 0;
//! Gets an attribute as a 3d line //! Gets an attribute as a 3d line
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -694,7 +717,8 @@ public: ...@@ -694,7 +717,8 @@ public:
//! Gets an attribute as texture reference //! Gets an attribute as texture reference
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
virtual video::ITexture* getAttributeAsTexture(const c8* attributeName) = 0; //! \param defaultNotFound Value returned when attributeName was not found
virtual video::ITexture* getAttributeAsTexture(const c8* attributeName, video::ITexture* defaultNotFound=0) = 0;
//! Gets an attribute as texture reference //! Gets an attribute as texture reference
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -718,7 +742,8 @@ public: ...@@ -718,7 +742,8 @@ public:
//! Gets an attribute as user pointer //! Gets an attribute as user pointer
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
virtual void* getAttributeAsUserPointer(const c8* attributeName) = 0; //! \param defaultNotFound Value returned when attributeName was not found
virtual void* getAttributeAsUserPointer(const c8* attributeName, void* defaultNotFound = 0) = 0;
//! Gets an attribute as user pointer //! Gets an attribute as user pointer
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
......
...@@ -76,15 +76,13 @@ void CAttributes::setAttribute(const c8* attributeName, const c8* value) ...@@ -76,15 +76,13 @@ void CAttributes::setAttribute(const c8* attributeName, const c8* value)
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setStringAttribute() //! \return Returns value of the attribute previously set by setStringAttribute()
//! or 0 if attribute is not set. //! or 0 if attribute is not set.
core::stringc CAttributes::getAttributeAsString(const c8* attributeName) core::stringc CAttributes::getAttributeAsString(const c8* attributeName, const core::stringc& defaultNotFound)
{ {
core::stringc str;
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
return att->getString(); return att->getString();
else else
return str; return defaultNotFound;
} }
//! Gets a string attribute. //! Gets a string attribute.
...@@ -146,15 +144,13 @@ void CAttributes::setAttribute(const c8* attributeName, const wchar_t* value) ...@@ -146,15 +144,13 @@ void CAttributes::setAttribute(const c8* attributeName, const wchar_t* value)
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setStringAttribute() //! \return Returns value of the attribute previously set by setStringAttribute()
//! or 0 if attribute is not set. //! or 0 if attribute is not set.
core::stringw CAttributes::getAttributeAsStringW(const c8* attributeName) core::stringw CAttributes::getAttributeAsStringW(const c8* attributeName, const core::stringw& defaultNotFound)
{ {
core::stringw str;
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
str = att->getStringW(); return att->getStringW();
else
return str; return defaultNotFound;
} }
//! Gets a string attribute. //! Gets a string attribute.
...@@ -203,13 +199,13 @@ void CAttributes::setAttribute(const c8* attributeName, const core::array<core:: ...@@ -203,13 +199,13 @@ void CAttributes::setAttribute(const c8* attributeName, const core::array<core::
} }
//! Gets an attribute as an array of wide strings. //! Gets an attribute as an array of wide strings.
core::array<core::stringw> CAttributes::getAttributeAsArray(const c8* attributeName) core::array<core::stringw> CAttributes::getAttributeAsArray(const c8* attributeName, const core::array<core::stringw>& defaultNotFound)
{ {
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
return att->getArray(); return att->getArray();
else else
return core::array<core::stringw>(); return defaultNotFound;
} }
//! Returns attribute value as an array of wide strings by index. //! Returns attribute value as an array of wide strings by index.
...@@ -270,16 +266,13 @@ void CAttributes::setAttribute(const c8* attributeName, bool value) ...@@ -270,16 +266,13 @@ void CAttributes::setAttribute(const c8* attributeName, bool value)
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute() as bool //! \return Returns value of the attribute previously set by setAttribute() as bool
//! or 0 if attribute is not set. //! or 0 if attribute is not set.
bool CAttributes::getAttributeAsBool(const c8* attributeName) bool CAttributes::getAttributeAsBool(const c8* attributeName, bool defaultNotFound)
{ {
bool ret = false;
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
ret = att->getBool(); return att->getBool();
else
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; return defaultNotFound;
return ret;
} }
//! Sets a attribute as integer value //! Sets a attribute as integer value
...@@ -298,13 +291,13 @@ void CAttributes::setAttribute(const c8* attributeName, s32 value) ...@@ -298,13 +291,13 @@ void CAttributes::setAttribute(const c8* attributeName, s32 value)
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute() as integer //! \return Returns value of the attribute previously set by setAttribute() as integer
//! or 0 if attribute is not set. //! or 0 if attribute is not set.
s32 CAttributes::getAttributeAsInt(const c8* attributeName) const s32 CAttributes::getAttributeAsInt(const c8* attributeName, irr::s32 defaultNotFound) const
{ {
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
return att->getInt(); return att->getInt();
else else
return 0; return defaultNotFound;
} }
//! Sets a attribute as float value //! Sets a attribute as float value
...@@ -321,13 +314,13 @@ void CAttributes::setAttribute(const c8* attributeName, f32 value) ...@@ -321,13 +314,13 @@ void CAttributes::setAttribute(const c8* attributeName, f32 value)
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute() as float value //! \return Returns value of the attribute previously set by setAttribute() as float value
//! or 0 if attribute is not set. //! or 0 if attribute is not set.
f32 CAttributes::getAttributeAsFloat(const c8* attributeName) f32 CAttributes::getAttributeAsFloat(const c8* attributeName, irr::f32 defaultNotFound)
{ {
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
return att->getFloat(); return att->getFloat();
return 0.f; return defaultNotFound;
} }
//! Sets a attribute as color //! Sets a attribute as color
...@@ -343,15 +336,13 @@ void CAttributes::setAttribute(const c8* attributeName, video::SColor value) ...@@ -343,15 +336,13 @@ void CAttributes::setAttribute(const c8* attributeName, video::SColor value)
//! Gets an attribute as color //! Gets an attribute as color
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
video::SColor CAttributes::getAttributeAsColor(const c8* attributeName) video::SColor CAttributes::getAttributeAsColor(const c8* attributeName, const video::SColor& defaultNotFound)
{ {
video::SColor ret(0);
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
ret = att->getColor(); return att->getColor();
else
return ret; return defaultNotFound;
} }
//! Sets a attribute as floating point color //! Sets a attribute as floating point color
...@@ -367,13 +358,13 @@ void CAttributes::setAttribute(const c8* attributeName, video::SColorf value) ...@@ -367,13 +358,13 @@ void CAttributes::setAttribute(const c8* attributeName, video::SColorf value)
//! Gets an attribute as floating point color //! Gets an attribute as floating point color
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
video::SColorf CAttributes::getAttributeAsColorf(const c8* attributeName) video::SColorf CAttributes::getAttributeAsColorf(const c8* attributeName, const video::SColorf& defaultNotFound)
{ {
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
return att->getColorf(); return att->getColorf();
else else
return video::SColorf(); return defaultNotFound;
} }
//! Sets a attribute as 2d position //! Sets a attribute as 2d position
...@@ -389,13 +380,13 @@ void CAttributes::setAttribute(const c8* attributeName, core::position2di value) ...@@ -389,13 +380,13 @@ void CAttributes::setAttribute(const c8* attributeName, core::position2di value)
//! Gets an attribute as 2d position //! Gets an attribute as 2d position
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
core::position2di CAttributes::getAttributeAsPosition2d(const c8* attributeName) core::position2di CAttributes::getAttributeAsPosition2d(const c8* attributeName, const core::position2di& defaultNotFound)
{ {
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
return att->getPosition(); return att->getPosition();
else else
return core::position2di(); return defaultNotFound;
} }
//! Sets a attribute as rectangle //! Sets a attribute as rectangle
...@@ -411,13 +402,13 @@ void CAttributes::setAttribute(const c8* attributeName, core::rect<s32> value) ...@@ -411,13 +402,13 @@ void CAttributes::setAttribute(const c8* attributeName, core::rect<s32> value)
//! Gets an attribute as rectangle //! Gets an attribute as rectangle
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
core::rect<s32> CAttributes::getAttributeAsRect(const c8* attributeName) core::rect<s32> CAttributes::getAttributeAsRect(const c8* attributeName, const core::rect<s32>& defaultNotFound)
{ {
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
return att->getRect(); return att->getRect();
else else
return core::rect<s32>(); return defaultNotFound;
} }
//! Sets a attribute as dimension2d //! Sets a attribute as dimension2d
...@@ -433,13 +424,13 @@ void CAttributes::setAttribute(const c8* attributeName, core::dimension2d<u32> v ...@@ -433,13 +424,13 @@ void CAttributes::setAttribute(const c8* attributeName, core::dimension2d<u32> v
//! Gets an attribute as dimension2d //! Gets an attribute as dimension2d
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
core::dimension2d<u32> CAttributes::getAttributeAsDimension2d(const c8* attributeName) core::dimension2d<u32> CAttributes::getAttributeAsDimension2d(const c8* attributeName, const core::dimension2d<u32>& defaultNotFound)
{ {
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
return att->getDimension2d(); return att->getDimension2d();
else else
return core::dimension2d<u32>(); return defaultNotFound;
} }
//! Sets a attribute as vector //! Sets a attribute as vector
...@@ -465,23 +456,23 @@ void CAttributes::setAttribute(const c8* attributeName, core::vector2df value) ...@@ -465,23 +456,23 @@ void CAttributes::setAttribute(const c8* attributeName, core::vector2df value)
//! Gets an attribute as vector //! Gets an attribute as vector
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
core::vector3df CAttributes::getAttributeAsVector3d(const c8* attributeName) core::vector3df CAttributes::getAttributeAsVector3d(const c8* attributeName, const core::vector3df& defaultNotFound)
{ {
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
return att->getVector(); return att->getVector();
else else
return core::vector3df(); return defaultNotFound;
} }
//! Gets an attribute as vector //! Gets an attribute as vector
core::vector2df CAttributes::getAttributeAsVector2d(const c8* attributeName) core::vector2df CAttributes::getAttributeAsVector2d(const c8* attributeName, const core::vector2df& defaultNotFound)
{ {
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
return att->getVector2d(); return att->getVector2d();
else else
return core::vector2df(); return defaultNotFound;
} }
//! Sets an attribute as binary data //! Sets an attribute as binary data
...@@ -516,13 +507,13 @@ void CAttributes::setAttribute(const c8* attributeName, const char* enumValue, c ...@@ -516,13 +507,13 @@ void CAttributes::setAttribute(const c8* attributeName, const char* enumValue, c
//! Gets an attribute as enumeration //! Gets an attribute as enumeration
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
const char* CAttributes::getAttributeAsEnumeration(const c8* attributeName) const char* CAttributes::getAttributeAsEnumeration(const c8* attributeName, const c8* defaultNotFound)
{ {
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
return att->getEnum(); return att->getEnum();
else else
return 0; return defaultNotFound;
} }
//! Gets an attribute as enumeration //! Gets an attribute as enumeration
...@@ -567,13 +558,13 @@ void CAttributes::setAttribute(const c8* attributeName, video::ITexture* value, ...@@ -567,13 +558,13 @@ void CAttributes::setAttribute(const c8* attributeName, video::ITexture* value,
//! Gets an attribute as texture reference //! Gets an attribute as texture reference
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
video::ITexture* CAttributes::getAttributeAsTexture(const c8* attributeName) video::ITexture* CAttributes::getAttributeAsTexture(const c8* attributeName, video::ITexture* defaultNotFound)
{ {
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
return att->getTexture(); return att->getTexture();
else else
return 0; return defaultNotFound;
} }
//! Gets an attribute as texture reference //! Gets an attribute as texture reference
...@@ -626,21 +617,21 @@ E_ATTRIBUTE_TYPE CAttributes::getAttributeType(s32 index) ...@@ -626,21 +617,21 @@ E_ATTRIBUTE_TYPE CAttributes::getAttributeType(s32 index)
} }
//! Returns the type of an attribute //! Returns the type of an attribute
const wchar_t* CAttributes::getAttributeTypeString(const c8* attributeName) const wchar_t* CAttributes::getAttributeTypeString(const c8* attributeName, const wchar_t* defaultNotFound)
{ {
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
return att->getTypeString(); return att->getTypeString();
else else
return L"unknown"; return defaultNotFound;
} }
//! Returns attribute type string by index. //! Returns attribute type string by index.
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
const wchar_t* CAttributes::getAttributeTypeString(s32 index) const wchar_t* CAttributes::getAttributeTypeString(s32 index, const wchar_t* defaultNotFound)
{ {
if ((u32)index >= Attributes.size()) if ((u32)index >= Attributes.size())
return L"unknown"; return defaultNotFound;
return Attributes[index]->getTypeString(); return Attributes[index]->getTypeString();
} }
...@@ -1035,13 +1026,13 @@ void CAttributes::setAttribute(const c8* attributeName, const core::matrix4& v) ...@@ -1035,13 +1026,13 @@ void CAttributes::setAttribute(const c8* attributeName, const core::matrix4& v)
} }
//! Gets an attribute as a matrix4 //! Gets an attribute as a matrix4
core::matrix4 CAttributes::getAttributeAsMatrix(const c8* attributeName) core::matrix4 CAttributes::getAttributeAsMatrix(const c8* attributeName, const core::matrix4& defaultNotFound)
{ {
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
return att->getMatrix(); return att->getMatrix();
else else
return core::matrix4(); return defaultNotFound;
} }
...@@ -1082,15 +1073,13 @@ void CAttributes::setAttribute(const c8* attributeName, core::quaternion v) ...@@ -1082,15 +1073,13 @@ void CAttributes::setAttribute(const c8* attributeName, core::quaternion v)
} }
//! Gets an attribute as a quaternion //! Gets an attribute as a quaternion
core::quaternion CAttributes::getAttributeAsQuaternion(const c8* attributeName) core::quaternion CAttributes::getAttributeAsQuaternion(const c8* attributeName, const core::quaternion& defaultNotFound)
{ {
core::quaternion ret(0,1,0, 0);
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
ret = att->getQuaternion(); return att->getQuaternion();
else
return ret; return defaultNotFound;
} }
//! Gets an attribute as quaternion //! Gets an attribute as quaternion
...@@ -1130,15 +1119,13 @@ void CAttributes::setAttribute(const c8* attributeName, core::aabbox3df v) ...@@ -1130,15 +1119,13 @@ void CAttributes::setAttribute(const c8* attributeName, core::aabbox3df v)
} }
//! Gets an attribute as a axis aligned bounding box //! Gets an attribute as a axis aligned bounding box
core::aabbox3df CAttributes::getAttributeAsBox3d(const c8* attributeName) core::aabbox3df CAttributes::getAttributeAsBox3d(const c8* attributeName, const core::aabbox3df& defaultNotFound)
{ {
core::aabbox3df ret(0,0,0, 0,0,0);
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
ret = att->getBBox(); return att->getBBox();
else
return ret; return defaultNotFound;
} }
//! Gets an attribute as axis aligned bounding box //! Gets an attribute as axis aligned bounding box
...@@ -1178,15 +1165,13 @@ void CAttributes::setAttribute(const c8* attributeName, core::plane3df v) ...@@ -1178,15 +1165,13 @@ void CAttributes::setAttribute(const c8* attributeName, core::plane3df v)
} }
//! Gets an attribute as a 3d plane //! Gets an attribute as a 3d plane
core::plane3df CAttributes::getAttributeAsPlane3d(const c8* attributeName) core::plane3df CAttributes::getAttributeAsPlane3d(const c8* attributeName, const core::plane3df& defaultNotFound)
{ {
core::plane3df ret(0,0,0, 0,1,0);
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
ret = att->getPlane(); return att->getPlane();
else
return ret; return defaultNotFound;
} }
//! Gets an attribute as 3d plane //! Gets an attribute as 3d plane
...@@ -1226,16 +1211,13 @@ void CAttributes::setAttribute(const c8* attributeName, core::triangle3df v) ...@@ -1226,16 +1211,13 @@ void CAttributes::setAttribute(const c8* attributeName, core::triangle3df v)
} }
//! Gets an attribute as a 3d triangle //! Gets an attribute as a 3d triangle
core::triangle3df CAttributes::getAttributeAsTriangle3d(const c8* attributeName) core::triangle3df CAttributes::getAttributeAsTriangle3d(const c8* attributeName, const core::triangle3df& defaultNotFound)
{ {
core::triangle3df ret;
ret.pointA = ret.pointB = ret.pointC = core::vector3df(0,0,0);
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
ret = att->getTriangle(); return att->getTriangle();
else
return ret; return defaultNotFound;
} }
//! Gets an attribute as 3d triangle //! Gets an attribute as 3d triangle
...@@ -1276,15 +1258,13 @@ void CAttributes::setAttribute(const c8* attributeName, core::line2df v) ...@@ -1276,15 +1258,13 @@ void CAttributes::setAttribute(const c8* attributeName, core::line2df v)
} }
//! Gets an attribute as a 2d line //! Gets an attribute as a 2d line
core::line2df CAttributes::getAttributeAsLine2d(const c8* attributeName) core::line2df CAttributes::getAttributeAsLine2d(const c8* attributeName, const core::line2df& defaultNotFound)
{ {
core::line2df ret(0,0, 0,0);
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
ret = att->getLine2d(); return att->getLine2d();
else
return ret; return defaultNotFound;
} }
//! Gets an attribute as a 2d line //! Gets an attribute as a 2d line
...@@ -1324,15 +1304,13 @@ void CAttributes::setAttribute(const c8* attributeName, core::line3df v) ...@@ -1324,15 +1304,13 @@ void CAttributes::setAttribute(const c8* attributeName, core::line3df v)
} }
//! Gets an attribute as a 3d line //! Gets an attribute as a 3d line
core::line3df CAttributes::getAttributeAsLine3d(const c8* attributeName) core::line3df CAttributes::getAttributeAsLine3d(const c8* attributeName, const core::line3df& defaultNotFound)
{ {
core::line3df ret(0,0,0, 0,0,0);
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
ret = att->getLine3d(); return att->getLine3d();
else
return ret; return defaultNotFound;
} }
//! Gets an attribute as a 3d line //! Gets an attribute as a 3d line
...@@ -1375,15 +1353,13 @@ void CAttributes::setAttribute(const c8* attributeName, void* userPointer) ...@@ -1375,15 +1353,13 @@ void CAttributes::setAttribute(const c8* attributeName, void* userPointer)
//! Gets an attribute as user pointer //! Gets an attribute as user pointer
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
void* CAttributes::getAttributeAsUserPointer(const c8* attributeName) void* CAttributes::getAttributeAsUserPointer(const c8* attributeName, void* defaultNotFound)
{ {
void* value = 0;
IAttribute* att = getAttributeP(attributeName); IAttribute* att = getAttributeP(attributeName);
if (att) if (att)
value = att->getUserPointer(); return att->getUserPointer();
else
return value; return defaultNotFound;
} }
//! Gets an attribute as user pointer //! Gets an attribute as user pointer
......
...@@ -46,11 +46,12 @@ public: ...@@ -46,11 +46,12 @@ public:
//! Returns the type string of the attribute //! Returns the type string of the attribute
//! \param attributeName: String for the attribute type //! \param attributeName: String for the attribute type
virtual const wchar_t* getAttributeTypeString(const c8* attributeName); //! \param defaultNotFound Value returned when attributeName was not found
virtual const wchar_t* getAttributeTypeString(const c8* attributeName, const wchar_t* defaultNotFound = L"unknown");
//! Returns the type string of the attribute by index. //! Returns the type string of the attribute by index.
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual const wchar_t* getAttributeTypeString(s32 index); virtual const wchar_t* getAttributeTypeString(s32 index, const wchar_t* defaultNotFound = L"unknown");
//! Returns if an attribute with a name exists //! Returns if an attribute with a name exists
virtual bool existsAttribute(const c8* attributeName); virtual bool existsAttribute(const c8* attributeName);
...@@ -85,8 +86,9 @@ public: ...@@ -85,8 +86,9 @@ public:
//! Gets an attribute as integer value //! Gets an attribute as integer value
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual s32 getAttributeAsInt(const c8* attributeName) const; virtual s32 getAttributeAsInt(const c8* attributeName, irr::s32 defaultNotFound=0) const;
//! Gets an attribute as integer value //! Gets an attribute as integer value
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -109,8 +111,9 @@ public: ...@@ -109,8 +111,9 @@ public:
//! Gets an attribute as float value //! Gets an attribute as float value
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual f32 getAttributeAsFloat(const c8* attributeName); virtual f32 getAttributeAsFloat(const c8* attributeName, irr::f32 defaultNotFound=0.f);
//! Gets an attribute as float value //! Gets an attribute as float value
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -135,9 +138,10 @@ public: ...@@ -135,9 +138,10 @@ public:
//! Gets an attribute as string. //! Gets an attribute as string.
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
//! or 0 if attribute is not set. //! or defaultNotFound if attribute is not set.
virtual core::stringc getAttributeAsString(const c8* attributeName); virtual core::stringc getAttributeAsString(const c8* attributeName, const core::stringc& defaultNotFound=core::stringc());
//! Gets an attribute as string. //! Gets an attribute as string.
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
...@@ -164,9 +168,10 @@ public: ...@@ -164,9 +168,10 @@ public:
//! Gets an attribute as string. //! Gets an attribute as string.
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
//! or 0 if attribute is not set. //! or defaultNotFound if attribute is not set.
virtual core::stringw getAttributeAsStringW(const c8* attributeName); virtual core::stringw getAttributeAsStringW(const c8* attributeName, const core::stringw& defaultNotFound = core::stringw());
//! Gets an attribute as string. //! Gets an attribute as string.
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
...@@ -221,9 +226,10 @@ public: ...@@ -221,9 +226,10 @@ public:
//! Gets an attribute as an array of wide strings. //! Gets an attribute as an array of wide strings.
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
//! or 0 if attribute is not set. //! or defaultNotFound if attribute is not set.
virtual core::array<core::stringw> getAttributeAsArray(const c8* attributeName); virtual core::array<core::stringw> getAttributeAsArray(const c8* attributeName, const core::array<core::stringw>& defaultNotFound = core::array<core::stringw>());
//! Returns attribute value as an array of wide strings by index. //! Returns attribute value as an array of wide strings by index.
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -246,8 +252,9 @@ public: ...@@ -246,8 +252,9 @@ public:
//! Gets an attribute as boolean value //! Gets an attribute as boolean value
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual bool getAttributeAsBool(const c8* attributeName); virtual bool getAttributeAsBool(const c8* attributeName, bool defaultNotFound=false);
//! Gets an attribute as boolean value //! Gets an attribute as boolean value
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -273,8 +280,9 @@ public: ...@@ -273,8 +280,9 @@ public:
//! Gets an attribute as enumeration //! Gets an attribute as enumeration
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual const c8* getAttributeAsEnumeration(const c8* attributeName); virtual const c8* getAttributeAsEnumeration(const c8* attributeName, const c8* defaultNotFound = 0);
//! Gets an attribute as enumeration //! Gets an attribute as enumeration
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
...@@ -318,8 +326,9 @@ public: ...@@ -318,8 +326,9 @@ public:
//! Gets an attribute as color //! Gets an attribute as color
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual video::SColor getAttributeAsColor(const c8* attributeName); virtual video::SColor getAttributeAsColor(const c8* attributeName, const video::SColor& defaultNotFound = video::SColor(0));
//! Gets an attribute as color //! Gets an attribute as color
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -342,8 +351,9 @@ public: ...@@ -342,8 +351,9 @@ public:
//! Gets an attribute as floating point color //! Gets an attribute as floating point color
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual video::SColorf getAttributeAsColorf(const c8* attributeName); virtual video::SColorf getAttributeAsColorf(const c8* attributeName, const video::SColorf& defaultNotFound = video::SColorf(0));
//! Gets an attribute as floating point color //! Gets an attribute as floating point color
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -367,8 +377,9 @@ public: ...@@ -367,8 +377,9 @@ public:
//! Gets an attribute as 3d vector //! Gets an attribute as 3d vector
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::vector3df getAttributeAsVector3d(const c8* attributeName); virtual core::vector3df getAttributeAsVector3d(const c8* attributeName, const core::vector3df& defaultNotFound=core::vector3df(0,0,0));
//! Gets an attribute as 3d vector //! Gets an attribute as 3d vector
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -392,8 +403,9 @@ public: ...@@ -392,8 +403,9 @@ public:
//! Gets an attribute as 2d vector //! Gets an attribute as 2d vector
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::vector2df getAttributeAsVector2d(const c8* attributeName); virtual core::vector2df getAttributeAsVector2d(const c8* attributeName, const core::vector2df& defaultNotFound=core::vector2df(0,0));
//! Gets an attribute as 3d vector //! Gets an attribute as 3d vector
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -417,8 +429,9 @@ public: ...@@ -417,8 +429,9 @@ public:
//! Gets an attribute as position //! Gets an attribute as position
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::position2di getAttributeAsPosition2d(const c8* attributeName); virtual core::position2di getAttributeAsPosition2d(const c8* attributeName, const core::position2di& defaultNotFound=core::position2di(0,0));
//! Gets an attribute as position //! Gets an attribute as position
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -441,8 +454,9 @@ public: ...@@ -441,8 +454,9 @@ public:
//! Gets an attribute as rectangle //! Gets an attribute as rectangle
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::rect<s32> getAttributeAsRect(const c8* attributeName); virtual core::rect<s32> getAttributeAsRect(const c8* attributeName, const core::rect<s32>& defaultNotFound = core::rect<s32>());
//! Gets an attribute as rectangle //! Gets an attribute as rectangle
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -466,8 +480,9 @@ public: ...@@ -466,8 +480,9 @@ public:
//! Gets an attribute as dimension2d //! Gets an attribute as dimension2d
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::dimension2d<u32> getAttributeAsDimension2d(const c8* attributeName); virtual core::dimension2d<u32> getAttributeAsDimension2d(const c8* attributeName, const core::dimension2d<u32>& defaultNotFound = core::dimension2d<u32>());
//! Gets an attribute as dimension2d //! Gets an attribute as dimension2d
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -491,8 +506,9 @@ public: ...@@ -491,8 +506,9 @@ public:
//! Gets an attribute as a matrix4 //! Gets an attribute as a matrix4
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::matrix4 getAttributeAsMatrix(const c8* attributeName); virtual core::matrix4 getAttributeAsMatrix(const c8* attributeName, const core::matrix4& defaultNotFound=core::matrix4());
//! Gets an attribute as matrix //! Gets an attribute as matrix
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -514,8 +530,9 @@ public: ...@@ -514,8 +530,9 @@ public:
//! Gets an attribute as a quaternion //! Gets an attribute as a quaternion
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::quaternion getAttributeAsQuaternion(const c8* attributeName); virtual core::quaternion getAttributeAsQuaternion(const c8* attributeName, const core::quaternion& defaultNotFound=core::quaternion(0,1,0, 0));
//! Gets an attribute as quaternion //! Gets an attribute as quaternion
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -538,8 +555,9 @@ public: ...@@ -538,8 +555,9 @@ public:
//! Gets an attribute as a axis aligned bounding box //! Gets an attribute as a axis aligned bounding box
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::aabbox3df getAttributeAsBox3d(const c8* attributeName); virtual core::aabbox3df getAttributeAsBox3d(const c8* attributeName, const core::aabbox3df& defaultNotFound=core::aabbox3df(0,0,0, 0,0,0));
//! Gets an attribute as axis aligned bounding box //! Gets an attribute as axis aligned bounding box
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -562,8 +580,9 @@ public: ...@@ -562,8 +580,9 @@ public:
//! Gets an attribute as a 3d plane //! Gets an attribute as a 3d plane
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::plane3df getAttributeAsPlane3d(const c8* attributeName); virtual core::plane3df getAttributeAsPlane3d(const c8* attributeName, const core::plane3df& defaultNotFound=core::plane3df(0,0,0, 0,1,0));
//! Gets an attribute as 3d plane //! Gets an attribute as 3d plane
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -587,8 +606,9 @@ public: ...@@ -587,8 +606,9 @@ public:
//! Gets an attribute as a 3d triangle //! Gets an attribute as a 3d triangle
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::triangle3df getAttributeAsTriangle3d(const c8* attributeName); virtual core::triangle3df getAttributeAsTriangle3d(const c8* attributeName, const core::triangle3df& defaultNotFound = core::triangle3df(core::vector3df(0,0,0), core::vector3df(0,0,0), core::vector3df(0,0,0)));
//! Gets an attribute as 3d triangle //! Gets an attribute as 3d triangle
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -612,8 +632,9 @@ public: ...@@ -612,8 +632,9 @@ public:
//! Gets an attribute as a 2d line //! Gets an attribute as a 2d line
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::line2df getAttributeAsLine2d(const c8* attributeName); virtual core::line2df getAttributeAsLine2d(const c8* attributeName, const core::line2df& defaultNotFound = core::line2df(0,0, 0,0));
//! Gets an attribute as a 2d line //! Gets an attribute as a 2d line
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -637,8 +658,9 @@ public: ...@@ -637,8 +658,9 @@ public:
//! Gets an attribute as a 3d line //! Gets an attribute as a 3d line
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute() //! \return Returns value of the attribute previously set by setAttribute()
virtual core::line3df getAttributeAsLine3d(const c8* attributeName); virtual core::line3df getAttributeAsLine3d(const c8* attributeName, const core::line3df& defaultNotFound=core::line3df(0,0,0, 0,0,0));
//! Gets an attribute as a 3d line //! Gets an attribute as a 3d line
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -662,7 +684,8 @@ public: ...@@ -662,7 +684,8 @@ public:
//! Gets an attribute as texture reference //! Gets an attribute as texture reference
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
virtual video::ITexture* getAttributeAsTexture(const c8* attributeName); //! \param defaultNotFound Value returned when attributeName was not found
virtual video::ITexture* getAttributeAsTexture(const c8* attributeName, video::ITexture* defaultNotFound=0);
//! Gets an attribute as texture reference //! Gets an attribute as texture reference
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
...@@ -687,7 +710,8 @@ public: ...@@ -687,7 +710,8 @@ public:
//! Gets an attribute as user pointer //! Gets an attribute as user pointer
//! \param attributeName: Name of the attribute to get. //! \param attributeName: Name of the attribute to get.
virtual void* getAttributeAsUserPointer(const c8* attributeName); //! \param defaultNotFound Value returned when attributeName was not found
virtual void* getAttributeAsUserPointer(const c8* attributeName, void* defaultNotFound = 0);
//! Gets an attribute as user pointer //! Gets an attribute as user pointer
//! \param index: Index value, must be between 0 and getAttributeCount()-1. //! \param index: Index value, must be between 0 and getAttributeCount()-1.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment