X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=dali%2Fpublic-api%2Fobject%2Ftype-registry.h;h=a44f376357715ad84d37b247182d87ec69c2cc2a;hb=dbbe326c4c5dd97df1796c8e59d6ed2a1231d8f0;hp=7d2e2a2d30d9ef73aa7d8baf5ad235f53950fa52;hpb=5c66381841dd4dfd82c5a118d34104a00a2e0e1c;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/public-api/object/type-registry.h b/dali/public-api/object/type-registry.h index 7d2e2a2..a44f376 100644 --- a/dali/public-api/object/type-registry.h +++ b/dali/public-api/object/type-registry.h @@ -1,21 +1,22 @@ #ifndef __DALI_TYPE_REGISTRY_H__ #define __DALI_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) 2016 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. + * + */ // EXTERNAL INCLUDES @@ -25,8 +26,12 @@ #include #include -namespace Dali DALI_IMPORT_API +namespace Dali { +/** + * @addtogroup dali_core_object + * @{ + */ namespace Internal DALI_INTERNAL { @@ -86,37 +91,52 @@ class TypeRegistry; * Signal and action names follow properties and are by convention lower case hyphen * separated ie 'next-page'. This maintains consistency with the scripted interface. * + * @SINCE_1_0.0 */ -class TypeRegistry : public BaseHandle +class DALI_IMPORT_API TypeRegistry : public BaseHandle { public: - typedef std::vector NameContainer; ///< Container of type names - /** * @brief Get Type Registry handle. * + * @SINCE_1_0.0 * @return TypeRegistry handle */ static TypeRegistry Get(); /** * @brief Allows the creation of an empty typeRegistry handle. + * @SINCE_1_0.0 */ TypeRegistry(); /** * @brief destructor. + * @SINCE_1_0.0 */ ~TypeRegistry(); /** - * @copydoc Dali::BaseHandle::operator= + * @brief This copy constructor is required for (smart) pointer semantics. + * + * @SINCE_1_0.0 + * @param [in] handle A reference to the copied handle + */ + TypeRegistry(const TypeRegistry& handle); + + /** + * @brief This assignment operator is required for (smart) pointer semantics. + * + * @SINCE_1_0.0 + * @param [in] rhs A reference to the copied handle + * @return A reference to this */ - using BaseHandle::operator=; + TypeRegistry& operator=(const TypeRegistry& rhs); /** * @brief Get 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 */ @@ -125,23 +145,36 @@ public: /** * @brief Get 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 */ TypeInfo GetTypeInfo( const std::type_info& registerType ); /** - * @brief Get type names. + * @brief Get type name count. + * + * @SINCE_1_0.0 + * @return The count + */ + size_t GetTypeNameCount() const; + + /** + * @brief Get type names by index. * - * @return list of known types by name + * @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 */ - NameContainer GetTypeNames() const; + std::string GetTypeName(size_t index) const; public: // Not intended for application developers /** + * @internal * @brief This constructor is used by Dali Get() method. * + * @SINCE_1_0.0 * @param [in] typeRegistry A pointer to a Dali resource */ explicit DALI_INTERNAL TypeRegistry(Internal::TypeRegistry*typeRegistry); @@ -149,13 +182,15 @@ public: // Not intended for application developers /** * @brief Register a type from type info. + * @SINCE_1_0.0 */ -class TypeRegistration +class DALI_IMPORT_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 @@ -166,6 +201,7 @@ 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 @@ -179,6 +215,7 @@ 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 @@ -189,6 +226,7 @@ public: /** * @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; @@ -200,29 +238,33 @@ private: /** * @brief Register a signal connector function to a registered type. + * @SINCE_1_0.0 */ -class SignalConnectorType +class DALI_IMPORT_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 */ - SignalConnectorType( TypeRegistration& typeRegistration, const std::string& name, TypeInfo::SignalConnectorFunctionV2 func ); + SignalConnectorType( TypeRegistration& typeRegistration, const std::string& name, TypeInfo::SignalConnectorFunction func ); }; /** * @brief Register an action function. + * @SINCE_1_0.0 */ -class TypeAction +class DALI_IMPORT_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 @@ -232,8 +274,9 @@ public: /** * @brief Register a property for the given type. + * @SINCE_1_0.0 */ -class PropertyRegistration +class DALI_IMPORT_API PropertyRegistration { public: @@ -250,6 +293,7 @@ public: * Property::Value GetProperty( BaseObject* object, Property::Index index ); * @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. @@ -257,17 +301,116 @@ public: * @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 * - * @pre "registered" must be registered with the TypeRegistry. */ PropertyRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type, TypeInfo::SetPropertyFunction setFunc, TypeInfo::GetPropertyFunction getFunc ); }; +/** + * @brief Register an animatable property for the given type. + * @SINCE_1_0.0 + */ +class DALI_IMPORT_API AnimatablePropertyRegistration +{ +public: + + /** + * @brief This constructor registers the animatable property with the registered type. + * + * This constructor is for scene-graph only properties where the + * 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 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 ); + + /** + * @brief This constructor registers the animatable property with the registered default value. + * + * This constructor is for scene-graph only properties where the + * value of the property can be retrieved and set via specified + * 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. + * + * @pre "registered" must be registered with the TypeRegistry. + */ + AnimatablePropertyRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, const Property::Value& value ); +}; + +/** + * @brief Register a component of animatable property for the given component index. + * @SINCE_1_0.0 + */ +class DALI_IMPORT_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 + * (i.e. Vector2, Vector3 or Vector4) and the base animatable property must have + * been registered. + * + * This constructor is for a component of scene-graph only properties where the + * 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). + * + * @pre "registered" must be registered with the TypeRegistry. + */ + AnimatablePropertyComponentRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Index baseIndex, unsigned int componentIndex ); +}; + +/** + * @brief Register a child property for the given type. + * @SINCE_1_1.35 + */ +class DALI_IMPORT_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. + * + * @pre "registered" must be registered with the TypeRegistry. + */ + ChildPropertyRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type ); +}; + + +/** + * @} + */ } // namespace Dali #endif // header