-#ifndef __DALI_PROPERTY_INPUT_ACCESSOR_H__
-#define __DALI_PROPERTY_INPUT_ACCESSOR_H__
+#ifndef DALI_PROPERTY_INPUT_ACCESSOR_H
+#define DALI_PROPERTY_INPUT_ACCESSOR_H
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
* Create the PropertyInputAccessor.
*/
PropertyInputAccessor()
- : mInput( NULL ),
+ : mInput( nullptr ),
mComponentIndex( -1 )
{
}
/**
* Create the PropertyInputAccessor.
*/
- PropertyInputAccessor( const PropertyInputImpl* input, int componentIndex )
+ PropertyInputAccessor( const PropertyInputImpl* input, int32_t componentIndex )
: mInput( input ),
mComponentIndex( componentIndex )
{
/**
* Copy from a PropertyInputAccessor
*/
- PropertyInputAccessor( const PropertyInputAccessor& accessor )
- : mInput( accessor.mInput ),
- mComponentIndex( accessor.mComponentIndex )
- {
- }
+ PropertyInputAccessor(const PropertyInputAccessor& accessor) = default;
/**
* Copy from a PropertyInputAccessor
*/
PropertyInputAccessor& operator=(const PropertyInputAccessor& accessor)
{
- mInput = accessor.mInput;
- mComponentIndex = accessor.mComponentIndex;
+ if( this != &accessor )
+ {
+ mInput = accessor.mInput;
+ mComponentIndex = accessor.mComponentIndex;
+ }
return *this;
}
/**
* Set the property input.
*/
- void SetInput( const PropertyInputImpl& input, int componentIndex )
+ void SetInput( const PropertyInputImpl& input, int32_t componentIndex )
{
mInput = &input;
mComponentIndex = componentIndex;
}
/**
+ * @copydoc Dali::Internal::PropertyInputImpl::GetConstraintInputInteger() const
+ */
+ const int& GetConstraintInputInteger( BufferIndex updateBufferIndex ) const
+ {
+ DALI_ASSERT_DEBUG( mComponentIndex < 0 && "Did not expect valid component index" );
+
+ return mInput->GetConstraintInputInteger( updateBufferIndex );
+ }
+
+ /**
* @copydoc Dali::Internal::PropertyInputImpl::GetConstraintInputFloat()
*/
const float& GetConstraintInputFloat( BufferIndex updateBufferIndex ) const
// Invalid index is ok
if ( mComponentIndex < 0 )
{
- // Not a Vector3 or Vector4 component, expecting float type
+ // Not a Vector2, Vector3 or Vector4 component, expecting float type
return mInput->GetConstraintInputFloat( updateBufferIndex );
}
+ else if ( PropertyTypes::Get< Vector2 >() == mInput->GetType() )
+ {
+ if ( 0 == mComponentIndex )
+ {
+ return mInput->GetConstraintInputVector2( updateBufferIndex ).x;
+ }
+
+ DALI_ASSERT_DEBUG( 1 == mComponentIndex && "Invalid Vector2 component index" );
+ return mInput->GetConstraintInputVector2( updateBufferIndex ).y;
+ }
else if ( PropertyTypes::Get< Vector3 >() == mInput->GetType() )
{
if ( 0 == mComponentIndex )
}
else if ( 2 == mComponentIndex )
{
- return mInput->GetConstraintInputVector4( updateBufferIndex ).y;
+ return mInput->GetConstraintInputVector4( updateBufferIndex ).z;
}
DALI_ASSERT_DEBUG( 3 == mComponentIndex && "Invalid Vector4 component index" );
}
/**
- * @copydoc Dali::Internal::PropertyInputImpl::GetConstraintInputInteger() const
- */
- const int& GetConstraintInputInteger( BufferIndex updateBufferIndex ) const
- {
- return mInput->GetConstraintInputInteger( updateBufferIndex );
- }
-
- /**
* @copydoc Dali::Internal::PropertyInputImpl::GetConstraintInputVector2()
*/
const Vector2& GetConstraintInputVector2( BufferIndex updateBufferIndex ) const
public:
const PropertyInputImpl* mInput;
- int mComponentIndex;
+ int32_t mComponentIndex;
+
};
} // namespace Internal
} // namespace Dali
-#endif // __DALI_PROPERTY_INPUT_ACCESSOR_H__
+#endif // DALI_PROPERTY_INPUT_ACCESSOR_H