-Fix RegisterProperty() interface to take name and property by value.
-Fix SetProperty() interface to take property by value.
-Fix RegisterProperty() interface to take name and property by value.
Change-Id: I04231da346a62d3aa56892453d36ed0c0b1657f5
return Property::NONE;
}
-void Object::SetProperty( Property::Index index, const Property::Value& propertyValue )
+void Object::SetProperty(Property::Index index, Property::Value propertyValue)
{
DALI_ASSERT_ALWAYS(index > Property::INVALID_INDEX && "Property index is out of bounds" );
if ( propertySet )
{
OnPropertySet( index, propertyValue );
- Dali::Handle handle( this );
- mPropertySetSignal.Emit( handle, index, propertyValue );
+ if(!mPropertySetSignal.Empty())
+ {
+ Dali::Handle handle(this);
+ mPropertySetSignal.Emit(handle, index, propertyValue);
+ }
}
}
}
}
-Property::Index Object::RegisterProperty( const std::string& name, const Property::Value& propertyValue )
+Property::Index Object::RegisterProperty(std::string name, Property::Value propertyValue)
{
- return RegisterProperty( name, Property::INVALID_KEY, propertyValue, Property::ANIMATABLE );
+ return RegisterProperty(std::move(name), Property::INVALID_KEY, std::move(propertyValue), Property::ANIMATABLE);
}
-Property::Index Object::RegisterProperty( const std::string& name, Property::Index key, const Property::Value& propertyValue )
+Property::Index Object::RegisterProperty(std::string name, Property::Index key, Property::Value propertyValue)
{
- return RegisterProperty( name, key, propertyValue, Property::ANIMATABLE );
+ return RegisterProperty(std::move(name), key, std::move(propertyValue), Property::ANIMATABLE);
}
void Object::SetProperties( const Property::Map& properties )
}
}
-Property::Index Object::RegisterProperty( const std::string& name, const Property::Value& propertyValue, Property::AccessMode accessMode )
+Property::Index Object::RegisterProperty(std::string name,
+ Property::Value propertyValue,
+ Property::AccessMode accessMode)
{
- return RegisterProperty( name, Property::INVALID_KEY, propertyValue, accessMode );
+ return RegisterProperty(std::move(name), Property::INVALID_KEY, std::move(propertyValue), accessMode);
}
-Property::Index Object::RegisterProperty( const std::string& name, Property::Index key, const Property::Value& propertyValue, Property::AccessMode accessMode )
+Property::Index Object::RegisterProperty(std::string name,
+ Property::Index key,
+ Property::Value propertyValue,
+ Property::AccessMode accessMode)
{
// If property with the required key already exists, then just set it.
Property::Index index = Property::INVALID_INDEX;
if( index != Property::INVALID_INDEX ) // If there was a valid index found by either key, set it.
{
- SetProperty( index, propertyValue );
+ SetProperty(index, std::move(propertyValue));
}
else
{
// Otherwise register the property
if( Property::ANIMATABLE == accessMode )
{
- index = RegisterSceneGraphProperty( name, key, PROPERTY_CUSTOM_START_INDEX + static_cast<Property::Index>( mCustomProperties.Count() ), propertyValue );
- AddUniformMapping( index, name );
+ index = RegisterSceneGraphProperty(
+ name,
+ key,
+ PROPERTY_CUSTOM_START_INDEX + static_cast<Property::Index>(mCustomProperties.Count()),
+ std::move(propertyValue));
+ AddUniformMapping(index, std::move(name));
}
else
{
// Add entry to the property lookup
index = PROPERTY_CUSTOM_START_INDEX + static_cast<Property::Index>( mCustomProperties.Count() );
- CustomPropertyMetadata* customProperty = new CustomPropertyMetadata( name, propertyValue, accessMode );
+ CustomPropertyMetadata* customProperty =
+ new CustomPropertyMetadata(name, std::move(propertyValue), accessMode);
// Resolve index for the child property
Object* parent = GetParentObject();
/**
* @copydoc Dali::Handle::SetProperty()
*/
- void SetProperty( Property::Index index, const Property::Value& propertyValue );
+ void SetProperty(Property::Index index, Property::Value propertyValue);
/**
* @copydoc Dali::Handle::GetProperty()
/**
* @copydoc Dali::Handle::RegisterProperty()
*/
- Property::Index RegisterProperty( const std::string& name, const Property::Value& propertyValue );
+ Property::Index RegisterProperty(std::string name, Property::Value propertyValue);
/**
* @copydoc Dali::Handle::RegisterProperty()
*/
- Property::Index RegisterProperty( const std::string& name, Property::Index key, const Property::Value& propertyValue );
+ Property::Index RegisterProperty(std::string name, Property::Index key, Property::Value propertyValue);
/**
* @copydoc Dali::DevelHandle::SetProperties()
/**
* @copydoc Dali::Handle::RegisterProperty(std::string name, Property::Value propertyValue, Property::AccessMode accessMode)
*/
- Property::Index RegisterProperty( const std::string& name, const Property::Value& propertyValue, Property::AccessMode accessMode );
+ Property::Index RegisterProperty(std::string name, Property::Value propertyValue, Property::AccessMode accessMode);
/**
* @brief Implementing method for this override
*/
- Property::Index RegisterProperty( const std::string& name, Property::Index key, const Property::Value& propertyValue, Property::AccessMode accessMode );
+ Property::Index RegisterProperty(std::string name,
+ Property::Index key,
+ Property::Value propertyValue,
+ Property::AccessMode accessMode);
/**
* @brief returns true if the custom property exists on this object.
return propertyName;
}
-void TypeInfo::AddActionFunction( const std::string &actionName, Dali::TypeInfo::ActionFunction function )
+void TypeInfo::AddActionFunction(std::string actionName, Dali::TypeInfo::ActionFunction function)
{
if( nullptr == function)
{
if( iter == mActions.end() )
{
- mActions.push_back( ActionPair( actionName, function ) );
+ mActions.push_back(ActionPair(std::move(actionName), function));
}
else
{
}
}
-void TypeInfo::AddConnectorFunction( const std::string& signalName, Dali::TypeInfo::SignalConnectorFunction function )
+void TypeInfo::AddConnectorFunction(std::string signalName, Dali::TypeInfo::SignalConnectorFunction function)
{
if( nullptr == function)
{
if( iter == mSignalConnectors.end() )
{
- mSignalConnectors.push_back( ConnectionPair( signalName, function ) );
+ mSignalConnectors.push_back(ConnectionPair(std::move(signalName), function));
}
else
{
}
}
-void TypeInfo::AddProperty( const std::string& name, Property::Index index, Property::Type type, Dali::TypeInfo::SetPropertyFunction setFunc, Dali::TypeInfo::GetPropertyFunction getFunc )
+void TypeInfo::AddProperty(std::string name, Property::Index index, Property::Type type, Dali::TypeInfo::SetPropertyFunction setFunc, Dali::TypeInfo::GetPropertyFunction getFunc)
{
// The setter can be empty as a property can be read-only.
if ( iter == mRegisteredProperties.end() )
{
- mRegisteredProperties.push_back( RegisteredPropertyPair( index, RegisteredProperty( type, setFunc, getFunc, name, Property::INVALID_INDEX, Property::INVALID_COMPONENT_INDEX ) ) );
+ mRegisteredProperties.push_back(RegisteredPropertyPair(index, RegisteredProperty(type, setFunc, getFunc, std::move(name), Property::INVALID_INDEX, Property::INVALID_COMPONENT_INDEX)));
}
else
{
}
}
-void TypeInfo::AddProperty( const std::string& name, Property::Index index, Property::Type type, Dali::CSharpTypeInfo::SetPropertyFunction setFunc, Dali::CSharpTypeInfo::GetPropertyFunction getFunc)
+void TypeInfo::AddProperty(std::string name, Property::Index index, Property::Type type, Dali::CSharpTypeInfo::SetPropertyFunction setFunc, Dali::CSharpTypeInfo::GetPropertyFunction getFunc)
{
// The setter can be empty as a property can be read-only.
if ( iter == mRegisteredProperties.end() )
{
- mRegisteredProperties.push_back( RegisteredPropertyPair( index, RegisteredProperty( type, setFunc, getFunc, name, Property::INVALID_INDEX, Property::INVALID_COMPONENT_INDEX ) ) );
+ mRegisteredProperties.push_back(RegisteredPropertyPair(index, RegisteredProperty(type, setFunc, getFunc, std::move(name), Property::INVALID_INDEX, Property::INVALID_COMPONENT_INDEX)));
}
else
{
}
-
-void TypeInfo::AddAnimatableProperty( const std::string& name, Property::Index index, Property::Type type )
+void TypeInfo::AddAnimatableProperty(std::string name, Property::Index index, Property::Type type)
{
RegisteredPropertyContainer::iterator iter = find_if( mRegisteredProperties.begin(), mRegisteredProperties.end(),
PairFinder< Property::Index, RegisteredPropertyPair>(index) );
if ( iter == mRegisteredProperties.end() )
{
- mRegisteredProperties.push_back( RegisteredPropertyPair( index, RegisteredProperty( type, name, Property::INVALID_INDEX, Property::INVALID_COMPONENT_INDEX ) ) );
+ mRegisteredProperties.push_back(RegisteredPropertyPair(index, RegisteredProperty(type, std::move(name), Property::INVALID_INDEX, Property::INVALID_COMPONENT_INDEX)));
}
else
{
}
}
-void TypeInfo::AddAnimatableProperty( const std::string& name, Property::Index index, const Property::Value& defaultValue )
+void TypeInfo::AddAnimatableProperty(std::string name, Property::Index index, Property::Value defaultValue)
{
RegisteredPropertyContainer::iterator iter = find_if( mRegisteredProperties.begin(), mRegisteredProperties.end(),
PairFinder< Property::Index, RegisteredPropertyPair>(index) );
if ( iter == mRegisteredProperties.end() )
{
- mRegisteredProperties.push_back( RegisteredPropertyPair( index, RegisteredProperty( defaultValue.GetType(), name, Property::INVALID_INDEX, Property::INVALID_COMPONENT_INDEX ) ) );
- mPropertyDefaultValues.push_back( PropertyDefaultValuePair( index, defaultValue ) );
+ mRegisteredProperties.push_back(RegisteredPropertyPair(index, RegisteredProperty(defaultValue.GetType(), std::move(name), Property::INVALID_INDEX, Property::INVALID_COMPONENT_INDEX)));
+ mPropertyDefaultValues.push_back(PropertyDefaultValuePair(index, std::move(defaultValue)));
}
else
{
}
}
-void TypeInfo::AddAnimatablePropertyComponent( const std::string& name, Property::Index index, Property::Index baseIndex, uint32_t componentIndex )
+void TypeInfo::AddAnimatablePropertyComponent(std::string name, Property::Index index, Property::Index baseIndex, uint32_t componentIndex)
{
Property::Type type = GetPropertyType( baseIndex );
DALI_ASSERT_ALWAYS( ( type == Property::VECTOR2 || type == Property::VECTOR3 || type == Property::VECTOR4 ) && "Base property does not support component" );
if ( iter == mRegisteredProperties.end() )
{
- mRegisteredProperties.push_back( RegisteredPropertyPair( index, RegisteredProperty( type, name, baseIndex, componentIndex ) ) );
+ mRegisteredProperties.push_back(RegisteredPropertyPair(index, RegisteredProperty(type, std::move(name), baseIndex, componentIndex)));
success = true;
}
}
DALI_ASSERT_ALWAYS( success && "Property component already registered" );
}
-void TypeInfo::AddChildProperty( const std::string& name, Property::Index index, Property::Type type )
+void TypeInfo::AddChildProperty(std::string name, Property::Index index, Property::Type type)
{
RegisteredPropertyContainer::iterator iter = find_if( mRegisteredChildProperties.begin(), mRegisteredChildProperties.end(),
PairFinder< Property::Index, RegisteredPropertyPair>(index) );
if ( iter == mRegisteredChildProperties.end() )
{
- mRegisteredChildProperties.push_back( RegisteredPropertyPair( index, RegisteredProperty( type, name, Property::INVALID_INDEX, Property::INVALID_COMPONENT_INDEX ) ) );
+ mRegisteredChildProperties.push_back(RegisteredPropertyPair(index, RegisteredProperty(type, std::move(name), Property::INVALID_INDEX, Property::INVALID_COMPONENT_INDEX)));
}
else
{
return Property::Value(); // return none
}
-void TypeInfo::SetProperty( BaseObject *object, Property::Index index, const Property::Value& value ) const
+void TypeInfo::SetProperty(BaseObject* object, Property::Index index, Property::Value value) const
{
RegisteredPropertyContainer::const_iterator iter = find_if( mRegisteredProperties.begin(), mRegisteredProperties.end(),
PairFinder< Property::Index, RegisteredPropertyPair >( index ) );
}
else
{
- iter->second.setFunc( object, index, value );
+ iter->second.setFunc(object, index, std::move(value));
}
}
}
else if( GetBaseType( mBaseType, mTypeRegistry, mBaseTypeName ) )
{
// call base type recursively
- mBaseType->SetProperty( object, index, value );
+ mBaseType->SetProperty(object, index, std::move(value));
}
else
{
}
}
-void TypeInfo::SetProperty( BaseObject *object, const std::string& name, const Property::Value& value ) const
+void TypeInfo::SetProperty(BaseObject* object, const std::string& name, Property::Value value) const
{
RegisteredPropertyContainer::const_iterator iter = find_if( mRegisteredProperties.begin(), mRegisteredProperties.end(),
PropertyNameFinder< RegisteredPropertyPair >( name ) );
}
else
{
- iter->second.setFunc( object, iter->first, value );
+ iter->second.setFunc(object, iter->first, std::move(value));
}
}
else if( GetBaseType( mBaseType, mTypeRegistry, mBaseTypeName ) )
{
// call base type recursively
- mBaseType->SetProperty( object, name, value );
+ mBaseType->SetProperty(object, name, std::move(value));
}
else
{
/*
* Add an action function
*/
- void AddActionFunction( const std::string &actionName, Dali::TypeInfo::ActionFunction function );
+ void AddActionFunction(std::string actionName, Dali::TypeInfo::ActionFunction function);
/*
* Add a function for connecting a signal.
* @param[in] signalName The name of the signal.
* @param[in] function The function used for connecting to the signal.
*/
- void AddConnectorFunction( const std::string& signalName, Dali::TypeInfo::SignalConnectorFunction function );
+ void AddConnectorFunction(std::string signalName, Dali::TypeInfo::SignalConnectorFunction function);
/**
* Adds an event-thread only property to the type.
* @param[in] setFunc The function to call to set the property (Can be nullptr).
* @param[in] getFunc The function to call to retrieve the value of the property.
*/
- void AddProperty( const std::string& name, Property::Index index, Property::Type type, Dali::TypeInfo::SetPropertyFunction setFunc, Dali::TypeInfo::GetPropertyFunction getFunc );
+ void AddProperty(std::string name, Property::Index index, Property::Type type, Dali::TypeInfo::SetPropertyFunction setFunc, Dali::TypeInfo::GetPropertyFunction getFunc);
/**
* Adds an event-thread only property to the type.
* @param[in] setFunc The function to call to set the property (Can be nullptr).
* @param[in] getFunc The function to call to retrieve the value of the property.
*/
- void AddProperty( const std::string& name, Property::Index index, Property::Type type, Dali::CSharpTypeInfo::SetPropertyFunction setFunc, Dali::CSharpTypeInfo::GetPropertyFunction getFunc);
+ void AddProperty(std::string name, Property::Index index, Property::Type type, Dali::CSharpTypeInfo::SetPropertyFunction setFunc, Dali::CSharpTypeInfo::GetPropertyFunction getFunc);
/**
* Adds an animatable property to the type.
* @param[in] index The index of the property
* @param[in] type The Property::Type.
*/
- void AddAnimatableProperty( const std::string& name, Property::Index index, Property::Type type );
+ void AddAnimatableProperty(std::string name, Property::Index index, Property::Type type);
/**
* Adds an animatable property with the given default value.
* @param[in] index The index of the property
* @param[in] type The Property::Type.
*/
- void AddAnimatableProperty( const std::string& name, Property::Index index, const Property::Value& defaultValue );
+ void AddAnimatableProperty(std::string name, Property::Index index, Property::Value defaultValue);
/**
* Adds a component of an animatable property to the type.
* @param[in] baseIndex The index of the base animatable property
* @param[in] component The index The index of the component.
*/
- void AddAnimatablePropertyComponent( const std::string& name, Property::Index index, Property::Index baseIndex, uint32_t componentIndex );
+ void AddAnimatablePropertyComponent(std::string name, Property::Index index, Property::Index baseIndex, uint32_t componentIndex);
/**
* Adds a child property to the type.
* @param[in] index The index of the property
* @param[in] type The Property::Type.
*/
- void AddChildProperty( const std::string& name, Property::Index index, Property::Type type );
+ void AddChildProperty(std::string name, Property::Index index, Property::Type type);
/**
* Do an action on base object
* @param[in] index The property index.
* @param[in] value The value to set.
*/
- void SetProperty( BaseObject *object, Property::Index index, const Property::Value& value ) const;
+ void SetProperty(BaseObject* object, Property::Index index, Property::Value value) const;
/**
* Sets the value of a property with the name specified for the given object.
* @param[in] name The property name.
* @param[in] value The value to set.
*/
- void SetProperty( BaseObject *object, const std::string& name, const Property::Value& value ) const;
+ void SetProperty(BaseObject* object, const std::string& name, Property::Value value) const;
/**
* Retrieves the value of a property at the index specified for the given object.
struct RegisteredProperty
{
- RegisteredProperty( Property::Type propType, const std::string& propName, Property::Index basePropertyIndex, int32_t componentIndex )
- : type( propType ),
- setFunc( nullptr ),
- getFunc( nullptr ),
- name( propName ),
- basePropertyIndex(basePropertyIndex),
- componentIndex(componentIndex)
+ RegisteredProperty(Property::Type propType, std::string propName, Property::Index basePropertyIndex, int32_t componentIndex)
+ : type(propType),
+ setFunc(nullptr),
+ getFunc(nullptr),
+ name(std::move(propName)),
+ basePropertyIndex(basePropertyIndex),
+ componentIndex(componentIndex)
{
}
-
- RegisteredProperty( Property::Type propType, Dali::TypeInfo::SetPropertyFunction set, Dali::TypeInfo::GetPropertyFunction get, const std::string& propName, Property::Index basePropertyIndex, int componentIndex )
- : type( propType ),
- setFunc( set ),
- getFunc( get ),
- name( propName ),
+ RegisteredProperty(Property::Type propType, Dali::TypeInfo::SetPropertyFunction set, Dali::TypeInfo::GetPropertyFunction get, std::string propName, Property::Index basePropertyIndex, int componentIndex)
+ : type(propType),
+ setFunc(set),
+ getFunc(get),
+ name(std::move(propName)),
basePropertyIndex(basePropertyIndex),
componentIndex(componentIndex)
{
}
- RegisteredProperty( Property::Type propType, Dali::CSharpTypeInfo::SetPropertyFunction set, Dali::CSharpTypeInfo::GetPropertyFunction get, const std::string& propName, Property::Index basePropertyIndex, int componentIndex )
- : type( propType ),
- cSharpSetFunc( set ),
- cSharpGetFunc( get ),
- name( propName ),
+ RegisteredProperty(Property::Type propType, Dali::CSharpTypeInfo::SetPropertyFunction set, Dali::CSharpTypeInfo::GetPropertyFunction get, std::string propName, Property::Index basePropertyIndex, int componentIndex)
+ : type(propType),
+ cSharpSetFunc(set),
+ cSharpGetFunc(get),
+ name(std::move(propName)),
basePropertyIndex(basePropertyIndex),
componentIndex(componentIndex)
{
return static_cast<uint32_t>( mRegistryLut.size() );
}
-std::string TypeRegistry::GetTypeName( uint32_t index ) const
+const std::string& TypeRegistry::GetTypeName(uint32_t index) const
{
- std::string name;
+ static std::string EMPTY_STRING{};
if( index < mRegistryLut.size() )
{
- name = mRegistryLut[ index ]->GetName();
+ return mRegistryLut[index]->GetName();
}
- return name;
+ return EMPTY_STRING;
}
std::string TypeRegistry::Register( const std::type_info& theTypeInfo,
return Register( uniqueTypeName, baseTypeInfo, createInstance, callCreateOnInit, defaultProperties, defaultPropertyCount );
}
-std::string TypeRegistry::Register( const std::string& uniqueTypeName,
- const std::type_info& baseTypeInfo,
- Dali::TypeInfo::CreateFunction createInstance,
- bool callCreateOnInit,
- const Dali::PropertyDetails* defaultProperties,
- Property::Index defaultPropertyCount )
+std::string TypeRegistry::Register(std::string uniqueTypeName,
+ const std::type_info& baseTypeInfo,
+ Dali::TypeInfo::CreateFunction createInstance,
+ bool callCreateOnInit,
+ const Dali::PropertyDetails* defaultProperties,
+ Property::Index defaultPropertyCount)
{
std::string baseTypeName = DemangleClassName( baseTypeInfo.name() );
return uniqueTypeName;
}
-void TypeRegistry::Register( const std::string& uniqueTypeName, const std::type_info& baseTypeInfo,
- Dali::CSharpTypeInfo::CreateFunction createInstance )
+void TypeRegistry::Register(std::string uniqueTypeName, const std::type_info& baseTypeInfo, Dali::CSharpTypeInfo::CreateFunction createInstance)
{
std::string baseTypeName = DemangleClassName( baseTypeInfo.name() );
return DemangleClassName( registerType.name() );
}
-void TypeRegistry::RegisterSignal( TypeRegistration& typeRegistration, const std::string& name, Dali::TypeInfo::SignalConnectorFunction func )
+void TypeRegistry::RegisterSignal(TypeRegistration& typeRegistration, std::string name, Dali::TypeInfo::SignalConnectorFunction func)
{
for( auto&& iter : mRegistryLut )
{
if( iter->GetName() == typeRegistration.RegisteredName() )
{
- iter->AddConnectorFunction( name, func );
+ iter->AddConnectorFunction(std::move(name), func);
break;
}
}
}
-bool TypeRegistry::RegisterAction( TypeRegistration& typeRegistration, const std::string &name, Dali::TypeInfo::ActionFunction f )
+bool TypeRegistry::RegisterAction(TypeRegistration& typeRegistration, std::string name, Dali::TypeInfo::ActionFunction f)
{
for( auto&& iter : mRegistryLut )
{
if( iter->GetName() == typeRegistration.RegisteredName() )
{
- iter->AddActionFunction( name, f );
+ iter->AddActionFunction(std::move(name), f);
return true;
}
}
return false;
}
-bool TypeRegistry::RegisterProperty( TypeRegistration& typeRegistration, const std::string& name, Property::Index index, Property::Type type, Dali::TypeInfo::SetPropertyFunction setFunc, Dali::TypeInfo::GetPropertyFunction getFunc )
+bool TypeRegistry::RegisterProperty(TypeRegistration& typeRegistration, std::string name, Property::Index index, Property::Type type, Dali::TypeInfo::SetPropertyFunction setFunc, Dali::TypeInfo::GetPropertyFunction getFunc)
{
for( auto&& iter : mRegistryLut )
{
if( iter->GetName() == typeRegistration.RegisteredName() )
{
- iter->AddProperty( name, index, type, setFunc, getFunc );
+ iter->AddProperty(std::move(name), index, type, setFunc, getFunc);
return true;
}
}
return false;
}
-bool TypeRegistry::RegisterProperty( const std::string& objectName, const std::string& name, Property::Index index, Property::Type type, Dali::CSharpTypeInfo::SetPropertyFunction setFunc, Dali::CSharpTypeInfo::GetPropertyFunction getFunc )
+bool TypeRegistry::RegisterProperty(const std::string& objectName, std::string name, Property::Index index, Property::Type type, Dali::CSharpTypeInfo::SetPropertyFunction setFunc, Dali::CSharpTypeInfo::GetPropertyFunction getFunc)
{
for( auto&& iter : mRegistryLut )
{
if( iter->GetName() == objectName )
{
- iter->AddProperty( name, index, type, setFunc, getFunc );
+ iter->AddProperty(std::move(name), index, type, setFunc, getFunc);
return true;
}
}
return false;
}
-
-bool TypeRegistry::RegisterAnimatableProperty( TypeRegistration& typeRegistration, const std::string& name, Property::Index index, Property::Type type )
+bool TypeRegistry::RegisterAnimatableProperty(TypeRegistration& typeRegistration, std::string name, Property::Index index, Property::Type type)
{
for( auto&& iter : mRegistryLut )
{
if( iter->GetName() == typeRegistration.RegisteredName() )
{
- iter->AddAnimatableProperty( name, index, type );
+ iter->AddAnimatableProperty(std::move(name), index, type);
return true;
}
}
return false;
}
-bool TypeRegistry::RegisterAnimatableProperty( TypeRegistration& typeRegistration, const std::string& name, Property::Index index, const Property::Value& value )
+bool TypeRegistry::RegisterAnimatableProperty(TypeRegistration& typeRegistration, std::string name, Property::Index index, Property::Value value)
{
for( auto&& iter : mRegistryLut )
{
if( iter->GetName() == typeRegistration.RegisteredName() )
{
- iter->AddAnimatableProperty( name, index, value );
+ iter->AddAnimatableProperty(std::move(name), index, std::move(value));
return true;
}
}
return false;
}
-bool TypeRegistry::RegisterAnimatablePropertyComponent( TypeRegistration& typeRegistration, const std::string& name, Property::Index index, Property::Index baseIndex, unsigned int componentIndex )
+bool TypeRegistry::RegisterAnimatablePropertyComponent(TypeRegistration& typeRegistration, std::string name, Property::Index index, Property::Index baseIndex, unsigned int componentIndex)
{
for( auto&& iter : mRegistryLut )
{
if( iter->GetName() == typeRegistration.RegisteredName() )
{
- iter->AddAnimatablePropertyComponent( name, index, baseIndex, componentIndex );
+ iter->AddAnimatablePropertyComponent(std::move(name), index, baseIndex, componentIndex);
return true;
}
}
return false;
}
-bool TypeRegistry::RegisterChildProperty( const std::string& registeredType, const std::string& name, Property::Index index, Property::Type type )
+bool TypeRegistry::RegisterChildProperty(const std::string& registeredType, std::string name, Property::Index index, Property::Type type)
{
for( auto&& iter : mRegistryLut )
{
if( iter->GetName() == registeredType )
{
- iter->AddChildProperty( name, index, type );
+ iter->AddChildProperty(std::move(name), index, type);
return true;
}
}
return false;
}
-bool TypeRegistry::RegisterChildProperty( TypeRegistration& typeRegistration, const std::string& name, Property::Index index, Property::Type type )
+bool TypeRegistry::RegisterChildProperty(TypeRegistration& typeRegistration, std::string name, Property::Index index, Property::Type type)
{
- return RegisterChildProperty( typeRegistration.RegisteredName(), name, index, type );
+ return RegisterChildProperty(typeRegistration.RegisteredName(), std::move(name), index, type);
}
bool TypeRegistry::DoActionTo( BaseObject * const object, const std::string& actionName, const Property::Map& properties )
/**
* @copydoc Dali::TypeRegistry::GetTypeName
*/
- std::string GetTypeName( uint32_t index ) const;
+ const std::string& GetTypeName(uint32_t index) const;
/**
* Register a type
* @param [in] defaultPropertyCount count of default properties
* @return the name of the registered type.
*/
- std::string Register( const std::string& name, const std::type_info& baseTypeInfo,
- Dali::TypeInfo::CreateFunction createInstance, bool callCreateOnInit,
- const Dali::PropertyDetails* defaultProperties = nullptr, Property::Index defaultPropertyCount = 0 );
+ std::string Register(std::string name, const std::type_info& baseTypeInfo, Dali::TypeInfo::CreateFunction createInstance, bool callCreateOnInit, const Dali::PropertyDetails* defaultProperties = nullptr, Property::Index defaultPropertyCount = 0);
/**
* @copydoc CSharpTypeRegistry::TypeRegistration( const std::string&, const std::type_info&, TypeInfo::CreateFunction );
*/
- void Register( const std::string& name, const std::type_info& baseTypeInfo,
- Dali::CSharpTypeInfo::CreateFunction createInstance );
+ void Register(std::string name, const std::type_info& baseTypeInfo, Dali::CSharpTypeInfo::CreateFunction createInstance);
/**
* Register a signal connector function to a type
* @param [in] name Signal name
* @param [in] func Signal connector function
*/
- void RegisterSignal( TypeRegistration& typeRegistration, const std::string& name, Dali::TypeInfo::SignalConnectorFunction func );
+ void RegisterSignal(TypeRegistration& typeRegistration, std::string name, Dali::TypeInfo::SignalConnectorFunction func);
/**
* Register an action function to a type
* @param [in] f Action function
* @return true if registered
*/
- bool RegisterAction( TypeRegistration& registered, const std::string& name, Dali::TypeInfo::ActionFunction f );
+ bool RegisterAction(TypeRegistration& registered, std::string name, Dali::TypeInfo::ActionFunction f);
/**
* Register an event-thread only property with a type
* @param [in] getFunc The function to get the value of a property.
* @return true if registered
*/
- bool RegisterProperty( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type, Dali::TypeInfo::SetPropertyFunction setFunc, Dali::TypeInfo::GetPropertyFunction getFunc );
+ bool RegisterProperty(TypeRegistration& registered, std::string name, Property::Index index, Property::Type type, Dali::TypeInfo::SetPropertyFunction setFunc, Dali::TypeInfo::GetPropertyFunction getFunc);
/**
* Register an event-thread only property with a type (used by C# Custom controls)
* @param [in] getFunc The function to get the value of a property.
* @return true if registered
*/
- bool RegisterProperty( const std::string& objectName, const std::string& name, Property::Index index, Property::Type type, Dali::CSharpTypeInfo::SetPropertyFunction setFunc, Dali::CSharpTypeInfo::GetPropertyFunction getFunc );
-
+ bool RegisterProperty(const std::string& objectName, std::string name, Property::Index index, Property::Type type, Dali::CSharpTypeInfo::SetPropertyFunction setFunc, Dali::CSharpTypeInfo::GetPropertyFunction getFunc);
/**
* Register a scene graph only property with a type
* @param [in] type Property type
* @return true if registered
*/
- bool RegisterAnimatableProperty( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type );
+ bool RegisterAnimatableProperty(TypeRegistration& registered, std::string name, Property::Index index, Property::Type type);
/**
* Register a scene graph only property with a default value
* @param [in] value Property default value
* @return true if registered
*/
- bool RegisterAnimatableProperty( TypeRegistration& registered, const std::string& name, Property::Index index, const Property::Value& defaultValue );
+ bool RegisterAnimatableProperty(TypeRegistration& registered, std::string name, Property::Index index, Property::Value defaultValue);
/**
* Register a component of a scene graph only property that supports components (i.e. Vector2, Vector3 and Vector4)
* @param [in] componentIndex Component index
* @return true if registered
*/
- bool RegisterAnimatablePropertyComponent( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Index baseIndex, unsigned int componentIndex );
+ bool RegisterAnimatablePropertyComponent(TypeRegistration& registered, std::string name, Property::Index index, Property::Index baseIndex, unsigned int componentIndex);
/**
* Register a event-thread only property with a type and a default value
* @param [in] type Property type
* @return true if registered
*/
- bool RegisterChildProperty( const std::string& registeredType, const std::string& name, Property::Index index, Property::Type type );
+ bool RegisterChildProperty(const std::string& registeredType, std::string name, Property::Index index, Property::Type type);
/**
* Register a event-thread only property with a type and a default value
* @param [in] type Property type
* @return true if registered
*/
- bool RegisterChildProperty( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type );
+ bool RegisterChildProperty(TypeRegistration& registered, std::string name, Property::Index index, Property::Type type);
/**
* @copydoc Dali::Internal::TypeInfo::DoActionTo
return GetImplementation(*this).GetPropertyType(index);
}
-void Handle::SetProperty(Property::Index index, const Property::Value& propertyValue)
+void Handle::SetProperty(Property::Index index, Property::Value propertyValue)
{
- GetImplementation(*this).SetProperty(index, propertyValue);
+ GetImplementation(*this).SetProperty(index, std::move(propertyValue));
}
-Property::Index Handle::RegisterProperty(const std::string& name, const Property::Value& propertyValue)
+Property::Index Handle::RegisterProperty(std::string name, Property::Value propertyValue)
{
- return GetImplementation(*this).RegisterProperty(name, propertyValue);
+ return GetImplementation(*this).RegisterProperty(std::move(name), std::move(propertyValue));
}
-Property::Index Handle::RegisterProperty(Property::Index key, const std::string& name, const Property::Value& propertyValue)
+Property::Index Handle::RegisterProperty(Property::Index key, std::string name, Property::Value propertyValue)
{
- return GetImplementation(*this).RegisterProperty(name, key, propertyValue);
+ return GetImplementation(*this).RegisterProperty(std::move(name), key, std::move(propertyValue));
}
-Property::Index Handle::RegisterProperty(const std::string& name, const Property::Value& propertyValue, Property::AccessMode accessMode)
+Property::Index Handle::RegisterProperty(std::string name, Property::Value propertyValue, Property::AccessMode accessMode)
{
- return GetImplementation(*this).RegisterProperty(name, propertyValue, accessMode);
+ return GetImplementation(*this).RegisterProperty(std::move(name), std::move(propertyValue), accessMode);
}
Property::Value Handle::GetProperty(Property::Index index) const
* @param[in] propertyValue The new value of the property
* @pre The property types match i.e. propertyValue.GetType() is equal to GetPropertyType(index).
*/
- void SetProperty(Property::Index index, const Property::Value& propertyValue);
+ void SetProperty(Property::Index index, Property::Value propertyValue);
/**
* @brief Registers a new animatable property.
* - Property::ROTATION
* @note If a property with the desired name already exists, then the value given is just set.
*/
- Property::Index RegisterProperty(const std::string& name, const Property::Value& propertyValue);
+ Property::Index RegisterProperty(std::string name, Property::Value propertyValue);
/**
* @brief Register a new animatable property with an integer key.
* - Property::ROTATION
* @note If a property with the desired name already exists, then the value given is just set.
*/
- Property::Index RegisterProperty(Property::Index key,
- const std::string& name,
- const Property::Value& propertyValue);
+ Property::Index RegisterProperty(Property::Index key,
+ std::string name,
+ Property::Value propertyValue);
/**
* @brief Registers a new property.
* - Property::ROTATION
* @note If a property with the desired name already exists, then the value given is just set.
*/
- Property::Index RegisterProperty(const std::string& name, const Property::Value& propertyValue, Property::AccessMode accessMode);
+ Property::Index RegisterProperty(std::string name, Property::Value propertyValue, Property::AccessMode accessMode);
/**
* @brief Retrieves a property value.
mName = impl->Register(registerType, baseType, f, false, defaultProperties.propertyTable, defaultProperties.propertyCount);
}
-TypeRegistration::TypeRegistration(const std::string& name, const std::type_info& baseType, TypeInfo::CreateFunction f)
+TypeRegistration::TypeRegistration(std::string name, const std::type_info& baseType, TypeInfo::CreateFunction f)
: mReference(Internal::TypeRegistry::Get())
{
Internal::TypeRegistry* impl = Internal::TypeRegistry::Get();
- mName = impl->Register(name, baseType, f, false);
+ mName = impl->Register(std::move(name), baseType, f, false);
}
-const std::string TypeRegistration::RegisteredName() const
+const std::string& TypeRegistration::RegisteredName() const
{
return mName;
}
-SignalConnectorType::SignalConnectorType(TypeRegistration& typeRegistration, const std::string& name, TypeInfo::SignalConnectorFunction func)
+SignalConnectorType::SignalConnectorType(TypeRegistration& typeRegistration, std::string name, TypeInfo::SignalConnectorFunction func)
{
- Internal::TypeRegistry::Get()->RegisterSignal(typeRegistration, name, func);
+ Internal::TypeRegistry::Get()->RegisterSignal(typeRegistration, std::move(name), func);
}
-TypeAction::TypeAction(TypeRegistration& registered, const std::string& name, TypeInfo::ActionFunction f)
+TypeAction::TypeAction(TypeRegistration& registered, std::string name, TypeInfo::ActionFunction f)
{
- Internal::TypeRegistry::Get()->RegisterAction(registered, name, f);
+ Internal::TypeRegistry::Get()->RegisterAction(registered, std::move(name), f);
}
-PropertyRegistration::PropertyRegistration(TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type, TypeInfo::SetPropertyFunction setFunc, TypeInfo::GetPropertyFunction getFunc)
+PropertyRegistration::PropertyRegistration(TypeRegistration& registered, std::string name, Property::Index index, Property::Type type, TypeInfo::SetPropertyFunction setFunc, TypeInfo::GetPropertyFunction getFunc)
{
DALI_ASSERT_ALWAYS((index >= PROPERTY_REGISTRATION_START_INDEX) && (index <= PROPERTY_REGISTRATION_MAX_INDEX));
- Internal::TypeRegistry::Get()->RegisterProperty(registered, name, index, type, setFunc, getFunc);
+ Internal::TypeRegistry::Get()->RegisterProperty(registered, std::move(name), index, type, setFunc, getFunc);
}
-AnimatablePropertyRegistration::AnimatablePropertyRegistration(TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type)
+AnimatablePropertyRegistration::AnimatablePropertyRegistration(TypeRegistration& registered, std::string name, Property::Index index, Property::Type type)
{
DALI_ASSERT_ALWAYS((index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX));
- Internal::TypeRegistry::Get()->RegisterAnimatableProperty(registered, name, index, type);
+ Internal::TypeRegistry::Get()->RegisterAnimatableProperty(registered, std::move(name), index, type);
}
-AnimatablePropertyRegistration::AnimatablePropertyRegistration(TypeRegistration& registered, const std::string& name, Property::Index index, const Property::Value& value)
+AnimatablePropertyRegistration::AnimatablePropertyRegistration(TypeRegistration& registered, std::string name, Property::Index index, const Property::Value& value)
{
DALI_ASSERT_ALWAYS((index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX));
- Internal::TypeRegistry::Get()->RegisterAnimatableProperty(registered, name, index, value);
+ Internal::TypeRegistry::Get()->RegisterAnimatableProperty(registered, std::move(name), index, value);
}
-AnimatablePropertyComponentRegistration::AnimatablePropertyComponentRegistration(TypeRegistration& registered, const std::string& name, Property::Index index, Property::Index baseIndex, uint32_t componentIndex)
+AnimatablePropertyComponentRegistration::AnimatablePropertyComponentRegistration(TypeRegistration& registered, std::string name, Property::Index index, Property::Index baseIndex, uint32_t componentIndex)
{
DALI_ASSERT_ALWAYS((index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX));
- Internal::TypeRegistry::Get()->RegisterAnimatablePropertyComponent(registered, name, index, baseIndex, componentIndex);
+ Internal::TypeRegistry::Get()->RegisterAnimatablePropertyComponent(registered, std::move(name), index, baseIndex, componentIndex);
}
-ChildPropertyRegistration::ChildPropertyRegistration(TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type)
+ChildPropertyRegistration::ChildPropertyRegistration(TypeRegistration& registered, std::string name, Property::Index index, Property::Type type)
{
DALI_ASSERT_ALWAYS((index >= CHILD_PROPERTY_REGISTRATION_START_INDEX) && (index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX));
- Internal::TypeRegistry::Get()->RegisterChildProperty(registered, name, index, type);
+ Internal::TypeRegistry::Get()->RegisterChildProperty(registered, std::move(name), index, type);
}
-ChildPropertyRegistration::ChildPropertyRegistration(const std::string& registered, const std::string& name, Property::Index index, Property::Type type)
+ChildPropertyRegistration::ChildPropertyRegistration(std::string registered, std::string name, Property::Index index, Property::Type type)
{
DALI_ASSERT_ALWAYS((index >= CHILD_PROPERTY_REGISTRATION_START_INDEX) && (index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX));
- Internal::TypeRegistry::Get()->RegisterChildProperty(registered, name, index, type);
+ Internal::TypeRegistry::Get()->RegisterChildProperty(std::move(registered), std::move(name), index, type);
}
} // namespace Dali
* @param[in] baseType the base type info of registerType
* @param[in] f registerType instance creation function
*/
- TypeRegistration(const std::string& name, const std::type_info& baseType, TypeInfo::CreateFunction f);
+ TypeRegistration(std::string name, const std::type_info& baseType, TypeInfo::CreateFunction f);
/**
* @brief The name the type is registered under (derived from type_info).
* @SINCE_1_0.0
* @return The registered name or empty if unregistered
*/
- const std::string RegisteredName() const;
+ const std::string& RegisteredName() const;
private:
TypeRegistry mReference; ///< Reference to the type registry
* @param[in] name The signal name
* @param[in] func The signal connector function
*/
- SignalConnectorType(TypeRegistration& typeRegistration, const std::string& name, TypeInfo::SignalConnectorFunction func);
+ SignalConnectorType(TypeRegistration& typeRegistration, std::string name, TypeInfo::SignalConnectorFunction func);
};
/**
* @param[in] name The action name
* @param[in] f The action function
*/
- TypeAction(TypeRegistration& registered, const std::string& name, TypeInfo::ActionFunction f);
+ TypeAction(TypeRegistration& registered, std::string name, TypeInfo::ActionFunction f);
};
/**
*
*/
PropertyRegistration(TypeRegistration& registered,
- const std::string& name,
+ std::string name,
Property::Index index,
Property::Type type,
TypeInfo::SetPropertyFunction setFunc,
* @param[in] type The property value type
* @pre "registered" must be registered with the TypeRegistry.
*/
- AnimatablePropertyRegistration(TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type);
+ AnimatablePropertyRegistration(TypeRegistration& registered, std::string name, Property::Index index, Property::Type type);
/**
* @brief This constructor registers the animatable property with the registered default value.
* @param[in] value The property default value
* @pre "registered" must be registered with the TypeRegistry.
*/
- AnimatablePropertyRegistration(TypeRegistration& registered, const std::string& name, Property::Index index, const Property::Value& value);
+ AnimatablePropertyRegistration(TypeRegistration& registered, std::string name, Property::Index index, const Property::Value& value);
};
/**
* @param[in] componentIndex The index of the component (e.g. 0 for the x component of a Vector2 property and 1 for the y component of a Vector2 property)
* @pre "registered" must be registered with the TypeRegistry.
*/
- AnimatablePropertyComponentRegistration(TypeRegistration& registered, const std::string& name, Property::Index index, Property::Index baseIndex, uint32_t componentIndex);
+ AnimatablePropertyComponentRegistration(TypeRegistration& registered, std::string name, Property::Index index, Property::Index baseIndex, uint32_t componentIndex);
};
/**
* @param[in] type The property value type
* @pre "registered" must be registered with the TypeRegistry.
*/
- ChildPropertyRegistration(TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type);
+ ChildPropertyRegistration(TypeRegistration& registered, std::string name, Property::Index index, Property::Type type);
/**
* @brief This constructor registers an event-thread only child property (i.e. a property
* @param[in] type The property value type
* @pre "registered" must be registered with the TypeRegistry.
*/
- ChildPropertyRegistration(const std::string& registered, const std::string& name, Property::Index index, Property::Type type);
+ ChildPropertyRegistration(std::string registered, std::string name, Property::Index index, Property::Type type);
};
/**