Change public member variable to private
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / internal / loader / dli-loader-impl.cpp
index 3a08ea4..f111856 100644 (file)
@@ -1439,51 +1439,56 @@ void DliLoaderImpl::Impl::ParseAnimations(const TreeNode* tnAnimations, LoadPara
       ++iAnim)
   {
     const TreeNode&     tnAnim = (*iAnim).second;
+    uint32_t animationPropertyIndex = 0;
     AnimationDefinition animDef;
-    ReadString(tnAnim.GetChild(NAME), animDef.mName);
+    std::string animationName;
+    ReadString(tnAnim.GetChild(NAME), animationName);
+    animDef.SetName(animationName);
 
-    auto       iFind     = std::lower_bound(definitions.begin(), definitions.end(), animDef, [](const AnimationDefinition& ad0, const AnimationDefinition& ad1) { return ad0.mName < ad1.mName; });
-    const bool overwrite = iFind != definitions.end() && iFind->mName == animDef.mName;
+    auto       iFind     = std::lower_bound(definitions.begin(), definitions.end(), animDef, [](const AnimationDefinition& ad0, const AnimationDefinition& ad1) { return ad0.GetName() < ad1.GetName(); });
+    const bool overwrite = iFind != definitions.end() && iFind->GetName() == animDef.GetName();
     if(overwrite)
     {
-      mOnError(FormatString("Pre-existing animation with name '%s' is being overwritten.", animDef.mName.c_str()));
+      mOnError(FormatString("Pre-existing animation with name '%s' is being overwritten.", animDef.GetName().c_str()));
     }
 
     // Duration -- We need something that animated properties' delay / duration can
     // be expressed as a multiple of; 0 won't work. This is small enough (i.e. shorter
     // than our frame delay) to not be restrictive WRT replaying. If anything needs
     // to occur more frequently, then Animations are likely not your solution anyway.
-    animDef.mDuration = AnimationDefinition::MIN_DURATION_SECONDS;
-    if(!ReadFloat(tnAnim.GetChild("duration"), animDef.mDuration))
+    animDef.SetDuration(AnimationDefinition::MIN_DURATION_SECONDS);
+    float animationDuration;
+    if(!ReadFloat(tnAnim.GetChild("duration"), animationDuration))
     {
+      animDef.SetDuration(animationDuration);
       mOnError(FormatString("Animation '%s' fails to define '%s', defaulting to %f.",
-                            animDef.mName.c_str(),
+                            animDef.GetName().c_str(),
                             "duration",
-                            animDef.mDuration));
+                            animDef.GetDuration()));
     }
 
     // Get loop count - # of playbacks. Default is once. 0 means repeat indefinitely.
-    animDef.mLoopCount = 1;
-    if(ReadInt(tnAnim.GetChild("loopCount"), animDef.mLoopCount) &&
-       animDef.mLoopCount < 0)
+    int32_t animationLoopCount = 1;
+    if(ReadInt(tnAnim.GetChild("loopCount"), animationLoopCount) && animationLoopCount < 0)
     {
-      animDef.mLoopCount = 0;
+      animationLoopCount = 0;
     }
+    animDef.SetLoopCount(animationLoopCount);
 
     std::string endAction;
     if(ReadString(tnAnim.GetChild("endAction"), endAction))
     {
       if("BAKE" == endAction)
       {
-        animDef.mEndAction = Animation::BAKE;
+        animDef.SetEndAction(Animation::BAKE);
       }
       else if("DISCARD" == endAction)
       {
-        animDef.mEndAction = Animation::DISCARD;
+        animDef.SetEndAction(Animation::DISCARD);
       }
       else if("BAKE_FINAL" == endAction)
       {
-        animDef.mEndAction = Animation::BAKE_FINAL;
+        animDef.SetEndAction(Animation::BAKE_FINAL);
       }
     }
 
@@ -1491,21 +1496,21 @@ void DliLoaderImpl::Impl::ParseAnimations(const TreeNode* tnAnimations, LoadPara
     {
       if("BAKE" == endAction)
       {
-        animDef.mDisconnectAction = Animation::BAKE;
+        animDef.SetDisconnectAction(Animation::BAKE);
       }
       else if("DISCARD" == endAction)
       {
-        animDef.mDisconnectAction = Animation::DISCARD;
+        animDef.SetDisconnectAction(Animation::DISCARD);
       }
       else if("BAKE_FINAL" == endAction)
       {
-        animDef.mDisconnectAction = Animation::BAKE_FINAL;
+        animDef.SetDisconnectAction(Animation::BAKE_FINAL);
       }
     }
 
     if(const TreeNode* tnProperties = tnAnim.GetChild("properties"))
     {
-      animDef.mProperties.reserve(tnProperties->Size());
+      animDef.ReserveSize(tnProperties->Size());
       for(TreeNode::ConstIterator iProperty = tnProperties->CBegin(), iPropertyEnd = tnProperties->CEnd();
           iProperty != iPropertyEnd;
           ++iProperty)
@@ -1515,24 +1520,24 @@ void DliLoaderImpl::Impl::ParseAnimations(const TreeNode* tnAnimations, LoadPara
         AnimatedProperty animProp;
         if(!ReadString(tnProperty.GetChild("node"), animProp.mNodeName))
         {
-          mOnError(FormatString("Animation '%s': Failed to read the 'node' tag.", animDef.mName.c_str()));
+          mOnError(FormatString("Animation '%s': Failed to read the 'node' tag.", animDef.GetName().c_str()));
           continue;
         }
 
         if(!ReadString(tnProperty.GetChild("property"), animProp.mPropertyName))
         {
-          mOnError(FormatString("Animation '%s': Failed to read the 'property' tag", animDef.mName.c_str()));
+          mOnError(FormatString("Animation '%s': Failed to read the 'property' tag", animDef.GetName().c_str()));
           continue;
         }
 
         // these are the defaults
         animProp.mTimePeriod.delaySeconds    = 0.f;
-        animProp.mTimePeriod.durationSeconds = animDef.mDuration;
+        animProp.mTimePeriod.durationSeconds = animDef.GetDuration();
         if(!ReadTimePeriod(tnProperty.GetChild("timePeriod"), animProp.mTimePeriod))
         {
           mOnError(FormatString("Animation '%s': timePeriod missing in Property #%d: defaulting to %f.",
-                                animDef.mName.c_str(),
-                                animDef.mProperties.size(),
+                                animDef.GetName().c_str(),
+                                animDef.GetPropertyCount(),
                                 animProp.mTimePeriod.durationSeconds));
         }
 
@@ -1668,7 +1673,7 @@ void DliLoaderImpl::Impl::ParseAnimations(const TreeNode* tnAnimations, LoadPara
           }
         }
 
-        animDef.mProperties.push_back(std::move(animProp));
+        animDef.SetProperty(animationPropertyIndex++, std::move(animProp));
       }
     }