Ensure BaseHandle class move noexcept (core public-api)
[platform/core/uifw/dali-core.git] / dali / public-api / object / type-registry.h
index 2842213..7eddbe2 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_TYPE_REGISTRY_H__
-#define __DALI_TYPE_REGISTRY_H__
+#ifndef DALI_TYPE_REGISTRY_H
+#define DALI_TYPE_REGISTRY_H
 
 /*
- * Copyright (c) 2016 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.
@@ -18,8 +18,8 @@
  *
  */
 
-
 // EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
 #include <typeinfo>
 
 // INTERNAL INCLUDES
@@ -37,6 +37,7 @@ namespace Internal DALI_INTERNAL
 {
 class TypeRegistry;
 }
+struct DefaultPropertyMetadata;
 
 /**
  * @brief The TypeRegistry allows registration of type instance creation functions.
@@ -93,11 +94,11 @@ class TypeRegistry;
  *
  * @SINCE_1_0.0
  */
-class DALI_IMPORT_API TypeRegistry : public BaseHandle
+class DALI_CORE_API TypeRegistry : public BaseHandle
 {
 public:
   /**
-   * @brief Get Type Registry handle.
+   * @brief Gets Type Registry handle.
    *
    * @SINCE_1_0.0
    * @return TypeRegistry handle
@@ -111,7 +112,7 @@ public:
   TypeRegistry();
 
   /**
-   * @brief destructor.
+   * @brief Destructor.
    * @SINCE_1_0.0
    */
   ~TypeRegistry();
@@ -120,7 +121,7 @@ public:
    * @brief This copy constructor is required for (smart) pointer semantics.
    *
    * @SINCE_1_0.0
-   * @param [in] handle A reference to the copied handle
+   * @param[in] handle A reference to the copied handle
    */
   TypeRegistry(const TypeRegistry& handle);
 
@@ -128,31 +129,48 @@ public:
    * @brief This assignment operator is required for (smart) pointer semantics.
    *
    * @SINCE_1_0.0
-   * @param [in] rhs  A reference to the copied handle
+   * @param[in] rhs A reference to the copied handle
    * @return A reference to this
    */
   TypeRegistry& operator=(const TypeRegistry& rhs);
 
   /**
-   * @brief Get TypeInfo for a registered type.
+   * @brief Move constructor.
+   *
+   * @SINCE_1_9.22
+   * @param[in] rhs A reference to the moved handle
+   */
+  TypeRegistry(TypeRegistry&& rhs) noexcept;
+
+  /**
+   * @brief Move assignment operator.
+   *
+   * @SINCE_1_9.22
+   * @param[in] rhs A reference to the moved handle
+   * @return A reference to this handle
+   */
+  TypeRegistry& operator=(TypeRegistry&& rhs) noexcept;
+
+  /**
+   * @brief Gets TypeInfo for a registered type.
    *
    * @SINCE_1_0.0
-   * @param [in] uniqueTypeName A unique type name
-   * @return TypeInfo if the type exists otherwise an empty handle
+   * @param[in] uniqueTypeName A unique type name
+   * @return TypeInfo if the type exists, otherwise an empty handle
    */
-  TypeInfo GetTypeInfo( const std::string &uniqueTypeName );
+  TypeInfo GetTypeInfo(const std::string& uniqueTypeName);
 
   /**
-   * @brief Get TypeInfo for a registered type.
+   * @brief Gets TypeInfo for a registered type.
    *
    * @SINCE_1_0.0
-   * @param [in] registerType The registered type info
-   * @return TypeInfo if the type exists otherwise an empty handle
+   * @param[in] registerType The registered type info
+   * @return TypeInfo if the type exists, otherwise an empty handle
    */
-  TypeInfo GetTypeInfo( const std::type_info& registerType );
+  TypeInfo GetTypeInfo(const std::type_info& registerType);
 
   /**
-   * @brief Get type name count.
+   * @brief Gets type name count.
    *
    * @SINCE_1_0.0
    * @return The count
@@ -160,53 +178,64 @@ public:
   size_t GetTypeNameCount() const;
 
   /**
-   * @brief Get type names by index.
+   * @brief Gets type names by index.
    *
    * @SINCE_1_0.0
+   * @param[in] index The index to get the type name
    * @return The type name or an empty string when index is not valid
    */
   std::string GetTypeName(size_t index) const;
 
 public: // Not intended for application developers
-
+  /// @cond internal
   /**
    * @brief This constructor is used by Dali Get() method.
    *
    * @SINCE_1_0.0
-   * @param [in] typeRegistry A pointer to a Dali resource
+   * @param[in] typeRegistry A pointer to a Dali resource
    */
-  explicit DALI_INTERNAL TypeRegistry(Internal::TypeRegistry*typeRegistry);
+  explicit DALI_INTERNAL TypeRegistry(Internal::TypeRegistry* typeRegistry);
+  /// @endcond
 };
 
 /**
- * @brief Register a type from type info.
+ * @brief Registers a type from type info.
  * @SINCE_1_0.0
  */
-class DALI_IMPORT_API TypeRegistration
+class DALI_CORE_API TypeRegistration
 {
 public:
   /**
    * @brief Constructor registers the type creation function.
    *
    * @SINCE_1_0.0
-   * @param [in] registerType the type info for the type to be registered
-   * @param [in] baseType the base type info of registerType
-   * @param [in] f registerType instance creation function
+   * @param[in] registerType The type info for the type to be registered
+   * @param[in] baseType The base type info of registerType
+   * @param[in] f registerType Instance creation function
    */
-  TypeRegistration( const std::type_info& registerType, const std::type_info& baseType,
-                    TypeInfo::CreateFunction f );
+  TypeRegistration(const std::type_info& registerType, const std::type_info& baseType, TypeInfo::CreateFunction f);
 
   /**
    * @brief Constructor registers the type creation function.
    *
    * @SINCE_1_0.0
-   * @param [in] registerType the type info for the type to be registered
-   * @param [in] baseType the base type info of registerType
-   * @param [in] f registerType instance creation function
-   * @param [in] callCreateOnInit If true the creation function is called as part of Dali initialisation
+   * @param[in] registerType the type info for the type to be registered
+   * @param[in] baseType the base type info of registerType
+   * @param[in] f registerType instance creation function
+   * @param[in] callCreateOnInit If true the creation function is called as part of Dali initialization
+   */
+  TypeRegistration(const std::type_info& registerType, const std::type_info& baseType, TypeInfo::CreateFunction f, bool callCreateOnInit);
+
+  /**
+   * @brief Constructor registers the type creation function.
+   *
+   * @SINCE_1_4.0
+   * @param[in] registerType the type info for the type to be registered
+   * @param[in] baseType the base type info of registerType
+   * @param[in] f registerType instance creation function
+   * @param[in] defaultProperties the default property meta-data
    */
-  TypeRegistration( const std::type_info& registerType, const std::type_info& baseType,
-                    TypeInfo::CreateFunction f, bool callCreateOnInit );
+  TypeRegistration(const std::type_info& registerType, const std::type_info& baseType, TypeInfo::CreateFunction f, const DefaultPropertyMetadata& defaultProperties);
 
   /**
    * @brief Constructor registers the type creation function for a named class or type.
@@ -214,70 +243,68 @@ public:
    * This allows types to be created dynamically from script. The name must be
    * unique for successful registration.
    * @SINCE_1_0.0
-   * @param [in] name the name of the type to be registered
-   * @param [in] baseType the base type info of registerType
-   * @param [in] f registerType instance creation function
+   * @param[in] name the name of the type to be registered
+   * @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
+   * @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
-  std::string mName;       ///< Name of the type
+  std::string  mName;      ///< Name of the type
 };
 
 /**
- * @brief Register a signal connector function to a registered type.
+ * @brief Registers a signal connector function to a registered type.
  * @SINCE_1_0.0
  */
-class DALI_IMPORT_API SignalConnectorType
+class DALI_CORE_API SignalConnectorType
 {
 public:
   /**
    * @brief Constructor registers the type creation function.
    *
    * @SINCE_1_0.0
-   * @param [in] typeRegistration The TypeRegistration object
-   * @param [in] name The signal name
-   * @param [in] func The signal connector function
+   * @param[in] typeRegistration The TypeRegistration object
+   * @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);
 };
 
 /**
- * @brief Register an action function.
+ * @brief Registers an action function.
  * @SINCE_1_0.0
  */
-class DALI_IMPORT_API TypeAction
+class DALI_CORE_API TypeAction
 {
 public:
   /**
    * @brief Constructor registers the type creation function.
    *
    * @SINCE_1_0.0
-   * @param [in] registered The TypeRegistration object
-   * @param [in] name The action name
-   * @param [in] f The action function
+   * @param[in] registered The TypeRegistration object
+   * @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);
 };
 
 /**
- * @brief Register a property for the given type.
+ * @brief Registers a property for the given type.
  * @SINCE_1_0.0
  */
-class DALI_IMPORT_API PropertyRegistration
+class DALI_CORE_API PropertyRegistration
 {
 public:
-
   /**
    * @brief This constructor registers the property with the registered type.
    *
@@ -292,32 +319,33 @@ public:
    * @endcode
    *
    * @SINCE_1_0.0
-   * @param [in] registered The TypeRegistration object
-   * @param [in] name The name of the property
-   * @param [in] index The property index. Must be a value between PROPERTY_REGISTRATION_START_INDEX and PROPERTY_REGISTRATION_MAX_INDEX inclusive.
-   * @param [in] type The property value type.
-   * @param [in] setFunc The function to call when setting the property. If NULL, then the property becomes read-only.
-   * @param [in] getFunc The function to call to retrieve the current value of the property. MUST be provided.
-   *
+   * @param[in] registered The TypeRegistration object
+   * @param[in] name The name of the property
+   * @param[in] index The property index. Must be a value between PROPERTY_REGISTRATION_START_INDEX and PROPERTY_REGISTRATION_MAX_INDEX inclusive
+   * @param[in] type The property value type
+   * @param[in] setFunc The function to call when setting the property. If NULL, then the property becomes read-only
+   * @param[in] getFunc The function to call to retrieve the current value of the property. MUST be provided
    * @pre "registered" must be registered with the TypeRegistry.
    * @note The "index" value must be between START_INDEX and MAX_INDEX inclusive.
    * @note If "setFunc" is NULL, then the property becomes a read-only property.
-   * @note "getFunc" MUST be provided
+   * @note "getFunc" MUST be provided.
    *
    */
-  PropertyRegistration( TypeRegistration& registered,
-                        const std::string& name, Property::Index index, Property::Type type,
-                        TypeInfo::SetPropertyFunction setFunc, TypeInfo::GetPropertyFunction getFunc );
+  PropertyRegistration(TypeRegistration&             registered,
+                       std::string                   name,
+                       Property::Index               index,
+                       Property::Type                type,
+                       TypeInfo::SetPropertyFunction setFunc,
+                       TypeInfo::GetPropertyFunction getFunc);
 };
 
 /**
- * @brief Register an animatable property for the given type.
+ * @brief Registers an animatable property for the given type.
  * @SINCE_1_0.0
  */
-class DALI_IMPORT_API AnimatablePropertyRegistration
+class DALI_CORE_API AnimatablePropertyRegistration
 {
 public:
-
   /**
    * @brief This constructor registers the animatable property with the registered type.
    *
@@ -326,14 +354,13 @@ public:
    * functions.
    *
    * @SINCE_1_0.0
-   * @param [in] registered The TypeRegistration object
-   * @param [in] name The name of the property
-   * @param [in] index The property index. Must be a value between ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX and ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX inclusive.
-   * @param [in] type The property value type.
-   *
+   * @param[in] registered The TypeRegistration object
+   * @param[in] name The name of the property
+   * @param[in] index The property index. Must be a value between ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX and ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX inclusive
+   * @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.
@@ -343,24 +370,22 @@ public:
    * functions.
    *
    * @SINCE_1_1.18
-   * @param [in] registered The TypeRegistration object
-   * @param [in] name The name of the property
-   * @param [in] index The property index. Must be a value between ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX and ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX inclusive.
-   * @param [in] value The property default value.
-   *
+   * @param[in] registered The TypeRegistration object
+   * @param[in] name The name of the property
+   * @param[in] index The property index. Must be a value between ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX and ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX inclusive
+   * @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);
 };
 
 /**
- * @brief Register a component of animatable property for the given component index.
+ * @brief Registers a component of animatable property for the given component index.
  * @SINCE_1_0.0
  */
-class DALI_IMPORT_API AnimatablePropertyComponentRegistration
+class DALI_CORE_API AnimatablePropertyComponentRegistration
 {
 public:
-
   /**
    * @brief This constructor registers a component of an animatable property where
    * the base animatable property must be a property that supports property component
@@ -371,41 +396,50 @@ public:
    * value of the property can be retrieved and set via specified functions.
    *
    * @SINCE_1_0.0
-   * @param [in] registered The TypeRegistration object
-   * @param [in] name The name of the component
-   * @param [in] index The property index. Must be a value between ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX and ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX inclusive.
-   * @param [in] baseIndex The index of the base animatable property. Must be a value between ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX and ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX inclusive.
-   * @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).
-   *
+   * @param[in] registered The TypeRegistration object
+   * @param[in] name The name of the component
+   * @param[in] index The property index. Must be a value between ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX and ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX inclusive
+   * @param[in] baseIndex The index of the base animatable property. Must be a value between ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX and ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX inclusive
+   * @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, unsigned int componentIndex );
+  AnimatablePropertyComponentRegistration(TypeRegistration& registered, std::string name, Property::Index index, Property::Index baseIndex, uint32_t componentIndex);
 };
 
 /**
- * @brief Register a child property for the given type.
+ * @brief Registers a child property for the given type.
  * @SINCE_1_1.35
  */
-class DALI_IMPORT_API ChildPropertyRegistration
+class DALI_CORE_API ChildPropertyRegistration
 {
 public:
-
   /**
    * @brief This constructor registers an event-thread only child property (i.e. a property
    * that the parent supports in its children) with the registered type.
    *
    * @SINCE_1_1.35
-   * @param [in] registered The TypeRegistration object
-   * @param [in] name The name of the property
-   * @param [in] index The property index. Must be a value between CHILD_PROPERTY_REGISTRATION_START_INDEX and CHILD_PROPERTY_REGISTRATION_MAX_INDEX inclusive.
-   * @param [in] type The property value type.
+   * @param[in] registered The TypeRegistration object
+   * @param[in] name The name of the property
+   * @param[in] index The property index. Must be a value between CHILD_PROPERTY_REGISTRATION_START_INDEX and CHILD_PROPERTY_REGISTRATION_MAX_INDEX inclusive
+   * @param[in] type The property value type
+   * @pre "registered" must be registered with the TypeRegistry.
+   */
+  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
+   * that the parent supports in its children) with the registered type.
    *
+   * @SINCE_1_3.20
+   * @param[in] registered The name of the registered type
+   * @param[in] name The name of the property
+   * @param[in] index The property index. Must be a value between CHILD_PROPERTY_REGISTRATION_START_INDEX and CHILD_PROPERTY_REGISTRATION_MAX_INDEX inclusive
+   * @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(std::string registered, std::string name, Property::Index index, Property::Type type);
 };
 
-
 /**
  * @}
  */