[dali_1.9.32] Merge branch 'devel/master'
[platform/core/uifw/dali-core.git] / dali / internal / event / common / property-metadata.cpp
index c77a570..1df9d5e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include <dali/public-api/math/vector3.h>
 #include <dali/public-api/math/vector4.h>
 #include <dali/public-api/object/property.h>
+#include <dali/public-api/common/extents.h>
+#include <dali/public-api/math/matrix3.h>
+#include <dali/public-api/math/matrix.h>
+#include <dali/public-api/math/rect.h>
+#include <dali/public-api/object/property-map.h>
+#include <dali/public-api/object/property-array.h>
 
 namespace Dali
 {
@@ -53,19 +59,118 @@ void PropertyMetadata::SetPropertyValue( const Property::Value& propertyValue )
   switch ( GetType() )
   {
     case Property::NONE:
+    {
+      // NOOP
+      break;
+    }
+
     case Property::RECTANGLE:
+    {
+      Rect<int32_t> convertedValue;
+      if( propertyValue.Get( convertedValue ) )
+      {
+        value = convertedValue;
+      }
+      break;
+    }
+
     case Property::STRING:
+    {
+      std::string convertedValue;
+      if( propertyValue.Get( convertedValue ) )
+      {
+        value = convertedValue;
+      }
+      break;
+    }
+
     case Property::ARRAY:
+    {
+      const Property::Array* array = propertyValue.GetArray();
+      if( array )
+      {
+        value = *array;
+      }
+      break;
+    }
+
     case Property::MAP:
+    {
+      const Property::Map* map = propertyValue.GetMap();
+      if( map )
+      {
+        value = *map;
+      }
+      break;
+    }
+
     case Property::EXTENTS:
+    {
+      Extents convertedValue;
+      if( propertyValue.Get( convertedValue ) )
+      {
+        value = convertedValue;
+      }
+      break;
+    }
+
     case Property::BOOLEAN:
+    {
+      bool convertedValue;
+      if( propertyValue.Get( convertedValue ) )
+      {
+        value = convertedValue;
+      }
+      break;
+    }
+
     case Property::INTEGER:
+    {
+      int32_t convertedValue;
+      if( propertyValue.Get( convertedValue ) )
+      {
+        value = convertedValue;
+      }
+      break;
+    }
+
     case Property::FLOAT:
+    {
+      float convertedValue;
+      if( propertyValue.Get( convertedValue ) )
+      {
+        value = convertedValue;
+      }
+      break;
+    }
+
     case Property::ROTATION:
+    {
+      Quaternion convertedValue;
+      if( propertyValue.Get( convertedValue ) )
+      {
+        value = convertedValue;
+      }
+      break;
+    }
+
     case Property::MATRIX:
+    {
+      Matrix convertedValue;
+      if( propertyValue.Get( convertedValue ) )
+      {
+        value = convertedValue;
+      }
+      break;
+    }
+
     case Property::MATRIX3:
     {
-      value = propertyValue;
+      Matrix3 convertedValue;
+      if( propertyValue.Get( convertedValue ) )
+      {
+        value = convertedValue;
+      }
       break;
     }