namespace
{
/**
- * Helper to check if the property value can be read as int/unsigned int/bool
+ * Helper to check if the property value can be read as int/bool
*/
inline bool IsIntegerType( Property::Type type )
{
- return ( Property::BOOLEAN == type )||( Property::INTEGER == type )||(Property::UNSIGNED_INTEGER == type );
+ return ( Property::BOOLEAN == type )||( Property::INTEGER == type );
}
}
integerValue( integerValue )
{ }
- Impl( unsigned int unsignedIntegerValue )
- : type( Property::UNSIGNED_INTEGER ),
- unsignedIntegerValue( unsignedIntegerValue )
- { }
-
Impl( const Vector2& vectorValue )
: type( Property::VECTOR2 ),
vector2Value( new Vector2( vectorValue ) )
case Property::NONE : // FALLTHROUGH
case Property::BOOLEAN : // FALLTHROUGH
case Property::FLOAT : // FALLTHROUGH
- case Property::INTEGER : // FALLTHROUGH
- case Property::UNSIGNED_INTEGER :
+ case Property::INTEGER :
{
break; // nothing to do
}
{
int integerValue;
float floatValue;
- unsigned int unsignedIntegerValue;
// must use pointers for any class value pre c++ 11
Vector2* vector2Value;
Vector3* vector3Value;
{
}
-Property::Value::Value( unsigned int unsignedIntegerValue )
-: mImpl( new Impl( unsignedIntegerValue ) )
-{
-}
-
Property::Value::Value( const Vector2& vectorValue )
: mImpl( new Impl( vectorValue ) )
{
mImpl = new Impl( 0 );
break;
}
- case Property::UNSIGNED_INTEGER:
- {
- mImpl = new Impl( 0U );
- break;
- }
case Property::VECTOR2:
{
mImpl = new Impl( Vector2::ZERO );
}
}
}
+
Property::Value::Value( const Property::Value& value )
: mImpl( NULL )
{
mImpl->integerValue = value.mImpl->integerValue;
break;
}
- case Property::UNSIGNED_INTEGER:
- {
- mImpl->unsignedIntegerValue = value.mImpl->unsignedIntegerValue;
- break;
- }
case Property::VECTOR2:
{
*mImpl->vector2Value = *value.mImpl->vector2Value; // type cannot change in mImpl so vector is allocated
newImpl = new Impl( value.mImpl->integerValue );
break;
}
- case Property::UNSIGNED_INTEGER:
- {
- newImpl = new Impl( value.mImpl->unsignedIntegerValue );
- break;
- }
case Property::VECTOR2:
{
newImpl = new Impl( *value.mImpl->vector2Value ); // type cannot change in mImpl so vector is allocated
bool Property::Value::Get( float& floatValue ) const
{
bool converted = false;
- if( mImpl && mImpl->type == FLOAT )
+ if( mImpl )
{
- floatValue = mImpl->floatValue;
- converted = true;
+ if( mImpl->type == FLOAT )
+ {
+ floatValue = mImpl->floatValue;
+ converted = true;
+ }
+ else if( IsIntegerType( mImpl->type ) )
+ {
+ floatValue = static_cast< float >( mImpl->integerValue );
+ converted = true;
+ }
}
return converted;
}
bool Property::Value::Get( int& integerValue ) const
{
bool converted = false;
- if( mImpl && IsIntegerType( mImpl->type ) )
- {
- integerValue = mImpl->integerValue;
- converted = true;
- }
- return converted;
-}
-
-bool Property::Value::Get( unsigned int& unsignedIntegerValue ) const
-{
- bool converted = false;
- if( mImpl && IsIntegerType( mImpl->type ) )
+ if( mImpl )
{
- unsignedIntegerValue = mImpl->unsignedIntegerValue;
- converted = true;
+ if( IsIntegerType( mImpl->type ) )
+ {
+ integerValue = mImpl->integerValue;
+ converted = true;
+ }
+ else if( mImpl->type == FLOAT )
+ {
+ integerValue = static_cast< int >( mImpl->floatValue );
+ converted = true;
+ }
}
return converted;
}
stream << impl.integerValue;
break;
}
- case Dali::Property::UNSIGNED_INTEGER:
- {
- stream << impl.unsignedIntegerValue;
- break;
- }
case Dali::Property::VECTOR2:
{
stream << *impl.vector2Value;