2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/public-api/object/type-registry.h>
24 #include <dali/public-api/object/property-index-ranges.h>
25 #include <dali/internal/event/common/type-registry-impl.h>
30 TypeRegistry::TypeRegistry()
34 TypeRegistry::~TypeRegistry()
38 TypeRegistry::TypeRegistry(const TypeRegistry& copy)
43 TypeRegistry& TypeRegistry::operator=(const TypeRegistry& rhs)
45 BaseHandle::operator=(rhs);
49 TypeRegistry TypeRegistry::Get()
51 return TypeRegistry(Internal::TypeRegistry::Get());
54 Dali::TypeInfo TypeRegistry::GetTypeInfo( const std::string &uniqueTypeName )
56 return GetImplementation(*this).GetTypeInfo( uniqueTypeName );
59 Dali::TypeInfo TypeRegistry::GetTypeInfo( const std::type_info& registerType )
61 return GetImplementation(*this).GetTypeInfo( registerType );
64 size_t TypeRegistry::GetTypeNameCount() const
66 return GetImplementation(*this).GetTypeNameCount();
69 std::string TypeRegistry::GetTypeName(size_t index) const
71 return GetImplementation(*this).GetTypeName(index);
74 TypeRegistry::TypeRegistry(Internal::TypeRegistry* internal)
75 : BaseHandle(internal)
79 TypeRegistration::TypeRegistration( const std::type_info& registerType, const std::type_info& baseType,
80 TypeInfo::CreateFunction f )
81 : mReference(Internal::TypeRegistry::Get())
83 Internal::TypeRegistry *impl = Internal::TypeRegistry::Get();
85 if( impl->Register( registerType, baseType, f, false ) )
87 mName = impl->RegistrationName( registerType );
91 TypeRegistration::TypeRegistration( const std::type_info& registerType, const std::type_info& baseType,
92 TypeInfo::CreateFunction f, bool callCreateOnInit )
93 : mReference(Internal::TypeRegistry::Get())
95 Internal::TypeRegistry *impl = Internal::TypeRegistry::Get();
97 if( impl->Register( registerType, baseType, f, callCreateOnInit ) )
99 mName = impl->RegistrationName( registerType );
103 TypeRegistration::TypeRegistration( const std::string& name, const std::type_info& baseType,
104 TypeInfo::CreateFunction f )
105 : mReference(Internal::TypeRegistry::Get())
107 Internal::TypeRegistry *impl = Internal::TypeRegistry::Get();
109 if( impl->Register( name, baseType, f, false ) )
116 const std::string TypeRegistration::RegisteredName() const
121 SignalConnectorType::SignalConnectorType( TypeRegistration& typeRegistration, const std::string& name, TypeInfo::SignalConnectorFunction func )
123 Internal::TypeRegistry::Get()->RegisterSignal( typeRegistration, name, func );
126 TypeAction::TypeAction( TypeRegistration ®istered, const std::string &name, TypeInfo::ActionFunction f)
128 Internal::TypeRegistry::Get()->RegisterAction( registered, name, f );
131 PropertyRegistration::PropertyRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type, TypeInfo::SetPropertyFunction setFunc, TypeInfo::GetPropertyFunction getFunc )
133 DALI_ASSERT_ALWAYS( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) );
135 Internal::TypeRegistry::Get()->RegisterProperty( registered, name, index, type, setFunc, getFunc );
138 AnimatablePropertyRegistration::AnimatablePropertyRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type )
140 DALI_ASSERT_ALWAYS( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) );
142 Internal::TypeRegistry::Get()->RegisterAnimatableProperty( registered, name, index, type );
145 AnimatablePropertyComponentRegistration::AnimatablePropertyComponentRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Index baseIndex, unsigned int componentIndex)
147 DALI_ASSERT_ALWAYS( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) );
149 Internal::TypeRegistry::Get()->RegisterAnimatablePropertyComponent( registered, name, index, baseIndex, componentIndex );