/*
- * Copyright (c) 2019 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.
return std::string();
}
-Property::Index Object::GetPropertyIndex( const std::string& name ) const
+Property::Index Object::GetPropertyIndex( Property::Key key ) const
{
Property::Index index = Property::INVALID_INDEX;
- const TypeInfo* typeInfo( GetTypeInfo() );
- if ( typeInfo )
- {
- index = typeInfo->GetPropertyIndex( name );
- }
- if( (index == Property::INVALID_INDEX)&&( mCustomProperties.Count() > 0 ) )
+ if( key.type == Property::Key::STRING )
{
- Property::Index count = PROPERTY_CUSTOM_START_INDEX;
- const auto end = mCustomProperties.End();
- for( auto iter = mCustomProperties.Begin(); iter != end; ++iter, ++count )
+ const TypeInfo* typeInfo( GetTypeInfo() );
+ if ( typeInfo )
{
- CustomPropertyMetadata* custom = static_cast<CustomPropertyMetadata*>(*iter);
- if ( custom->name == name )
- {
- if ( custom->childPropertyIndex != Property::INVALID_INDEX )
- {
- // If it is a child property, return the child property index
- index = custom->childPropertyIndex;
- }
- else
- {
- index = count;
- }
- break;
- }
+ index = typeInfo->GetPropertyIndex( key.stringKey );
}
}
- return index;
-}
-
-Property::Index Object::GetPropertyIndex( Property::Index key ) const
-{
- Property::Index index = Property::INVALID_INDEX;
-
- if( mCustomProperties.Count() > 0 )
+ if( (index == Property::INVALID_INDEX)&&( mCustomProperties.Count() > 0 ) )
{
Property::Index count = PROPERTY_CUSTOM_START_INDEX;
const auto end = mCustomProperties.End();
for( auto iter = mCustomProperties.Begin(); iter != end; ++iter, ++count )
{
CustomPropertyMetadata* custom = static_cast<CustomPropertyMetadata*>(*iter);
- if( custom->key == key )
+
+ if( ( key.type == Property::Key::STRING && custom->name == key.stringKey) ||
+ ( key.type == Property::Key::INDEX && custom->key == key.indexKey ) )
{
- if( custom->childPropertyIndex != Property::INVALID_INDEX )
+ if ( custom->childPropertyIndex != Property::INVALID_INDEX )
{
// If it is a child property, return the child property index
index = custom->childPropertyIndex;
return index;
}
-Property::Index Object::GetPropertyIndex( Property::Key key ) const
-{
- Property::Index index = Property::INVALID_INDEX;
- if( key.type == Property::Key::INDEX )
- {
- index = GetPropertyIndex( key.indexKey );
- }
- else
- {
- index = GetPropertyIndex( key.stringKey );
- }
- return index;
-}
-
bool Object::IsPropertyWritable( Property::Index index ) const
{
DALI_ASSERT_ALWAYS(index > Property::INVALID_INDEX && "Property index is out of bounds");
else if ( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) )
{
// check whether the animatable property is registered already, if not then register one.
- // this is needed because property value may have been set as full property and get as a property component
+ // this is needed because property value may have been set as full property and get as a property component
AnimatablePropertyMetadata* animatableProperty = GetSceneAnimatableProperty( index, nullptr );
if( animatableProperty )
{
else if ( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) )
{
// check whether the animatable property is registered already, if not then register one.
- // this is needed because property value may have been set as full property and get as a property component
+ // this is needed because property value may have been set as full property and get as a property component
AnimatablePropertyMetadata* animatableProperty = GetSceneAnimatableProperty( index, nullptr );
if( animatableProperty )
{
// Iterating twice to get the value we want should still be fairly quick in a Property::Map.
const auto& key = properties.GetKeyAt( position );
- const auto propertyIndex = ( key.type == Property::Key::INDEX ) ? key.indexKey : GetPropertyIndex( key.stringKey );
+ const auto propertyIndex = ( key.type == Property::Key::INDEX ) ? key.indexKey : GetPropertyIndex( key );
if( propertyIndex != Property::INVALID_INDEX )
{
return componentIndex;
}
-DevelHandle::PropertySetSignalType& Object::PropertySetSignal()
+Handle::PropertySetSignalType& Object::PropertySetSignal()
{
return mPropertySetSignal;
}