/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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/object/property-conditions.h>
// INTERNAL INCLUDES
-#include <dali/public-api/object/property-value.h>
#include <dali/internal/event/common/property-conditions-impl.h>
+#include <dali/public-api/object/property-value.h>
namespace Dali
{
-
PropertyCondition::PropertyCondition()
: BaseHandle(new Internal::PropertyCondition())
{
-
}
-PropertyCondition::~PropertyCondition()
-{
+PropertyCondition::~PropertyCondition() = default;
-}
+PropertyCondition::PropertyCondition(const PropertyCondition& handle) = default;
-PropertyCondition::PropertyCondition(const PropertyCondition& handle)
-: BaseHandle(handle)
-{
-}
+PropertyCondition& PropertyCondition::operator=(const PropertyCondition& rhs) = default;
-PropertyCondition& PropertyCondition::operator=(const PropertyCondition& rhs)
-{
- BaseHandle::operator=(rhs);
- return *this;
-}
+PropertyCondition::PropertyCondition(PropertyCondition&& rhs) noexcept = default;
+
+PropertyCondition& PropertyCondition::operator=(PropertyCondition&& rhs) noexcept = default;
-PropertyCondition::ArgumentContainer PropertyCondition::GetArguments()
+std::size_t PropertyCondition::GetArgumentCount() const
{
- return GetImplementation(*this).arguments;
+ return GetImplementation(*this).arguments.Count();
}
-const PropertyCondition::ArgumentContainer& PropertyCondition::GetArguments() const
+float PropertyCondition::GetArgument(std::size_t index) const
{
- return GetImplementation(*this).arguments;
+ return GetImplementation(*this).arguments[index];
}
PropertyCondition LessThanCondition(float arg)
{
- PropertyCondition condition;
- GetImplementation(condition).type = Internal::PropertyCondition::LessThan;
- GetImplementation(condition).arguments.push_back(Property::Value(arg));
+ PropertyCondition condition;
+ Internal::PropertyCondition& impl = GetImplementation(condition);
+ impl.type = Internal::PropertyCondition::LessThan;
+ impl.arguments.PushBack(arg);
return condition;
}
PropertyCondition GreaterThanCondition(float arg)
{
- PropertyCondition condition;
- GetImplementation(condition).type = Internal::PropertyCondition::GreaterThan;
- GetImplementation(condition).arguments.push_back(Property::Value(arg));
+ PropertyCondition condition;
+ Internal::PropertyCondition& impl = GetImplementation(condition);
+ impl.type = Internal::PropertyCondition::GreaterThan;
+ impl.arguments.PushBack(arg);
return condition;
}
PropertyCondition InsideCondition(float arg0, float arg1)
{
- PropertyCondition condition;
- GetImplementation(condition).type = Internal::PropertyCondition::Inside;
- GetImplementation(condition).arguments.push_back(Property::Value(arg0));
- GetImplementation(condition).arguments.push_back(Property::Value(arg1));
+ PropertyCondition condition;
+ Internal::PropertyCondition& impl = GetImplementation(condition);
+ impl.type = Internal::PropertyCondition::Inside;
+ impl.arguments.PushBack(arg0);
+ impl.arguments.PushBack(arg1);
return condition;
}
PropertyCondition OutsideCondition(float arg0, float arg1)
{
- PropertyCondition condition;
- GetImplementation(condition).type = Internal::PropertyCondition::Outside;
- GetImplementation(condition).arguments.push_back(Property::Value(arg0));
- GetImplementation(condition).arguments.push_back(Property::Value(arg1));
+ PropertyCondition condition;
+ Internal::PropertyCondition& impl = GetImplementation(condition);
+ impl.type = Internal::PropertyCondition::Outside;
+ impl.arguments.PushBack(arg0);
+ impl.arguments.PushBack(arg1);
return condition;
}
PropertyCondition StepCondition(float stepAmount, float referenceValue)
{
- PropertyCondition condition;
- GetImplementation(condition).type = Internal::PropertyCondition::Step;
- GetImplementation(condition).arguments.push_back(Property::Value(referenceValue));
- GetImplementation(condition).arguments.push_back(Property::Value(1.0f / stepAmount));
- GetImplementation(condition).arguments.push_back(Property::Value(0.0f)); // current step
+ PropertyCondition condition;
+ Internal::PropertyCondition& impl = GetImplementation(condition);
+ impl.type = Internal::PropertyCondition::Step;
+ impl.arguments.PushBack(referenceValue);
+ impl.arguments.PushBack(1.0f / stepAmount);
+ impl.arguments.PushBack(0.0f); // current step
return condition;
}
-PropertyCondition VariableStepCondition(const std::vector<float>& stepAmount)
+PropertyCondition VariableStepCondition(const Dali::Vector<float>& stepAmount)
{
- PropertyCondition condition;
- GetImplementation(condition).type = Internal::PropertyCondition::VariableStep;
- GetImplementation(condition).arguments.push_back(Property::Value(0.0f)); // current step
- int size = stepAmount.size();
- GetImplementation(condition).arguments.push_back(Property::Value(static_cast<float>(size))); // store number of steps
- for( std::vector<float>::const_iterator it = stepAmount.begin(), endIt = stepAmount.end(); it != endIt; ++it )
+ PropertyCondition condition;
+ Internal::PropertyCondition& impl = GetImplementation(condition);
+ impl.type = Internal::PropertyCondition::VariableStep;
+ impl.arguments.PushBack(0.0f); // current step
+ Dali::Vector<float>::SizeType count = stepAmount.Count();
+ impl.arguments.PushBack(float(count)); // store number of steps
+ for(Dali::Vector<float>::SizeType index = 0; index < count; ++index)
{
- GetImplementation(condition).arguments.push_back(Property::Value( *it ));
+ impl.arguments.PushBack(stepAmount[index]);
}
return condition;