本文整理汇总了C++中property::Map::end方法的典型用法代码示例。如果您正苦于以下问题:C++ Map::end方法的具体用法?C++ Map::end怎么用?C++ Map::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类property::Map
的用法示例。
在下文中一共展示了Map::end方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetType
Property::Value& Property::Value::GetValue(const std::string& key) const
{
DALI_ASSERT_DEBUG(Property::MAP == GetType() && "Property type invalid");
Property::Map *container = AnyCast<Property::Map>(&(mImpl->mValue));
DALI_ASSERT_DEBUG(container);
if(container)
{
for(Property::Map::iterator iter = container->begin(); iter != container->end(); ++iter)
{
if(iter->first == key)
{
return iter->second;
}
}
}
DALI_LOG_WARNING("Cannot find property map key %s", key.c_str());
DALI_ASSERT_ALWAYS(!"Cannot find property map key");
// should never return this
static Property::Value null;
return null;
}
示例2: switch
void Property::Value::SetItem(const int index, const Property::Value &value)
{
switch( GetType() )
{
case Property::MAP:
{
Property::Map *container = AnyCast<Property::Map>(&(mImpl->mValue));
if( container && index < static_cast<int>(container->size()) )
{
int i = 0;
for(Property::Map::iterator iter = container->begin(); iter != container->end(); ++iter)
{
if(i++ == index)
{
iter->second = value;
break;
}
}
}
}
break;
case Property::ARRAY:
{
Property::Array *container = AnyCast<Property::Array>(&(mImpl->mValue));
if( container && index < static_cast<int>(container->size()) )
{
(*container)[index] = value;
}
}
break;
case Property::NONE:
case Property::BOOLEAN:
case Property::FLOAT:
case Property::INTEGER:
case Property::UNSIGNED_INTEGER:
case Property::VECTOR2:
case Property::VECTOR3:
case Property::VECTOR4:
case Property::MATRIX3:
case Property::MATRIX:
case Property::RECTANGLE:
case Property::ROTATION:
case Property::STRING:
case Property::TYPE_COUNT:
{
DALI_ASSERT_ALWAYS(!"Cannot SetItem on property Type; not a container");
break;
}
}
}
示例3:
bool Property::Value::HasKey(const std::string& key) const
{
bool has = false;
if( Property::MAP == GetType() )
{
Property::Map *container = AnyCast<Property::Map>(&(mImpl->mValue));
DALI_ASSERT_DEBUG(container && "Property::Map has no container?");
if(container)
{
for(Property::Map::iterator iter = container->begin(); iter != container->end(); ++iter)
{
if(iter->first == key)
{
has = true;
}
}
}
}
return has;
}
示例4: UtcDaliScriptingNewActorProperties
int UtcDaliScriptingNewActorProperties(void)
{
TestApplication application;
Property::Map map;
map.push_back( Property::StringValuePair( "type", "Actor" ) );
map.push_back( Property::StringValuePair( "size", Vector3::ONE ) );
map.push_back( Property::StringValuePair( "position", Vector3::XAXIS ) );
map.push_back( Property::StringValuePair( "scale", Vector3::ONE ) );
map.push_back( Property::StringValuePair( "visible", false ) );
map.push_back( Property::StringValuePair( "color", Color::MAGENTA ) );
map.push_back( Property::StringValuePair( "name", "MyActor" ) );
map.push_back( Property::StringValuePair( "color-mode", "USE_PARENT_COLOR" ) );
map.push_back( Property::StringValuePair( "inherit-shader-effect", false ) );
map.push_back( Property::StringValuePair( "sensitive", false ) );
map.push_back( Property::StringValuePair( "leave-required", true ) );
map.push_back( Property::StringValuePair( "position-inheritance", "DONT_INHERIT_POSITION" ) );
map.push_back( Property::StringValuePair( "draw-mode", "STENCIL" ) );
map.push_back( Property::StringValuePair( "inherit-rotation", false ) );
map.push_back( Property::StringValuePair( "inherit-scale", false ) );
// Default properties
{
Actor handle = NewActor( map );
DALI_TEST_CHECK( handle );
Stage::GetCurrent().Add( handle );
application.SendNotification();
application.Render();
DALI_TEST_EQUALS( handle.GetCurrentSize(), Vector3::ONE, TEST_LOCATION );
DALI_TEST_EQUALS( handle.GetCurrentPosition(), Vector3::XAXIS, TEST_LOCATION );
DALI_TEST_EQUALS( handle.GetCurrentScale(), Vector3::ONE, TEST_LOCATION );
DALI_TEST_EQUALS( handle.IsVisible(), false, TEST_LOCATION );
DALI_TEST_EQUALS( handle.GetCurrentColor(), Color::MAGENTA, TEST_LOCATION );
DALI_TEST_EQUALS( handle.GetName(), "MyActor", TEST_LOCATION );
DALI_TEST_EQUALS( handle.GetColorMode(), USE_PARENT_COLOR, TEST_LOCATION );
DALI_TEST_EQUALS( handle.GetInheritShaderEffect(), false, TEST_LOCATION );
DALI_TEST_EQUALS( handle.IsSensitive(), false, TEST_LOCATION );
DALI_TEST_EQUALS( handle.GetLeaveRequired(), true, TEST_LOCATION );
DALI_TEST_EQUALS( handle.GetPositionInheritanceMode(), DONT_INHERIT_POSITION, TEST_LOCATION );
DALI_TEST_EQUALS( handle.GetDrawMode(), DrawMode::STENCIL, TEST_LOCATION );
DALI_TEST_EQUALS( handle.IsRotationInherited(), false, TEST_LOCATION );
DALI_TEST_EQUALS( handle.IsScaleInherited(), false, TEST_LOCATION );
Stage::GetCurrent().Remove( handle );
}
// Check Anchor point and parent origin vector3s
map.push_back( Property::StringValuePair( "parent-origin", ParentOrigin::TOP_CENTER ) );
map.push_back( Property::StringValuePair( "anchor-point", AnchorPoint::TOP_LEFT ) );
{
Actor handle = NewActor( map );
DALI_TEST_CHECK( handle );
Stage::GetCurrent().Add( handle );
application.SendNotification();
application.Render();
DALI_TEST_EQUALS( handle.GetCurrentParentOrigin(), ParentOrigin::TOP_CENTER, TEST_LOCATION );
DALI_TEST_EQUALS( handle.GetCurrentAnchorPoint(), AnchorPoint::TOP_LEFT, TEST_LOCATION );
Stage::GetCurrent().Remove( handle );
}
// Check Anchor point and parent origin STRINGS
map.erase( map.end() - 2, map.end() ); // delete previously added parent origin and anchor point
map.push_back( Property::StringValuePair( "parent-origin", "BACK_TOP_LEFT" ) );
map.push_back( Property::StringValuePair( "anchor-point", "FRONT_CENTER_LEFT" ) );
{
Actor handle = NewActor( map );
DALI_TEST_CHECK( handle );
Stage::GetCurrent().Add( handle );
application.SendNotification();
application.Render();
DALI_TEST_EQUALS( handle.GetCurrentParentOrigin(), ParentOrigin::BACK_TOP_LEFT, TEST_LOCATION );
DALI_TEST_EQUALS( handle.GetCurrentAnchorPoint(), AnchorPoint::FRONT_CENTER_LEFT, TEST_LOCATION );
Stage::GetCurrent().Remove( handle );
}
END_TEST;
}
示例5: UtcDaliScriptingNewImage
int UtcDaliScriptingNewImage(void)
{
TestApplication application;
Property::Map map;
map.push_back( Property::StringValuePair( "filename", "TEST_FILE" ) );
// Filename only
{
Image image = NewImage( map );
DALI_TEST_EQUALS( "TEST_FILE", image.GetFilename(), TEST_LOCATION );
}
// load-policy
map.push_back( Property::StringValuePair( "load-policy", "" ) );
{
const StringEnum values[] =
{
{ "IMMEDIATE", Image::Immediate },
{ "ON_DEMAND", Image::OnDemand }
};
TestEnumStrings< Image::LoadPolicy, Image >( map, values, ( sizeof( values ) / sizeof ( values[0] ) ), &Image::GetLoadPolicy, &NewImage );
}
// release-policy
map.push_back( Property::StringValuePair( "release-policy", "" ) );
{
const StringEnum values[] =
{
{ "UNUSED", Image::Unused },
{ "NEVER", Image::Never }
};
TestEnumStrings< Image::ReleasePolicy, Image >( map, values, ( sizeof( values ) / sizeof ( values[0] ) ), &Image::GetReleasePolicy, &NewImage );
}
// float width and height
map.push_back( Property::StringValuePair( "width", (float) 10.0f ) );
map.push_back( Property::StringValuePair( "height", (float) 20.0f ) );
{
Image image = NewImage( map );
DALI_TEST_EQUALS( image.GetWidth(), 10.0f, TEST_LOCATION );
DALI_TEST_EQUALS( image.GetHeight(), 20.0f, TEST_LOCATION );
}
// int width and height
map.erase( map.end() - 2, map.end() );
map.push_back( Property::StringValuePair( "width", 50 ) );
map.push_back( Property::StringValuePair( "height", 70 ) );
{
Image image = NewImage( map );
DALI_TEST_EQUALS( image.GetWidth(), 50u, TEST_LOCATION );
DALI_TEST_EQUALS( image.GetHeight(), 70u, TEST_LOCATION );
}
//map.erase( map.end() - 2, map.end() );
// pixel-format
map.push_back( Property::StringValuePair( "pixel-format", "" ) );
{
const StringEnum values[] =
{
{ "A8", Pixel::A8 },
{ "L8", Pixel::L8 },
{ "LA88", Pixel::LA88 },
{ "RGB565", Pixel::RGB565 },
{ "BGR565", Pixel::BGR565 },
{ "RGBA4444", Pixel::RGBA4444 },
{ "BGRA4444", Pixel::BGRA4444 },
{ "RGBA5551", Pixel::RGBA5551 },
{ "BGRA5551", Pixel::BGRA5551 },
{ "RGB888", Pixel::RGB888 },
{ "RGB8888", Pixel::RGB8888 },
{ "BGR8888", Pixel::BGR8888 },
{ "RGBA8888", Pixel::RGBA8888 },
{ "BGRA8888", Pixel::BGRA8888 },
{ "COMPRESSED_R11_EAC", Pixel::COMPRESSED_R11_EAC },
{ "COMPRESSED_SIGNED_R11_EAC", Pixel::COMPRESSED_SIGNED_R11_EAC },
{ "COMPRESSED_RG11_EAC", Pixel::COMPRESSED_RG11_EAC },
{ "COMPRESSED_SIGNED_RG11_EAC", Pixel::COMPRESSED_SIGNED_RG11_EAC },
{ "COMPRESSED_RGB8_ETC2", Pixel::COMPRESSED_RGB8_ETC2 },
{ "COMPRESSED_SRGB8_ETC2", Pixel::COMPRESSED_SRGB8_ETC2 },
{ "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2", Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 },
{ "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2", Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 },
{ "COMPRESSED_RGBA8_ETC2_EAC", Pixel::COMPRESSED_RGBA8_ETC2_EAC },
{ "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC", Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC },
{ "COMPRESSED_RGB8_ETC1", Pixel::COMPRESSED_RGB8_ETC1 },
{ "COMPRESSED_RGB_PVRTC_4BPPV1", Pixel::COMPRESSED_RGB_PVRTC_4BPPV1 },
{ "A8", Pixel::A8 }, // Checked already but reset so that BitmapImage works
};
TestEnumStrings< Pixel::Format, ImageAttributes >( map, values, ( sizeof( values ) / sizeof ( values[0] ) ), &ImageAttributes::GetPixelFormat, &NewImageAttributes );
}
// scaling-mode
map.push_back( Property::StringValuePair( "scaling-mode", "" ) );
{
const StringEnum values[] =
{
{ "SHRINK_TO_FIT", ImageAttributes::ShrinkToFit },
{ "SCALE_TO_FILL", ImageAttributes::ScaleToFill },
{ "FIT_WIDTH", ImageAttributes::FitWidth },
//.........这里部分代码省略.........