当前位置: 首页>>代码示例>>C++>>正文


C++ Array::push_back方法代码示例

本文整理汇总了C++中property::Array::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ Array::push_back方法的具体用法?C++ Array::push_back怎么用?C++ Array::push_back使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在property::Array的用法示例。


在下文中一共展示了Array::push_back方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetType

int Property::Value::AppendItem(const Property::Value &value)
{
  DALI_ASSERT_DEBUG(Property::ARRAY == GetType() && "Property type invalid");

  Property::Array *container = AnyCast<Property::Array>(&(mImpl->mValue));

  if(container)
  {
    container->push_back(value);
    return container->size() - 1;
  }
  else
  {
    return -1;
  }

}
开发者ID:Tarnyko,项目名称:dali-core,代码行数:17,代码来源:property-value.cpp

示例2: UtcDaliScriptingNewActorChildren

int UtcDaliScriptingNewActorChildren(void)
{
  TestApplication application;

  Property::Map map;
  map.push_back( Property::StringValuePair( "type", "Actor" ) );
  map.push_back( Property::StringValuePair( "position", Vector3::XAXIS ) );

  Property::Map child1Map;
  child1Map.push_back( Property::StringValuePair( "type", "ImageActor" ) );
  child1Map.push_back( Property::StringValuePair( "position", Vector3::YAXIS ) );

  Property::Map child2Map;
  child2Map.push_back( Property::StringValuePair( "type", "TextActor" ) );
  child2Map.push_back( Property::StringValuePair( "position", Vector3::ZAXIS ) );

  Property::Map grandChildMap;
  grandChildMap.push_back( Property::StringValuePair( "type", "LightActor" ) );
  grandChildMap.push_back( Property::StringValuePair( "position", Vector3::ONE ) );

  // Add arrays to appropriate maps
  Property::Array grandChildArray;
  grandChildArray.push_back( grandChildMap );
  Property::Array childArray;
  child1Map.push_back( Property::StringValuePair( "actors", grandChildArray ) );
  childArray.push_back( child1Map );
  childArray.push_back( child2Map );
  map.push_back( Property::StringValuePair( "actors", childArray ) );

  // Create
  Actor handle = NewActor( map );
  DALI_TEST_CHECK( handle );

  Stage::GetCurrent().Add( handle );
  application.SendNotification();
  application.Render();

  DALI_TEST_EQUALS( handle.GetCurrentPosition(), Vector3::XAXIS, TEST_LOCATION );
  DALI_TEST_EQUALS( handle.GetChildCount(), 2u, TEST_LOCATION );

  Actor child1 = handle.GetChildAt(0);
  DALI_TEST_CHECK( child1 );
  DALI_TEST_CHECK( ImageActor::DownCast( child1 ) );
  DALI_TEST_EQUALS( child1.GetCurrentPosition(), Vector3::YAXIS, TEST_LOCATION );
  DALI_TEST_EQUALS( child1.GetChildCount(), 1u, TEST_LOCATION );

  Actor child2 = handle.GetChildAt(1);
  DALI_TEST_CHECK( child2 );
  DALI_TEST_CHECK( TextActor::DownCast( child2 ) );
  DALI_TEST_EQUALS( child2.GetCurrentPosition(), Vector3::ZAXIS, TEST_LOCATION );
  DALI_TEST_EQUALS( child2.GetChildCount(), 0u, TEST_LOCATION );

  Actor grandChild = child1.GetChildAt( 0 );
  DALI_TEST_CHECK( grandChild );
  DALI_TEST_CHECK( LightActor::DownCast( grandChild ) );
  DALI_TEST_EQUALS( grandChild.GetCurrentPosition(), Vector3::ONE, TEST_LOCATION );
  DALI_TEST_EQUALS( grandChild.GetChildCount(), 0u, TEST_LOCATION );

  Stage::GetCurrent().Remove( handle );
  END_TEST;
}
开发者ID:Tarnyko,项目名称:dali-core,代码行数:61,代码来源:utc-Dali-Scripting.cpp


注:本文中的property::Array::push_back方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。