2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
18 #include <dali/public-api/object/type-registry.h>
23 #include <dali/internal/event/common/type-registry-impl.h>
24 #include <dali/internal/event/common/property-index-ranges.h>
29 TypeRegistry::TypeRegistry()
33 TypeRegistry::~TypeRegistry()
37 TypeRegistry TypeRegistry::Get()
39 return TypeRegistry(Internal::TypeRegistry::Get());
42 Dali::TypeInfo TypeRegistry::GetTypeInfo( const std::string &uniqueTypeName )
44 return GetImplementation(*this).GetTypeInfo( uniqueTypeName );
47 Dali::TypeInfo TypeRegistry::GetTypeInfo( const std::type_info& registerType )
49 return GetImplementation(*this).GetTypeInfo( registerType );
52 TypeRegistry::NameContainer TypeRegistry::GetTypeNames() const
54 return GetImplementation(*this).GetTypeNames();
57 TypeRegistry::TypeRegistry(Internal::TypeRegistry* internal)
58 : BaseHandle(internal)
62 TypeRegistration::TypeRegistration( const std::type_info& registerType, const std::type_info& baseType,
63 TypeInfo::CreateFunction f )
64 : mReference(Internal::TypeRegistry::Get())
66 Internal::TypeRegistry *impl = Internal::TypeRegistry::Get();
68 if( impl->Register( registerType, baseType, f, false ) )
70 mName = impl->RegistrationName( registerType );
74 TypeRegistration::TypeRegistration( const std::type_info& registerType, const std::type_info& baseType,
75 TypeInfo::CreateFunction f, bool callCreateOnInit )
76 : mReference(Internal::TypeRegistry::Get())
78 Internal::TypeRegistry *impl = Internal::TypeRegistry::Get();
80 if( impl->Register( registerType, baseType, f, callCreateOnInit ) )
82 mName = impl->RegistrationName( registerType );
86 TypeRegistration::TypeRegistration( const std::string& name, const std::type_info& baseType,
87 TypeInfo::CreateFunction f )
88 : mReference(Internal::TypeRegistry::Get())
90 Internal::TypeRegistry *impl = Internal::TypeRegistry::Get();
92 if( impl->Register( name, baseType, f, false ) )
99 const std::string TypeRegistration::RegisteredName() const
104 SignalConnectorType::SignalConnectorType( TypeRegistration& typeRegistration, const std::string& name, TypeInfo::SignalConnectorFunctionV2 func )
106 Internal::TypeRegistry::Get()->RegisterSignal( typeRegistration, name, func );
109 TypeAction::TypeAction( TypeRegistration ®istered, const std::string &name, TypeInfo::ActionFunction f)
111 Internal::TypeRegistry::Get()->RegisterAction( registered, name, f );
114 PropertyRegistration::PropertyRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type, TypeInfo::SetPropertyFunction setFunc, TypeInfo::GetPropertyFunction getFunc )
116 DALI_ASSERT_ALWAYS( ( index >= START_INDEX ) && ( index <= MAX_INDEX ) );
118 Internal::TypeRegistry::Get()->RegisterProperty( registered, name, index, type, setFunc, getFunc );