X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Fcommon%2Ftype-registry-impl.h;h=8437ba07762c3bd96c925f72eb3798df4739f7ea;hb=33a8477946185463936981476e9772d40c37fd72;hp=8f72dd0c1ff86cc83668cbbfc90e73d93d30b4da;hpb=3fc7efff68de13a8d1d423422ac408b77a28f232;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/common/type-registry-impl.h b/dali/internal/event/common/type-registry-impl.h index 8f72dd0..8437ba0 100644 --- a/dali/internal/event/common/type-registry-impl.h +++ b/dali/internal/event/common/type-registry-impl.h @@ -1,8 +1,8 @@ -#ifndef __DALI_INTERNAL_TYPE_REGISTRY_H__ -#define __DALI_INTERNAL_TYPE_REGISTRY_H__ +#ifndef DALI_INTERNAL_TYPE_REGISTRY_H +#define DALI_INTERNAL_TYPE_REGISTRY_H /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -20,18 +20,17 @@ // INTERNAL INCLUDES #include -#include -#include -#include +#include #include #include +#include +#include +#include namespace Dali { - namespace Internal { - class PropertyDetails; /* @@ -40,34 +39,33 @@ class PropertyDetails; class TypeRegistry : public Dali::BaseObject { public: - // using intrusive pointer instead of handles internally as they are considerably cheaper using TypeInfoPointer = IntrusivePtr; /** * Get the TypeRegistry */ - static TypeRegistry *Get(); + static TypeRegistry* Get(); /** * @copydoc Dali::TypeRegistry::GetTypeInfo */ - TypeInfoPointer GetTypeInfo( const std::string &uniqueTypeName ); + TypeInfoPointer GetTypeInfo(const std::string& uniqueTypeName); /** * @copydoc Dali::TypeRegistry::GetTypeInfo */ - TypeInfoPointer GetTypeInfo( const std::type_info& registerType ); + TypeInfoPointer GetTypeInfo(const std::type_info& registerType); /** * @copydoc Dali::TypeRegistry::GetTypeNameCount */ - size_t GetTypeNameCount() const; + uint32_t GetTypeNameCount() const; /** * @copydoc Dali::TypeRegistry::GetTypeName */ - std::string GetTypeName(size_t index) const; + const std::string& GetTypeName(uint32_t index) const; /** * Register a type @@ -78,8 +76,7 @@ public: * @param [in] callCreateOnInit If true call createInstance on DALi initialisation * @return the name of the registered type. */ - std::string Register( const std::type_info& theTypeInfo, const std::type_info& baseTypeInfo, - Dali::TypeInfo::CreateFunction createInstance, bool callCreateOnInit ); + std::string Register(const std::type_info& theTypeInfo, const std::type_info& baseTypeInfo, Dali::TypeInfo::CreateFunction createInstance, bool callCreateOnInit); /** * Register a type @@ -92,9 +89,7 @@ public: * @param [in] defaultPropertyCount count of default properties * @return the name of the registered type. */ - std::string Register( const std::type_info& theTypeInfo, const std::type_info& baseTypeInfo, - Dali::TypeInfo::CreateFunction createInstance, bool callCreateOnInit, - const Dali::PropertyDetails* defaultProperties, Property::Index defaultPropertyCount ); + std::string Register(const std::type_info& theTypeInfo, const std::type_info& baseTypeInfo, Dali::TypeInfo::CreateFunction createInstance, bool callCreateOnInit, const Dali::PropertyDetails* defaultProperties, Property::Index defaultPropertyCount); /** * Register a type @@ -107,15 +102,12 @@ public: * @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 @@ -123,7 +115,7 @@ public: * @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 @@ -132,7 +124,7 @@ public: * @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 @@ -144,7 +136,7 @@ public: * @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) @@ -156,8 +148,7 @@ public: * @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 @@ -167,7 +158,7 @@ public: * @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 @@ -177,7 +168,7 @@ public: * @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) @@ -188,7 +179,7 @@ public: * @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 @@ -198,7 +189,7 @@ public: * @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 @@ -208,25 +199,25 @@ public: * @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 * Walks all base types until it finds a doer. */ - bool DoActionTo( BaseObject * const object, const std::string &actionName, const Property::Map& properties); + bool DoActionTo(BaseObject* const object, const std::string& actionName, const Property::Map& properties); /** * @copydoc Dali::BaseHandle::ConnectSignal() */ - bool ConnectSignal( BaseObject* object, ConnectionTrackerInterface* connectionTracker, const std::string& signalName, FunctorDelegate* functor ); + bool ConnectSignal(BaseObject* object, ConnectionTrackerInterface* connectionTracker, const std::string& signalName, FunctorDelegate* functor); /** * Return the type info for a given BaseObject pointer * @param [in] pBaseObject Pointer to a BaseObject * @return TypeInfo for the BaseObject. */ - TypeInfoPointer GetTypeInfo(const Dali::BaseObject * const pBaseObject); + TypeInfoPointer GetTypeInfo(const Dali::BaseObject* const pBaseObject); /** * Calls any type creation functions that have been flagged as initialization functions @@ -234,38 +225,36 @@ public: void CallInitFunctions(void) const; public: - /* * Return the name derived from type_info used to register the type * @param [in] registerType Type info for the type to be registered * @return registered name */ - static std::string RegistrationName( const std::type_info& registerType ); + static std::string RegistrationName(const std::type_info& registerType); private: /* * Mapping from type name to TypeInfo */ - std::vector< TypeInfoPointer > mRegistryLut; + Dali::Internal::IndexedConstStringMap mRegistryLut; - std::vector< Dali::TypeInfo::CreateFunction > mInitFunctions; + std::vector mInitFunctions; private: TypeRegistry(); - ~TypeRegistry(); + ~TypeRegistry() override; /** * @brief Undefined Copy Constructor */ - TypeRegistry(TypeRegistry &); + TypeRegistry(TypeRegistry&); /** * @brief Undefined Assignment Operator */ - TypeRegistry& operator=(const TypeRegistry &); + TypeRegistry& operator=(const TypeRegistry&); }; - } // namespace Internal // Helpers for public-api forwarding methods @@ -290,4 +279,4 @@ inline const Internal::TypeRegistry& GetImplementation(const Dali::TypeRegistry& } // namespace Dali -#endif // __DALI_INTERNAL_TYPE_REGISTRY_H__ +#endif // DALI_INTERNAL_TYPE_REGISTRY_H