X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fpublic-api%2Fobject%2Ftype-registry.cpp;h=f3b1eeaea5a0fd935c779bd1ba6a416042d4007b;hb=aee2350a06fac17860817a0e84ff97a4553dbbaa;hp=58e5099837a8f5988ed1e87b24f5e1df1479d84d;hpb=8f2c5571c924479b6a07a2c2187dedd9c685baf0;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 58e5099..f3b1eea 100644 --- a/dali/public-api/object/type-registry.cpp +++ b/dali/public-api/object/type-registry.cpp @@ -1,18 +1,19 @@ -// -// 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) 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. + * 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. + * + */ // CLASS HEADER #include @@ -20,9 +21,9 @@ // EXTERNAL INCLUDES // INTERNAL INCLUDES -#include +#include #include -#include +#include namespace Dali { @@ -35,6 +36,17 @@ TypeRegistry::~TypeRegistry() { } +TypeRegistry::TypeRegistry(const TypeRegistry& copy) +: BaseHandle(copy) +{ +} + +TypeRegistry& TypeRegistry::operator=(const TypeRegistry& rhs) +{ + BaseHandle::operator=(rhs); + return *this; +} + TypeRegistry TypeRegistry::Get() { return TypeRegistry(Internal::TypeRegistry::Get()); @@ -42,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() ); +} + +size_t TypeRegistry::GetTypeNameCount() const +{ + return GetImplementation(*this).GetTypeNameCount(); } -TypeRegistry::NameContainer TypeRegistry::GetTypeNames() const +std::string TypeRegistry::GetTypeName(size_t index) const { - return GetImplementation(*this).GetTypeNames(); + return GetImplementation(*this).GetTypeName(index); } TypeRegistry::TypeRegistry(Internal::TypeRegistry* internal) @@ -66,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, @@ -78,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, @@ -90,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 ); } @@ -102,7 +118,7 @@ const std::string TypeRegistration::RegisteredName() const return mName; } -SignalConnectorType::SignalConnectorType( TypeRegistration& typeRegistration, const std::string& name, TypeInfo::SignalConnectorFunctionV2 func ) +SignalConnectorType::SignalConnectorType( TypeRegistration& typeRegistration, const std::string& name, TypeInfo::SignalConnectorFunction func ) { Internal::TypeRegistry::Get()->RegisterSignal( typeRegistration, name, func ); } @@ -119,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