#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.
-//
-
-/**
- * @addtogroup CAPI_DALI_FRAMEWORK
- * @{
+/*
+ * Copyright (c) 2014 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
#include <typeinfo>
}
/**
- * The TypeRegistry allows registration of type instance creation functions.
+ * @brief The TypeRegistry allows registration of type instance creation functions.
+ *
* These can then be created later by name and down cast to the appropriate type.
*
* Usage: (Registering)
class TypeRegistry : public BaseHandle
{
public:
- typedef std::vector<std::string> NameContainer;
+ typedef std::vector<std::string> NameContainer; ///< Container of type names
/**
- * Get Type Registry handle
+ * @brief Get Type Registry handle.
+ *
* @return TypeRegistry handle
*/
static TypeRegistry Get();
/**
- * Allows the creation of an empty typeRegistry handle.
+ * @brief Allows the creation of an empty typeRegistry handle.
*/
TypeRegistry();
/**
- * destructor.
+ * @brief destructor.
*/
~TypeRegistry();
/**
- * @copydoc Dali::BaseHandle::operator=
+ * @brief This copy constructor is required for (smart) pointer semantics.
+ *
+ * @param [in] handle A reference to the copied handle
+ */
+ TypeRegistry(const TypeRegistry& handle);
+
+ /**
+ * @brief This assignment operator is required for (smart) pointer semantics.
+ *
+ * @param [in] rhs A reference to the copied handle
+ * @return A reference to this
+ */
+ TypeRegistry& operator=(const TypeRegistry& rhs);
+
+ /**
+ * @brief This method is defined to allow assignment of the NULL value,
+ * and will throw an exception if passed any other value.
+ *
+ * Assigning to NULL is an alias for Reset().
+ * @param [in] rhs A NULL pointer
+ * @return A reference to this handle
*/
- using BaseHandle::operator=;
+ TypeRegistry& operator=(BaseHandle::NullType* rhs);
/**
- * Get TypeInfo for a registered type
+ * @brief Get TypeInfo for a registered type.
+ *
* @param [in] uniqueTypeName A unique type name
* @return TypeInfo if the type exists otherwise an empty handle
*/
TypeInfo GetTypeInfo( const std::string &uniqueTypeName );
/**
- * Get TypeInfo for a registered type
+ * @brief Get TypeInfo for a registered type.
+ *
* @param [in] registerType The registered type info
* @return TypeInfo if the type exists otherwise an empty handle
*/
TypeInfo GetTypeInfo( const std::type_info& registerType );
/**
- * Get type names
+ * @brief Get type names.
+ *
* @return list of known types by name
*/
NameContainer GetTypeNames() const;
public: // Not intended for application developers
/**
- * This constructor is used by Dali Get() method
+ * @brief This constructor is used by Dali Get() method.
+ *
* @param [in] typeRegistry A pointer to a Dali resource
*/
explicit DALI_INTERNAL TypeRegistry(Internal::TypeRegistry*typeRegistry);
};
/**
- * Register a type from type info
+ * @brief Register a type from type info.
*/
class TypeRegistration
{
public:
/**
- * Constructor registers the type creation function
+ * @brief Constructor registers the type 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
TypeInfo::CreateFunction f );
/**
- * Constructor registers the type creation function
+ * @brief Constructor registers the type 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
TypeInfo::CreateFunction f, bool callCreateOnInit );
/**
- * Constructor registers the type creation function for a named class or type.
+ * @brief Constructor registers the type creation function for a named class or type.
+ *
* This allows types to be created dynamically from script. The name must be
* unique for successful registration.
* @param [in] name the name of the type to be registered
TypeInfo::CreateFunction f );
/**
- * The name the type is registered under (derived from type_info)
+ * @brief The name the type is registered under (derived from type_info).
+ *
* @return the registered name or empty if unregistered
*/
const std::string RegisteredName() const;
private:
- TypeRegistry mReference;
- std::string mName;
+ TypeRegistry mReference; ///< Reference to the type registry
+ std::string mName; ///< Name of the type
};
/**
- * Register a signal connector function to a registered type
+ * @brief Register a signal connector function to a registered type.
*/
class SignalConnectorType
{
public:
/**
- * Constructor registers the type creation function
+ * @brief Constructor registers the type creation function.
+ *
* @param [in] typeRegistration The TypeRegistration object
* @param [in] name The signal name
* @param [in] func The signal connector function
};
/**
- * Register an action function
+ * @brief Register an action function.
*/
class TypeAction
{
public:
/**
- * Constructor registers the type creation function
+ * @brief Constructor registers the type creation function.
+ *
* @param [in] registered The TypeRegistration object
* @param [in] name The action name
* @param [in] f The action function
};
/**
- * Register a property for the given type.
+ * @brief Register a property for the given type.
*/
class PropertyRegistration
{
public:
- // Enumerations are being used here rather than static constants so that switch statements can be used to compare property indices
- enum
- {
- START_INDEX = 10000000, ///< The index for this type should start from this number
- MAX_INDEX = 19999999 ///< The maximum index supported for this type
- };
-
/**
- * This constructor registers the property with the registered type. This constructor is for event-thread
- * only properties where the value of the property can be retrieved and set via specified functions.
+ * @brief This constructor registers the property with the registered type.
+ *
+ * This constructor is for event-thread only properties where the
+ * value of the property can be retrieved and set via specified
+ * functions.
*
* Functions of the following type may be used for setFunc and getFunc respectively:
* @code
*
* @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 START_INDEX and MAX_INDEX inclusive.
+ * @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.
} // namespace Dali
-/**
- * @}
- */
#endif // header