Remove use of map-wrapper from TypeRegistry
[platform/core/uifw/dali-core.git] / dali / internal / event / common / type-registry-impl.h
index d75fc91..47364f3 100644 (file)
@@ -1,24 +1,25 @@
 #ifndef __DALI_INTERNAL_TYPE_REGISTRY_H__
 #define __DALI_INTERNAL_TYPE_REGISTRY_H__
 
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
 // INTERNAL INCLUDES
-#include <dali/public-api/common/map-wrapper.h>
+#include <dali/devel-api/object/csharp-type-info.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/public-api/object/base-handle.h>
 #include <dali/public-api/object/base-object.h>
@@ -55,9 +56,14 @@ public:
   Dali::TypeInfo GetTypeInfo( const std::type_info& registerType );
 
   /*
-   * @copydoc Dali::TypeRegistry::GetTypeNames
+   * @copydoc Dali::TypeRegistry::GetTypeNameCount
+   */
+  size_t GetTypeNameCount() const;
+
+  /*
+   * @copydoc Dali::TypeRegistry::GetTypeName
    */
-  Dali::TypeRegistry::NameContainer GetTypeNames() const;
+  std::string GetTypeName(size_t index) const;
 
   /*
    * Register a creation function under a unique name.
@@ -82,12 +88,22 @@ public:
                  Dali::TypeInfo::CreateFunction createInstance, bool callCreateOnInit  );
 
   /*
+   * Register a creation function under a unique name (used by C# Custom controls).
+   * @param [in] name The name type to be registered (must be unique)
+   * @param [in] baseTypeInfo Type info for its base class
+   * @param [in] createInstance Instance creation function
+   * @return true if the name could be registered.
+   */
+  bool Register( const std::string& name, const std::type_info& baseTypeInfo,
+                 Dali::CSharpTypeInfo::CreateFunction createInstance );
+
+  /*
    * Register a signal connector function to a type
    * @param [in] typeRegistration TypeRegistration object used to register the type
    * @param [in] name Signal name
    * @param [in] func Signal connector function
    */
-  void RegisterSignal( TypeRegistration& typeRegistration, const std::string& name, Dali::TypeInfo::SignalConnectorFunctionV2 func );
+  void RegisterSignal( TypeRegistration& typeRegistration, const std::string& name, Dali::TypeInfo::SignalConnectorFunction func );
 
   /*
    * Register an action function to a type
@@ -98,11 +114,77 @@ public:
    */
   bool RegisterAction( TypeRegistration &registered, const std::string &name, Dali::TypeInfo::ActionFunction f);
 
+  /**
+   * Register an event-thread only property with a type
+   * @param [in] registered TypeRegistration object used to register the type
+   * @param [in] name Property name
+   * @param [in] index Property index
+   * @param [in] type Property type
+   * @param [in] setFunc The function to set the property (Can be NULL).
+   * @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 );
+
+  /**
+   * Register an event-thread only property with a type (used by C# Custom controls)
+   * @param [in] objectName name of the object used to register the type
+   * @param [in] name Property name
+   * @param [in] index Property index
+   * @param [in] type Property type
+   * @param [in] setFunc The function to set the property (Can be NULL).
+   * @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 );
+
+
+  /**
+   * Register a scene graph only property with a type
+   * @param [in] registered TypeRegistration object used to register the type
+   * @param [in] name Property name
+   * @param [in] index Property index
+   * @param [in] type Property type
+   * @return true if registered
+   */
+  bool RegisterAnimatableProperty( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type );
+
+  /**
+   * Register a scene graph only property with a default value
+   * @param [in] registered TypeRegistration object used to register the type
+   * @param [in] name Property name
+   * @param [in] index Property index
+   * @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 );
+
+  /**
+   * Register a component of a scene graph only property that supports components (i.e. Vector2, Vector3 and Vector4)
+   * @param [in] registered TypeRegistration object used to register the type
+   * @param [in] name Component name
+   * @param [in] index Property index
+   * @param [in] baseIndex Base animatable property index
+   * @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 );
+
+  /**
+   * Register a event-thread only property with a type and a default value
+   * @param [in] registered TypeRegistration object used to register the type
+   * @param [in] name Property name
+   * @param [in] index Property index
+   * @param [in] type Property type
+   * @return true if registered
+   */
+  bool RegisterChildProperty( TypeRegistration& registered, const 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 std::vector<Property::Value> &properties);
+  bool DoActionTo( BaseObject * const object, const std::string &actionName, const Property::Map& properties);
 
   /**
    * @copydoc Dali::BaseHandle::ConnectSignal()
@@ -114,7 +196,7 @@ public:
    * @param [in] pBaseObject Pointer to a BaseObject
    * @return TypeInfo for the BaseObject.
    */
-  Dali::TypeInfo GetTypeInfo(Dali::BaseObject * const pBaseObject);
+  Dali::TypeInfo GetTypeInfo(const Dali::BaseObject * const pBaseObject);
 
   /*
    * Calls any type creation functions that have been flagged as initialization functions
@@ -132,20 +214,25 @@ public:
 
 private:
   /*
-   * Map from type name to TypeInfo
+   * Mapping from type name to TypeInfo
    */
-  typedef std::map<std::string, Dali::TypeInfo> RegistryMap;
-  RegistryMap mRegistryLut;
+  std::vector< Dali::TypeInfo > mRegistryLut;
 
-  typedef std::vector<Dali::TypeInfo::CreateFunction> InitFunctions;
-  InitFunctions mInitFunctions;
+  std::vector< Dali::TypeInfo::CreateFunction > mInitFunctions;
 
 private:
   TypeRegistry();
   ~TypeRegistry();
 
+  /**
+   * @brief Undefined Copy Constructor
+   */
   TypeRegistry(TypeRegistry &);
-  TypeRegistry &operator()(const TypeRegistry &);
+
+  /**
+   * @brief Undefined Assignment Operator
+   */
+  TypeRegistry& operator=(const TypeRegistry &);
 };