refactor Object,TypeInfo and PropertyMetaData to use ConstString
[platform/core/uifw/dali-core.git] / dali / public-api / object / type-info.h
index 87a1958..b278c82 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_TYPE_INFO_H__
-#define __DALI_TYPE_INFO_H__
+#ifndef DALI_TYPE_INFO_H
+#define DALI_TYPE_INFO_H
 
 /*
- * Copyright (c) 2018 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.
  *
  */
 
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
 
 // INTERNAL INCLUDES
-#include <dali/public-api/object/base-handle.h>
 #include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/object/base-handle.h>
 
 namespace Dali
 {
@@ -35,7 +37,7 @@ class FunctorDelegate;
 
 namespace Internal DALI_INTERNAL
 {
-  class TypeInfo;
+class TypeInfo;
 };
 
 /**
@@ -45,12 +47,12 @@ namespace Internal DALI_INTERNAL
  * See TypeRegistry for methods of type registration and TypeInfo retrieval.
  * @SINCE_1_0.0
  */
-class DALI_IMPORT_API TypeInfo : public BaseHandle
+class DALI_CORE_API TypeInfo : public BaseHandle
 {
 public:
-  typedef BaseHandle (*CreateFunction)(); ///< Function signature for creating an instance of the associated object type. @SINCE_1_0.0
+  using CreateFunction = BaseHandle (*)(); ///< Function signature for creating an instance of the associated object type. @SINCE_1_0.0
 
-  typedef bool (*ActionFunction)(BaseObject*, const std::string&, const Property::Map&); ///< Function signature for creating scriptable actions @SINCE_1_0.0
+  using ActionFunction = bool (*)(BaseObject*, const std::string&, const Property::Map&); ///< Function signature for creating scriptable actions @SINCE_1_0.0
 
   /**
    * @brief Connects a callback function with the object's signals.
@@ -63,7 +65,7 @@ public:
    * @return True if the signal was connected
    * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
    */
-  typedef bool (*SignalConnectorFunction)(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
+  using SignalConnectorFunction = bool (*)(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
 
   /**
    * @brief Callback to set an event-thread only property.
@@ -74,7 +76,7 @@ public:
    * @param[in] value The new value of the property for the object specified
    * @see PropertyRegistration.
    */
-  typedef void (*SetPropertyFunction)( BaseObject* object, Property::Index index, const Property::Value& value );
+  using SetPropertyFunction = void (*)(BaseObject* object, Property::Index index, const Property::Value& value);
 
   /**
    * @brief Callback to get the value of an event-thread only property.
@@ -85,7 +87,7 @@ public:
    * @return The current value of the property for the object specified
    * @see PropertyRegistration.
    */
-  typedef Property::Value (*GetPropertyFunction)( BaseObject* object, Property::Index index );
+  using GetPropertyFunction = Property::Value (*)(BaseObject* object, Property::Index index);
 
   /**
    * @brief Allows the creation of an empty TypeInfo handle.
@@ -119,6 +121,23 @@ public:
   TypeInfo& operator=(const TypeInfo& rhs);
 
   /**
+   * @brief Move constructor.
+   *
+   * @SINCE_1_9.22
+   * @param[in] rhs A reference to the moved handle
+   */
+  TypeInfo(TypeInfo&& rhs);
+
+  /**
+   * @brief Move assignment operator.
+   *
+   * @SINCE_1_9.22
+   * @param[in] rhs A reference to the moved handle
+   * @return A reference to this handle
+   */
+  TypeInfo& operator=(TypeInfo&& rhs);
+
+  /**
    * @brief Retrieves the type name for this type.
    *
    * @SINCE_1_0.0
@@ -187,7 +206,6 @@ public:
   /**
    * @brief Retrieves the number of event side type registered properties for this type.
    *
-   * This count does not include all properties.
    * @SINCE_1_0.0
    * @return The count
    */
@@ -202,7 +220,16 @@ public:
    * @param[out] indices Container of property indices
    * @note The container will be cleared
    */
-  void GetPropertyIndices( Property::IndexContainer& indices ) const;
+  void GetPropertyIndices(Property::IndexContainer& indices) const;
+
+  /**
+   * @brief Retrieves all the child property indices for this type.
+   *
+   * @SINCE_1_3.20
+   * @param[out] indices Container of property indices
+   * @note The container will be cleared
+   */
+  void GetChildPropertyIndices(Property::IndexContainer& indices) const;
 
   /**
    * @brief Given a property index, retrieve the property name associated with it.
@@ -211,10 +238,9 @@ public:
    * @param[in] index The property index
    * @return The name of the property at the given index
    * @exception DaliException If index is not valid.
-   *
+   * @note this method only works for custom registered properties
    */
-  const std::string& GetPropertyName( Property::Index index ) const;
-
+  std::string_view GetPropertyName(Property::Index index) const;
 
   /**
    * @brief Given a child property name, retrieve the property index associated with it,
@@ -223,7 +249,7 @@ public:
    * @param[in] name The name of the property at the given index,
    * @return The property index or Property::INVALID_INDEX
    */
-  Property::Index GetChildPropertyIndex( const std::string& name ) const;
+  Property::Index GetChildPropertyIndex(const std::string& name) const;
 
   /**
    * @brief Given a child property index, retrieve the property name associated with it.
@@ -232,7 +258,7 @@ public:
    * @param[in] index The property index
    * @return The name of the property at the given index, or empty string if it does not exist
    */
-  const std::string& GetChildPropertyName( Property::Index index ) const;
+  std::string_view GetChildPropertyName(Property::Index index) const;
 
   /**
    * @brief Given a child property index, retrieve the property name associated with it.
@@ -241,12 +267,9 @@ public:
    * @param[in] index The property index
    * @return The name of the property at the given index, or empty string if it does not exist
    */
-  Property::Type GetChildPropertyType( Property::Index index ) const;
-
-
+  Property::Type GetChildPropertyType(Property::Index index) const;
 
 public: // Not intended for application developers
-
   /// @cond internal
   /**
    * @brief This constructor is used by Dali Get() method.
@@ -256,7 +279,6 @@ public: // Not intended for application developers
    */
   explicit DALI_INTERNAL TypeInfo(Internal::TypeInfo* typeInfo);
   /// @endcond
-
 };
 
 /**
@@ -264,4 +286,4 @@ public: // Not intended for application developers
  */
 } // namespace Dali
 
-#endif // __DALI_TYPE_INFO_H__
+#endif // DALI_TYPE_INFO_H