X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fpublic-api%2Fobject%2Ftype-registry.cpp;h=f3b1eeaea5a0fd935c779bd1ba6a416042d4007b;hb=aee2350a06fac17860817a0e84ff97a4553dbbaa;hp=93286fb9b60e7c8e4dc93a24a62aafb53b6b45da;hpb=ee3018b578065010be4c56cacf99a294140ab120;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/public-api/object/type-registry.cpp b/dali/public-api/object/type-registry.cpp index 93286fb..f3b1eea 100644 --- a/dali/public-api/object/type-registry.cpp +++ b/dali/public-api/object/type-registry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -23,6 +23,7 @@ // INTERNAL INCLUDES #include #include +#include namespace Dali { @@ -53,17 +54,22 @@ TypeRegistry TypeRegistry::Get() Dali::TypeInfo TypeRegistry::GetTypeInfo( const std::string &uniqueTypeName ) { - return GetImplementation(*this).GetTypeInfo( uniqueTypeName ); + return Dali::TypeInfo( GetImplementation(*this).GetTypeInfo( uniqueTypeName ).Get() ); } Dali::TypeInfo TypeRegistry::GetTypeInfo( const std::type_info& registerType ) { - return GetImplementation(*this).GetTypeInfo( registerType ); + return Dali::TypeInfo( GetImplementation(*this).GetTypeInfo( registerType ).Get() ); } -TypeRegistry::NameContainer TypeRegistry::GetTypeNames() const +size_t TypeRegistry::GetTypeNameCount() const { - return GetImplementation(*this).GetTypeNames(); + return GetImplementation(*this).GetTypeNameCount(); +} + +std::string TypeRegistry::GetTypeName(size_t index) const +{ + return GetImplementation(*this).GetTypeName(index); } TypeRegistry::TypeRegistry(Internal::TypeRegistry* internal) @@ -77,10 +83,7 @@ TypeRegistration::TypeRegistration( const std::type_info& registerType, const st { Internal::TypeRegistry *impl = Internal::TypeRegistry::Get(); - if( impl->Register( registerType, baseType, f, false ) ) - { - mName = impl->RegistrationName( registerType ); - } + mName = impl->Register( registerType, baseType, f, false ); } TypeRegistration::TypeRegistration( const std::type_info& registerType, const std::type_info& baseType, @@ -89,10 +92,15 @@ TypeRegistration::TypeRegistration( const std::type_info& registerType, const st { Internal::TypeRegistry *impl = Internal::TypeRegistry::Get(); - if( impl->Register( registerType, baseType, f, callCreateOnInit ) ) - { - mName = impl->RegistrationName( registerType ); - } + mName = impl->Register( registerType, baseType, f, callCreateOnInit ); +} + +TypeRegistration::TypeRegistration( const std::type_info& registerType, const std::type_info& baseType, + TypeInfo::CreateFunction f, const DefaultPropertyMetadata& defaultProperties ) +{ + Internal::TypeRegistry *impl = Internal::TypeRegistry::Get(); + + mName = impl->Register( registerType, baseType, f, false, defaultProperties.propertyTable, defaultProperties.propertyCount ); } TypeRegistration::TypeRegistration( const std::string& name, const std::type_info& baseType, @@ -101,10 +109,7 @@ TypeRegistration::TypeRegistration( const std::string& name, const std::type_inf { Internal::TypeRegistry *impl = Internal::TypeRegistry::Get(); - if( impl->Register( name, baseType, f, false ) ) - { - mName = name; - } + mName = impl->Register( name, baseType, f, false ); } @@ -130,4 +135,40 @@ PropertyRegistration::PropertyRegistration( TypeRegistration& registered, const Internal::TypeRegistry::Get()->RegisterProperty( registered, name, index, type, setFunc, getFunc ); } +AnimatablePropertyRegistration::AnimatablePropertyRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type ) +{ + DALI_ASSERT_ALWAYS( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) ); + + Internal::TypeRegistry::Get()->RegisterAnimatableProperty( registered, name, index, type ); +} + +AnimatablePropertyRegistration::AnimatablePropertyRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, const Property::Value& value ) +{ + DALI_ASSERT_ALWAYS( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) ); + + Internal::TypeRegistry::Get()->RegisterAnimatableProperty( registered, name, index, value ); +} + +AnimatablePropertyComponentRegistration::AnimatablePropertyComponentRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Index baseIndex, uint32_t componentIndex) +{ + DALI_ASSERT_ALWAYS( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) ); + + Internal::TypeRegistry::Get()->RegisterAnimatablePropertyComponent( registered, name, index, baseIndex, componentIndex ); +} + +ChildPropertyRegistration::ChildPropertyRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type ) +{ + DALI_ASSERT_ALWAYS( ( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX ) ); + + Internal::TypeRegistry::Get()->RegisterChildProperty( registered, name, index, type ); +} + +ChildPropertyRegistration::ChildPropertyRegistration( const std::string& registered, const std::string& name, Property::Index index, Property::Type type ) +{ + DALI_ASSERT_ALWAYS( ( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX ) ); + + Internal::TypeRegistry::Get()->RegisterChildProperty( registered, name, index, type ); +} + + } // namespace Dali