Support for ASTC compressed textures wrapped in KTX files
[platform/core/uifw/dali-core.git] / dali / public-api / object / property-value.cpp
index 6a46abb..85f407f 100644 (file)
@@ -42,11 +42,11 @@ namespace Dali
 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 );
 }
 }
 
@@ -72,11 +72,6 @@ struct Property::Value::Impl
     integerValue( integerValue )
   { }
 
-  Impl( unsigned int unsignedIntegerValue )
-  : type( Property::UNSIGNED_INTEGER ),
-    unsignedIntegerValue( unsignedIntegerValue )
-  { }
-
   Impl( const Vector2& vectorValue )
   : type( Property::VECTOR2 ),
     vector2Value( new Vector2( vectorValue ) )
@@ -150,8 +145,7 @@ struct Property::Value::Impl
       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
       }
@@ -215,7 +209,6 @@ public: // Data
   {
     int integerValue;
     float floatValue;
-    unsigned int unsignedIntegerValue;
     // must use pointers for any class value pre c++ 11
     Vector2* vector2Value;
     Vector3* vector3Value;
@@ -250,11 +243,6 @@ Property::Value::Value( int integerValue )
 {
 }
 
-Property::Value::Value( unsigned int unsignedIntegerValue )
-: mImpl( new Impl( unsignedIntegerValue ) )
-{
-}
-
 Property::Value::Value( const Vector2& vectorValue )
 : mImpl( new Impl( vectorValue ) )
 {
@@ -342,11 +330,6 @@ Property::Value::Value( Type type )
       mImpl = new Impl( 0 );
       break;
     }
-    case Property::UNSIGNED_INTEGER:
-    {
-      mImpl = new Impl( 0U );
-      break;
-    }
     case Property::VECTOR2:
     {
       mImpl = new Impl( Vector2::ZERO );
@@ -404,6 +387,7 @@ Property::Value::Value( Type type )
     }
   }
 }
+
 Property::Value::Value( const Property::Value& value )
 : mImpl( NULL )
 {
@@ -445,11 +429,6 @@ Property::Value& Property::Value::operator=( const Property::Value& value )
         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
@@ -526,11 +505,6 @@ Property::Value& Property::Value::operator=( const Property::Value& value )
         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
@@ -621,10 +595,18 @@ bool Property::Value::Get( bool& booleanValue ) const
 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;
 }
@@ -632,21 +614,18 @@ bool Property::Value::Get( float& floatValue ) const
 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;
 }
@@ -815,11 +794,6 @@ std::ostream& operator<<( std::ostream& stream, const Property::Value& value )
          stream << impl.integerValue;
          break;
       }
-      case Dali::Property::UNSIGNED_INTEGER:
-      {
-        stream << impl.unsignedIntegerValue;
-        break;
-      }
       case Dali::Property::VECTOR2:
       {
         stream << *impl.vector2Value;