本文整理汇总了C++中TypeInfo::CreateInstance方法的典型用法代码示例。如果您正苦于以下问题:C++ TypeInfo::CreateInstance方法的具体用法?C++ TypeInfo::CreateInstance怎么用?C++ TypeInfo::CreateInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeInfo
的用法示例。
在下文中一共展示了TypeInfo::CreateInstance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UtcDaliConfirmationPopupTypeRegistryCreation
int UtcDaliConfirmationPopupTypeRegistryCreation(void)
{
ToolkitTestApplication application;
tet_infoline( " UtcDaliConfirmationPopupTypeRegistryCreation" );
TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( "ConfirmationPopup" );
DALI_TEST_CHECK( typeInfo )
BaseHandle baseHandle = typeInfo.CreateInstance();
DALI_TEST_CHECK( baseHandle )
Toolkit::Popup popup = Toolkit::Popup::DownCast( baseHandle );
popup.SetProperty( Popup::Property::ANIMATION_DURATION, 0.0f );
Stage::GetCurrent().Add( popup );
popup.SetDisplayState( Toolkit::Popup::SHOWN );
application.SendNotification();
application.Render();
// Check the popup is shown.
DALI_TEST_EQUALS( popup.GetDisplayState(), Popup::SHOWN, TEST_LOCATION );
END_TEST;
}
示例2: NewActor
Actor NewActor( const Property::Map& map )
{
BaseHandle handle;
// First find type and create Actor
Property::Value* typeValue = map.Find( "type" );
if ( typeValue )
{
TypeInfo type = TypeRegistry::Get().GetTypeInfo( typeValue->Get< std::string >() );
if ( type )
{
handle = type.CreateInstance();
}
}
if ( !handle )
{
DALI_LOG_ERROR( "Actor type not provided\n" );
return Actor();
}
Actor actor( Actor::DownCast( handle ) );
if ( actor )
{
// Now set the properties, or create children
for ( unsigned int i = 0, mapCount = map.Count(); i < mapCount; ++i )
{
const StringValuePair& pair( map.GetPair( i ) );
const std::string& key( pair.first );
if ( key == "type" )
{
continue;
}
const Property::Value& value( pair.second );
if ( key == "actors" )
{
// Create children
Property::Array actorArray = value.Get< Property::Array >();
for ( Property::Array::SizeType i = 0; i < actorArray.Size(); ++i)
{
actor.Add( NewActor( actorArray[i].Get< Property::Map >() ) );
}
}
else
{
Property::Index index( actor.GetPropertyIndex( key ) );
if ( index != Property::INVALID_INDEX )
{
actor.SetProperty( index, value );
}
}
}
}
return actor;
}
示例3: UtcDaliStyleManagerGet
int UtcDaliStyleManagerGet(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliStyleManagerGet");
// Register Type
TypeInfo type;
type = TypeRegistry::Get().GetTypeInfo( "StyleManager" );
DALI_TEST_CHECK( type );
BaseHandle handle = type.CreateInstance();
DALI_TEST_CHECK( handle );
StyleManager manager;
manager = StyleManager::Get();
DALI_TEST_CHECK(manager);
StyleManager newManager = StyleManager::Get();
DALI_TEST_CHECK(newManager);
// Check that focus manager is a singleton
DALI_TEST_CHECK(manager == newManager);
END_TEST;
}
示例4: UtcDaliMagnifierTypeRegistry
int UtcDaliMagnifierTypeRegistry(void)
{
ToolkitTestApplication application;
TypeRegistry typeRegistry = TypeRegistry::Get();
DALI_TEST_CHECK( typeRegistry );
TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Magnifier" );
DALI_TEST_CHECK( typeInfo );
BaseHandle handle = typeInfo.CreateInstance();
DALI_TEST_CHECK( handle );
Magnifier view = Magnifier::DownCast( handle );
DALI_TEST_CHECK( view );
END_TEST;
}
示例5: UtcDaliVideoViewTypeRegistry
int UtcDaliVideoViewTypeRegistry(void)
{
ToolkitTestApplication application;
TypeRegistry typeRegistry = TypeRegistry::Get();
DALI_TEST_CHECK( typeRegistry );
TypeInfo typeInfo = typeRegistry.GetTypeInfo( "VideoView" );
DALI_TEST_CHECK( typeInfo );
BaseHandle handle = typeInfo.CreateInstance();
DALI_TEST_CHECK( handle );
VideoView view = VideoView::DownCast( handle );
DALI_TEST_CHECK( view );
END_TEST;
}