本文整理汇总了C++中property::Map::GetPair方法的典型用法代码示例。如果您正苦于以下问题:C++ Map::GetPair方法的具体用法?C++ Map::GetPair怎么用?C++ Map::GetPair使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类property::Map
的用法示例。
在下文中一共展示了Map::GetPair方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: UtcDaliPropertyMapGetPair
int UtcDaliPropertyMapGetPair(void)
{
Property::Map map;
map[ "hello" ] = 1;
map[ "world" ] = 2;
DALI_TEST_CHECK( map.GetPair( 0 ).first == "hello" );
DALI_TEST_CHECK( map.GetPair( 0 ).second.Get< int >() == 1 );
DALI_TEST_CHECK( map.GetPair( 1 ).first == "world" );
DALI_TEST_CHECK( map.GetPair( 1 ).second.Get< int >() == 2 );
// Out of bounds
try
{
map.GetPair( 2 );
tet_result( TET_FAIL );
}
catch ( DaliException& e )
{
DALI_TEST_ASSERT( e, "position", TEST_LOCATION );
}
END_TEST;
}
示例3: NewAnimation
void NewAnimation( const Property::Map& map, Dali::AnimationData& outputAnimationData )
{
// Note: Builder cannot currently pass generic Property::Maps "{" that are nested, so currently we can only have one AnimateTo per animation.
Dali::AnimationData::AnimationDataElement* element = new Dali::AnimationData::AnimationDataElement();
element->alphaFunction = AlphaFunction::LINEAR;
element->timePeriodDelay = 0.0f;
element->timePeriodDuration = 1.0f;
// Now set the properties, or create children
for( unsigned int i = 0, animationMapCount = map.Count(); i < animationMapCount; ++i )
{
const StringValuePair& pair( map.GetPair( i ) );
const std::string& key( pair.first );
const Property::Value& value( pair.second );
if( key == "actor" )
{
element->actor = value.Get< std::string >();
}
else if( key == "property" )
{
element->property = value.Get< std::string >();
}
else if( key == "value" )
{
element->value = value;
}
else if( key == "alphaFunction" )
{
std::string alphaFunctionValue = value.Get< std::string >();
if( alphaFunctionValue == "LINEAR" )
{
element->alphaFunction = AlphaFunction::LINEAR;
}
else if( alphaFunctionValue == "REVERSE" )
{
element->alphaFunction = AlphaFunction::REVERSE;
}
else if( alphaFunctionValue == "EASE_IN_SQUARE" )
{
element->alphaFunction = AlphaFunction::EASE_IN_SQUARE;
}
else if( alphaFunctionValue == "EASE_OUT_SQUARE" )
{
element->alphaFunction = AlphaFunction::EASE_OUT_SQUARE;
}
else if( alphaFunctionValue == "EASE_IN" )
{
element->alphaFunction = AlphaFunction::EASE_IN;
}
else if( alphaFunctionValue == "EASE_OUT" )
{
element->alphaFunction = AlphaFunction::EASE_OUT;
}
else if( alphaFunctionValue == "EASE_IN_OUT" )
{
element->alphaFunction = AlphaFunction::EASE_IN_OUT;
}
else if( alphaFunctionValue == "EASE_IN_SINE" )
{
element->alphaFunction = AlphaFunction::EASE_IN_SINE;
}
else if( alphaFunctionValue == "EASE_OUT_SINE" )
{
element->alphaFunction = AlphaFunction::EASE_OUT_SINE;
}
else if( alphaFunctionValue == "EASE_IN_OUT_SINE" )
{
element->alphaFunction = AlphaFunction::EASE_IN_OUT_SINE;
}
else if( alphaFunctionValue == "BOUNCE" )
{
element->alphaFunction = AlphaFunction::BOUNCE;
}
else if( alphaFunctionValue == "SIN" )
{
element->alphaFunction = AlphaFunction::SIN;
}
else if( alphaFunctionValue == "EASE_OUT_BACK" )
{
element->alphaFunction = AlphaFunction::EASE_OUT_BACK;
}
}
else if( key == "timePeriod" )
{
Property::Map timeMap = value.Get< Property::Map >();
for( unsigned int i = 0; i < timeMap.Count(); ++i )
{
const StringValuePair& pair( timeMap.GetPair( i ) );
if( pair.first == "delay" )
{
element->timePeriodDelay = pair.second.Get< float >();
}
else if( pair.first == "duration" )
{
element->timePeriodDuration = pair.second.Get< float >();
}
}
}
//.........这里部分代码省略.........