2 * Copyright (c) 2014 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.h>
25 #include <dali/internal/event/common/type-registry-impl.h>
26 #include <dali/internal/event/common/property-index-ranges.h>
31 TypeRegistry::TypeRegistry()
35 TypeRegistry::~TypeRegistry()
39 TypeRegistry TypeRegistry::Get()
41 return TypeRegistry(Internal::TypeRegistry::Get());
44 Dali::TypeInfo TypeRegistry::GetTypeInfo( const std::string &uniqueTypeName )
46 return GetImplementation(*this).GetTypeInfo( uniqueTypeName );
49 Dali::TypeInfo TypeRegistry::GetTypeInfo( const std::type_info& registerType )
51 return GetImplementation(*this).GetTypeInfo( registerType );
54 TypeRegistry::NameContainer TypeRegistry::GetTypeNames() const
56 return GetImplementation(*this).GetTypeNames();
59 TypeRegistry::TypeRegistry(Internal::TypeRegistry* internal)
60 : BaseHandle(internal)
64 TypeRegistration::TypeRegistration( const std::type_info& registerType, const std::type_info& baseType,
65 TypeInfo::CreateFunction f )
66 : mReference(Internal::TypeRegistry::Get())
68 Internal::TypeRegistry *impl = Internal::TypeRegistry::Get();
70 if( impl->Register( registerType, baseType, f, false ) )
72 mName = impl->RegistrationName( registerType );
76 TypeRegistration::TypeRegistration( const std::type_info& registerType, const std::type_info& baseType,
77 TypeInfo::CreateFunction f, bool callCreateOnInit )
78 : mReference(Internal::TypeRegistry::Get())
80 Internal::TypeRegistry *impl = Internal::TypeRegistry::Get();
82 if( impl->Register( registerType, baseType, f, callCreateOnInit ) )
84 mName = impl->RegistrationName( registerType );
88 TypeRegistration::TypeRegistration( const std::string& name, const std::type_info& baseType,
89 TypeInfo::CreateFunction f )
90 : mReference(Internal::TypeRegistry::Get())
92 Internal::TypeRegistry *impl = Internal::TypeRegistry::Get();
94 if( impl->Register( name, baseType, f, false ) )
101 const std::string TypeRegistration::RegisteredName() const
106 SignalConnectorType::SignalConnectorType( TypeRegistration& typeRegistration, const std::string& name, TypeInfo::SignalConnectorFunctionV2 func )
108 Internal::TypeRegistry::Get()->RegisterSignal( typeRegistration, name, func );
111 TypeAction::TypeAction( TypeRegistration ®istered, const std::string &name, TypeInfo::ActionFunction f)
113 Internal::TypeRegistry::Get()->RegisterAction( registered, name, f );
116 PropertyRegistration::PropertyRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type, TypeInfo::SetPropertyFunction setFunc, TypeInfo::GetPropertyFunction getFunc )
118 DALI_ASSERT_ALWAYS( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) );
120 Internal::TypeRegistry::Get()->RegisterProperty( registered, name, index, type, setFunc, getFunc );