[dali_1.3.42] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / layouting / layout-length.h
index 94f7ae0..73c9b96 100644 (file)
@@ -34,6 +34,11 @@ class LayoutLength
 public:
   using IntType = int;
 
+  LayoutLength()
+  : mValue( 0 )
+  {
+  }
+
   LayoutLength( IntType value )
   : mValue( value )
   {
@@ -46,7 +51,10 @@ public:
 
   LayoutLength& operator=(const LayoutLength& rhs)
   {
-    mValue = rhs.mValue;
+    if( this != &rhs )
+    {
+      mValue = rhs.mValue;
+    }
     return *this;
   }
 
@@ -161,12 +169,16 @@ public:
   }
   LayoutLength operator*( float rhs )
   {
-    return LayoutLength(LayoutLength::IntType(float(mValue) * rhs));
+    return LayoutLength(LayoutLength::IntType(AsFloat() * rhs));
   }
 
-  operator float()
+  /**
+   * @brief explicit method to return the value as float
+   * @return the LayoutLength as float
+   */
+  float AsFloat() const
   {
-    return float( mValue );
+    return static_cast<float>( mValue );
   }
 
   IntType mValue;