Property::IndexContainer indices;
mesh.GetPropertyIndices( indices );
- DALI_TEST_CHECK( ! indices.empty() );
- DALI_TEST_EQUALS( indices.size(), mesh.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_CHECK( indices.Size() );
+ DALI_TEST_EQUALS( indices.Size(), mesh.GetPropertyCount(), TEST_LOCATION );
END_TEST;
}
Property::IndexContainer indices;
meshActor.GetPropertyIndices( indices );
- DALI_TEST_CHECK( indices.size() == basicActor.GetPropertyCount() ); // Mesh Actor does not have any properties
- DALI_TEST_EQUALS( indices.size(), meshActor.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_CHECK( indices.Size() == basicActor.GetPropertyCount() ); // Mesh Actor does not have any properties
+ DALI_TEST_EQUALS( indices.Size(), meshActor.GetPropertyCount(), TEST_LOCATION );
END_TEST;
}
Property::IndexContainer indices;
meshActor.GetPropertyIndices( indices );
- DALI_TEST_CHECK( indices.size() == basicActor.GetPropertyCount() ); // Mesh Actor does not have any properties
- DALI_TEST_EQUALS( indices.size(), meshActor.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_CHECK( indices.Size() == basicActor.GetPropertyCount() ); // Mesh Actor does not have any properties
+ DALI_TEST_EQUALS( indices.Size(), meshActor.GetPropertyCount(), TEST_LOCATION );
END_TEST;
}
DALI_TEST_CHECK(actorObject);
// Check that an invalid command is not performed
- std::vector<Property::Value> attributes;
+ Property::Map attributes;
DALI_TEST_CHECK(actorObject.DoAction("invalidCommand", attributes) == false);
// Check that the actor is visible
// Set the new duration to be 2 seconds
float newDurationSeconds(2.0f);
Property::Value newDurationSecondsValue = Property::Value( newDurationSeconds );
- attributes.push_back(newDurationSecondsValue);
+ attributes["duration"] = newDurationSecondsValue;
// Check the animation performed an action to play itself with the specified duration of 2 seconds
animationObject.DoAction("play", attributes);
actor.GetProperty(CameraActor::Property::INVERT_Y_AXIS).Get(bValue);
DALI_TEST_EQUALS(false, bValue, TEST_LOCATION);
- std::vector<Property::Index> indices ;
+ std::vector<Property::Index> indices;
indices.push_back(CameraActor::Property::TYPE);
indices.push_back(CameraActor::Property::PROJECTION_MODE);
indices.push_back(CameraActor::Property::FIELD_OF_VIEW);
CameraActor actor;
- Dali::Camera::Type cameraType = Dali::Camera::FREE_LOOK ;
+ Dali::Camera::Type cameraType = Dali::Camera::FREE_LOOK;
try
{
cameraType = actor.GetType();
Actor basicActor = Actor::New();
Property::IndexContainer indices;
camera.GetPropertyIndices( indices );
- DALI_TEST_CHECK( indices.size() > basicActor.GetPropertyCount() );
- DALI_TEST_EQUALS( indices.size(), camera.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_CHECK( indices.Size() > basicActor.GetPropertyCount() );
+ DALI_TEST_EQUALS( indices.Size(), camera.GetPropertyCount(), TEST_LOCATION );
END_TEST;
}
void SetDaliProperty(std::string s)
{
- Self().SetProperty(mDaliProperty, s) ;
+ Self().SetProperty(mDaliProperty, s);
}
void TestRelayoutRequest()
{
TestCustomActor custom = TestCustomActor::New();
DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
- custom.SetDaliProperty("yes") ;
+ custom.SetDaliProperty("yes");
DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
DALI_TEST_EQUALS( "OnPropertySet", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
DALI_TEST_CHECK(customActorObject);
- std::vector<Property::Value> attributes;
+ Property::Map attributes;
// Check that an invalid command is not performed
DALI_TEST_CHECK(customActorObject.DoAction("invalidCommand", attributes) == false);
detector.Attach(actor);
- std::vector<Actor> actors = detector.GetAttachedActors();
-
- if (find(actors.begin(), actors.end(), actor) != actors.end())
+ bool found = false;
+ for(size_t i = 0; i < detector.GetAttachedActorCount(); i++)
{
- tet_result(TET_PASS);
+ if( detector.GetAttachedActor(i) == actor )
+ {
+ tet_result(TET_PASS);
+ found = true;
+ }
}
- else
+
+ if(!found)
{
tet_result(TET_FAIL);
}
Actor actor = Actor::New();
detector.Attach(actor);
- std::vector<Actor> actors = detector.GetAttachedActors();
- if (find(actors.begin(), actors.end(), actor) != actors.end())
+ bool found = false;
+ for(size_t i = 0; i < detector.GetAttachedActorCount(); i++)
{
- tet_result(TET_PASS);
+ if( detector.GetAttachedActor(i) == actor )
+ {
+ tet_result(TET_PASS);
+ found = true;
+ }
}
- else
+
+ if(!found)
{
tet_result(TET_FAIL);
}
// Detach and retrieve attached actors again, the vector should be empty.
detector.Detach(actor);
- actors = detector.GetAttachedActors();
- if (actors.empty())
+ found = false;
+ for(size_t i = 0; i < detector.GetAttachedActorCount(); i++)
{
- tet_result(TET_PASS);
+ if( detector.GetAttachedActor(i) == actor )
+ {
+ found = true;
+ }
}
- else
+
+ if(found)
{
tet_result(TET_FAIL);
}
+ else
+ {
+ tet_result(TET_PASS);
+ }
+
END_TEST;
}
detector.Attach(actor);
}
- std::vector<Actor> attachedActors = detector.GetAttachedActors();
- DALI_TEST_EQUALS(actorsToAdd, attachedActors.size(), TEST_LOCATION);
+ DALI_TEST_EQUALS(actorsToAdd, detector.GetAttachedActorCount(), TEST_LOCATION);
// Detach and retrieve attached actors again, the vector should be empty.
detector.DetachAll();
- attachedActors = detector.GetAttachedActors();
- DALI_TEST_EQUALS(true, attachedActors.empty(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0, detector.GetAttachedActorCount(), TEST_LOCATION);
END_TEST;
}
detector.Attach(actor);
}
- std::vector<Actor> attachedActors = detector.GetAttachedActors();
- DALI_TEST_EQUALS(actorsToAdd, attachedActors.size(), TEST_LOCATION);
+ DALI_TEST_EQUALS(actorsToAdd, detector.GetAttachedActorCount(), TEST_LOCATION);
// Detach and retrieve attached actors again, the vector should be empty.
detector.DetachAll();
- attachedActors = detector.GetAttachedActors();
- DALI_TEST_EQUALS(true, attachedActors.empty(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0, detector.GetAttachedActorCount(), TEST_LOCATION);
DALI_TEST_EQUALS(true, gestureManager.WasCalled(TestGestureManager::UnregisterType), TEST_LOCATION);
// Call DetachAll again, there should not be any exception
GestureDetector detector = PanGestureDetector::New();
// Initially there should not be any actors.
- DALI_TEST_EQUALS(0u, detector.GetAttachedActors().size(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0u, detector.GetAttachedActorCount(), TEST_LOCATION);
// Attach one actor
Actor actor1 = Actor::New();
detector.Attach(actor1);
- DALI_TEST_EQUALS(1u, detector.GetAttachedActors().size(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, detector.GetAttachedActorCount(), TEST_LOCATION);
// Attach another actor
Actor actor2 = Actor::New();
detector.Attach(actor2);
- DALI_TEST_EQUALS(2u, detector.GetAttachedActors().size(), TEST_LOCATION);
+ DALI_TEST_EQUALS(2u, detector.GetAttachedActorCount(), TEST_LOCATION);
// Attach another five actors
std::vector<Actor> myActors;
myActors.push_back(actor);
detector.Attach(actor);
}
- DALI_TEST_EQUALS(7u, detector.GetAttachedActors().size(), TEST_LOCATION);
+ DALI_TEST_EQUALS(7u, detector.GetAttachedActorCount(), TEST_LOCATION);
// Detach actor2
detector.Detach(actor2);
- DALI_TEST_EQUALS(6u, detector.GetAttachedActors().size(), TEST_LOCATION);
+ DALI_TEST_EQUALS(6u, detector.GetAttachedActorCount(), TEST_LOCATION);
// Attach actor1 again, count should not increase.
detector.Attach(actor1);
- DALI_TEST_EQUALS(6u, detector.GetAttachedActors().size(), TEST_LOCATION);
+ DALI_TEST_EQUALS(6u, detector.GetAttachedActorCount(), TEST_LOCATION);
// Detach actor2 again, count should not decrease.
detector.Detach(actor2);
- DALI_TEST_EQUALS(6u, detector.GetAttachedActors().size(), TEST_LOCATION);
+ DALI_TEST_EQUALS(6u, detector.GetAttachedActorCount(), TEST_LOCATION);
// Detach actor1.
detector.Detach(actor1);
- DALI_TEST_EQUALS(5u, detector.GetAttachedActors().size(), TEST_LOCATION);
+ DALI_TEST_EQUALS(5u, detector.GetAttachedActorCount(), TEST_LOCATION);
// Create scoped actor, actor should be automatically removed from the detector when it goes out
// of scope.
{
Actor scopedActor = Actor::New();
detector.Attach(scopedActor);
- DALI_TEST_EQUALS(6u, detector.GetAttachedActors().size(), TEST_LOCATION);
+ DALI_TEST_EQUALS(6u, detector.GetAttachedActorCount(), TEST_LOCATION);
}
- DALI_TEST_EQUALS(5u, detector.GetAttachedActors().size(), TEST_LOCATION);
+ DALI_TEST_EQUALS(5u, detector.GetAttachedActorCount(), TEST_LOCATION);
// Detach all so nothing remains.
detector.DetachAll();
- DALI_TEST_EQUALS(0u, detector.GetAttachedActors().size(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0u, detector.GetAttachedActorCount(), TEST_LOCATION);
END_TEST;
}
// Actor
Actor actor = Actor::New();
actor.GetPropertyIndices( indices );
- DALI_TEST_CHECK( ! indices.empty() );
- DALI_TEST_EQUALS( indices.size(), actor.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_CHECK( indices.Size() );
+ DALI_TEST_EQUALS( indices.Size(), actor.GetPropertyCount(), TEST_LOCATION );
END_TEST;
}
Property::IndexContainer indices;
imageActor.GetPropertyIndices( indices );
- DALI_TEST_CHECK( indices.size() > basicActor.GetPropertyCount() );
- DALI_TEST_EQUALS( indices.size(), imageActor.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_CHECK( indices.Size() > basicActor.GetPropertyCount() );
+ DALI_TEST_EQUALS( indices.Size(), imageActor.GetPropertyCount(), TEST_LOCATION );
END_TEST;
}
Layer actor = Layer::New();
- std::vector<Property::Index> indices ;
+ std::vector<Property::Index> indices;
indices.push_back(Layer::Property::CLIPPING_ENABLE);
indices.push_back(Layer::Property::CLIPPING_BOX);
actor.SetProperty(Layer::Property::CLIPPING_BOX, Property::Value(Rect<int>(testBox)));
- DALI_TEST_CHECK(Property::RECTANGLE == actor.GetPropertyType(Layer::Property::CLIPPING_BOX)) ;
+ DALI_TEST_CHECK(Property::RECTANGLE == actor.GetPropertyType(Layer::Property::CLIPPING_BOX));
Property::Value v = actor.GetProperty(Layer::Property::CLIPPING_BOX);
Property::IndexContainer indices;
layer.GetPropertyIndices( indices );
- DALI_TEST_CHECK( indices.size() > basicActor.GetPropertyCount() );
- DALI_TEST_EQUALS( indices.size(), layer.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_CHECK( indices.Size() > basicActor.GetPropertyCount() );
+ DALI_TEST_EQUALS( indices.Size(), layer.GetPropertyCount(), TEST_LOCATION );
END_TEST;
}
///////////////////////////////////////////////////////////////////////////////
namespace
{
-typedef Dali::PanGestureDetector::AngleContainer::size_type AngleSizeType;
-
const int PAN_EVENT_TIME_DELTA = 8;
const int PAN_GESTURE_UPDATE_COUNT = 50;
TestApplication application;
PanGestureDetector detector = PanGestureDetector::New();
- const PanGestureDetector::AngleContainer& angles( detector.GetAngles() );
- DALI_TEST_EQUALS( angles.empty(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetAngleCount(), 0, TEST_LOCATION );
detector.AddAngle( PanGestureDetector::DIRECTION_LEFT, Radian( Math::PI * 0.25 ) );
- DALI_TEST_EQUALS( angles.size(), static_cast<AngleSizeType>(1), TEST_LOCATION );
- for ( PanGestureDetector::AngleContainer::const_iterator iter = angles.begin(), endIter = angles.end(); iter != endIter; ++iter )
+ DALI_TEST_EQUALS( detector.GetAngleCount(), 1, TEST_LOCATION );
+ bool found = false;
+ for( size_t i = 0; i < detector.GetAngleCount(); i++)
{
- if ( iter->first == PanGestureDetector::DIRECTION_LEFT )
+ if( detector.GetAngle(i).first == PanGestureDetector::DIRECTION_LEFT )
{
tet_result( TET_PASS );
+ found = true;
break;
}
+ }
- if ( iter == endIter )
- {
- tet_printf("%s, angle not added\n", TEST_LOCATION );
- tet_result( TET_FAIL );
- }
+ if(!found )
+ {
+ tet_printf("%s, angle not added\n", TEST_LOCATION );
+ tet_result( TET_FAIL );
}
detector.AddAngle( PanGestureDetector::DIRECTION_RIGHT, Radian( Math::PI * 0.25 ) );
- DALI_TEST_EQUALS( angles.size(), static_cast<AngleSizeType>(2), TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetAngleCount(), 2, TEST_LOCATION );
// Remove something not in the container.
detector.RemoveAngle( PanGestureDetector::DIRECTION_UP );
- DALI_TEST_EQUALS( angles.size(), static_cast<AngleSizeType>(2), TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetAngleCount(), 2, TEST_LOCATION );
detector.RemoveAngle( PanGestureDetector::DIRECTION_RIGHT );
- DALI_TEST_EQUALS( angles.size(), static_cast<AngleSizeType>(1), TEST_LOCATION );
- for ( PanGestureDetector::AngleContainer::const_iterator iter = angles.begin(), endIter = angles.end(); iter != endIter; ++iter )
+ DALI_TEST_EQUALS( detector.GetAngleCount(), 1, TEST_LOCATION );
+ for ( size_t i = 0; i < detector.GetAngleCount(); i++)
{
- if ( iter->first == PanGestureDetector::DIRECTION_RIGHT )
+ if ( detector.GetAngle(i).first == PanGestureDetector::DIRECTION_RIGHT )
{
tet_printf("%s, angle not removed\n", TEST_LOCATION );
tet_result( TET_FAIL );
}
detector.ClearAngles();
- DALI_TEST_EQUALS( angles.size(), static_cast<AngleSizeType>(0), TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetAngleCount(), 0, TEST_LOCATION );
END_TEST;
}
TestApplication application;
PanGestureDetector detector = PanGestureDetector::New();
- const PanGestureDetector::AngleContainer& angles( detector.GetAngles() );
- DALI_TEST_EQUALS( angles.empty(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetAngleCount(), 0, TEST_LOCATION );
//
// Angle
//
detector.AddAngle( Degree(180.0f) );
- DALI_TEST_EQUALS( angles.begin()->first, Radian( Degree(-180.0f) ), 0.000001, TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetAngle(0).first, Radian( Degree(-180.0f) ), 0.000001, TEST_LOCATION );
detector.ClearAngles();
detector.AddAngle( Degree(190.0f) );
- DALI_TEST_EQUALS( angles.begin()->first, Radian( Degree(-170.0f) ), 0.000001, TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetAngle(0).first, Radian( Degree(-170.0f) ), 0.000001, TEST_LOCATION );
detector.ClearAngles();
detector.AddAngle( Degree(-190.0f) );
- DALI_TEST_EQUALS( angles.begin()->first, Radian( Degree(170.0f) ), 0.000001, TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetAngle(0).first, Radian( Degree(170.0f) ), 0.000001, TEST_LOCATION );
detector.ClearAngles();
detector.AddAngle( Degree(350.0f) );
- DALI_TEST_EQUALS( angles.begin()->first, Radian( Degree(-10.0f) ), 0.000001, TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetAngle(0).first, Radian( Degree(-10.0f) ), 0.000001, TEST_LOCATION );
detector.ClearAngles();
detector.AddAngle( Degree(-350.0f) );
- DALI_TEST_EQUALS( angles.begin()->first, Radian( Degree(10.0f) ), 0.000001, TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetAngle(0).first, Radian( Degree(10.0f) ), 0.000001, TEST_LOCATION );
detector.ClearAngles();
detector.AddAngle( Degree(370.0f) );
- DALI_TEST_EQUALS( angles.begin()->first, Radian( Degree(10.0f) ), 0.000001, TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetAngle(0).first, Radian( Degree(10.0f) ), 0.000001, TEST_LOCATION );
detector.ClearAngles();
detector.AddAngle( Degree(-370.0f) );
- DALI_TEST_EQUALS( angles.begin()->first, Radian( Degree(-10.0f) ), 0.000001, TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetAngle(0).first, Radian( Degree(-10.0f) ), 0.000001, TEST_LOCATION );
detector.ClearAngles();
//
//
detector.AddAngle( PanGestureDetector::DIRECTION_RIGHT, Degree( 0.0f ) );
- DALI_TEST_EQUALS( angles.begin()->second, Radian( Degree(0.0f) ), 0.000001, TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetAngle(0).second, Radian( Degree(0.0f) ), 0.000001, TEST_LOCATION );
detector.ClearAngles();
detector.AddAngle( PanGestureDetector::DIRECTION_RIGHT, Degree( -10.0f ) );
- DALI_TEST_EQUALS( angles.begin()->second, Radian( Degree(10.0f) ), 0.000001, TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetAngle(0).second, Radian( Degree(10.0f) ), 0.000001, TEST_LOCATION );
detector.ClearAngles();
detector.AddAngle( PanGestureDetector::DIRECTION_RIGHT, Degree( -181.0f ) );
- DALI_TEST_EQUALS( angles.begin()->second, Radian( Degree(180.0f) ), 0.000001, TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetAngle(0).second, Radian( Degree(180.0f) ), 0.000001, TEST_LOCATION );
detector.ClearAngles();
detector.AddAngle( PanGestureDetector::DIRECTION_RIGHT, Degree( 181.0f ) );
- DALI_TEST_EQUALS( angles.begin()->second, Radian( Degree(180.0f) ), 0.000001, TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetAngle(0).second, Radian( Degree(180.0f) ), 0.000001, TEST_LOCATION );
detector.ClearAngles();
END_TEST;
}
TestApplication application;
PanGestureDetector detector = PanGestureDetector::New();
- const PanGestureDetector::AngleContainer& angles( detector.GetAngles() );
- DALI_TEST_EQUALS( angles.empty(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetAngleCount(), 0, TEST_LOCATION );
detector.AddDirection( PanGestureDetector::DIRECTION_LEFT, Radian( Math::PI * 0.25 ) );
- DALI_TEST_EQUALS( angles.size(), static_cast<AngleSizeType>(2), TEST_LOCATION );
- for ( PanGestureDetector::AngleContainer::const_iterator iter = angles.begin(), endIter = angles.end(); iter != endIter; ++iter )
+ DALI_TEST_EQUALS( detector.GetAngleCount(), 2, TEST_LOCATION );
+ bool found = false;
+ for ( size_t i = 0; detector.GetAngleCount(); i++)
{
- if ( iter->first == PanGestureDetector::DIRECTION_LEFT )
+ if ( detector.GetAngle(i).first == PanGestureDetector::DIRECTION_LEFT )
{
tet_result( TET_PASS );
+ found = true;
break;
}
- if ( iter == endIter )
- {
- tet_printf("%s, angle not added\n", TEST_LOCATION );
- tet_result( TET_FAIL );
- }
}
- for ( PanGestureDetector::AngleContainer::const_iterator iter = angles.begin(), endIter = angles.end(); iter != endIter; ++iter )
+ if (!found )
{
- if ( iter->first == PanGestureDetector::DIRECTION_RIGHT )
+ tet_printf("%s, angle not added\n", TEST_LOCATION );
+ tet_result( TET_FAIL );
+ }
+
+ found = false;
+ for( size_t i = 0; i < detector.GetAngleCount(); i++)
+ {
+ if( detector.GetAngle(i).first == PanGestureDetector::DIRECTION_RIGHT )
{
tet_result( TET_PASS );
+ found = true;
break;
}
+ }
- if ( iter == endIter )
- {
- tet_printf("%s, angle not added\n", TEST_LOCATION );
- tet_result( TET_FAIL );
- }
+ if(!found )
+ {
+ tet_printf("%s, angle not added\n", TEST_LOCATION );
+ tet_result( TET_FAIL );
}
// Remove something not in the container.
detector.RemoveDirection( PanGestureDetector::DIRECTION_UP );
- DALI_TEST_EQUALS( angles.size(), static_cast<AngleSizeType>(2), TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetAngleCount(), 2, TEST_LOCATION );
detector.RemoveDirection( PanGestureDetector::DIRECTION_RIGHT );
- DALI_TEST_EQUALS( angles.size(), static_cast<AngleSizeType>(0), TEST_LOCATION );
+ DALI_TEST_EQUALS( detector.GetAngleCount(), 0, TEST_LOCATION );
END_TEST;
}
Property::IndexContainer indices;
detector.GetPropertyIndices( indices );
- DALI_TEST_CHECK( ! indices.empty() );
- DALI_TEST_EQUALS( indices.size(), detector.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_CHECK( indices.Size() );
+ DALI_TEST_EQUALS( indices.Size(), detector.GetPropertyCount(), TEST_LOCATION );
END_TEST;
}
Property::IndexContainer indices;
task.GetPropertyIndices( indices );
- DALI_TEST_CHECK( ! indices.empty() );
- DALI_TEST_EQUALS( indices.size(), task.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_CHECK( indices.Size() );
+ DALI_TEST_EQUALS( indices.Size(), task.GetPropertyCount(), TEST_LOCATION );
END_TEST;
}
Property::IndexContainer indices;
effect.GetPropertyIndices( indices );
- DALI_TEST_CHECK( ! indices.empty() );
- DALI_TEST_EQUALS( indices.size(), effect.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_CHECK( indices.Size() );
+ DALI_TEST_EQUALS( indices.Size(), effect.GetPropertyCount(), TEST_LOCATION );
END_TEST;
}
}
static std::string lastActionCustom;
-bool DoActionCustom(BaseObject* object, const std::string& actionName, const std::vector<Property::Value>& attributes)
+bool DoActionCustom(BaseObject* object, const std::string& actionName, const Property::Map& /*attributes*/)
{
lastActionCustom = actionName;
return true;
END_TEST;
}
-int UtcDaliTypeRegistryGetTypeNamesP(void)
+int UtcDaliTypeRegistryGetTypeNameCountP(void)
{
TestApplication application;
-
+ TypeRegistry typeRegistry = TypeRegistry::Get();
TypeInfo type;
- TypeRegistry::NameContainer names = TypeRegistry::Get().GetTypeNames();
-
- for(TypeRegistry::NameContainer::iterator iter = names.begin();
- iter != names.end(); ++iter)
+ for(size_t i = 0; i < typeRegistry.GetTypeNameCount(); i++)
{
- type = TypeRegistry::Get().GetTypeInfo( *iter );
+ type = typeRegistry.GetTypeInfo( typeRegistry.GetTypeName(i) );
DALI_TEST_CHECK( type );
}
END_TEST;
}
-int UtcDaliTypeRegistryGetTypeNamesN(void)
+
+int UtcDaliTypeRegistryGetTypeNamesP(void)
{
TestApplication application;
-
+ TypeRegistry typeRegistry = TypeRegistry::Get();
TypeInfo type;
- TypeRegistry::NameContainer names = TypeRegistry::Get().GetTypeNames();
-
- for(TypeRegistry::NameContainer::iterator iter = names.begin();
- iter != names.end(); ++iter)
+ for(size_t i = 0; i < typeRegistry.GetTypeNameCount(); i++)
{
- type = TypeRegistry::Get().GetTypeInfo( *iter );
- DALI_TEST_CHECK( type.GetName() != "MyDummyActor" );
+ type = typeRegistry.GetTypeInfo( typeRegistry.GetTypeName(i) );
+ DALI_TEST_CHECK( type );
}
END_TEST;
}
+
// Note: No negative test case for UtcDaliTypeRegistryTypeRegistration can be implemented.
int UtcDaliTypeRegistryTypeRegistrationNotCallingCreateOnInitP(void)
{
MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
DALI_TEST_CHECK( customHandle );
- TypeInfo::NameContainer names;
- type.GetActions(names);
- TypeInfo::NameContainer baseNames;
- baseType.GetActions(baseNames);
- DALI_TEST_EQUALS( names.size(), TEST_ACTION_COUNT + baseNames.size(), TEST_LOCATION );
-
- names.clear();
- type.GetSignals(names);
-
- baseNames.clear();
- baseType.GetSignals(baseNames);
+ DALI_TEST_EQUALS( type.GetActionCount(), TEST_ACTION_COUNT + baseType.GetActionCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( names.size(), TEST_SIGNAL_COUNT + baseNames.size(), TEST_LOCATION );
+ DALI_TEST_EQUALS( type.GetSignalCount(), TEST_SIGNAL_COUNT + baseType.GetSignalCount(), TEST_LOCATION );
{
TestConnectionTracker tracker;
DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
- std::vector<Property::Value> attributes;
+ Property::Map attributes;
handle.DoAction("act1", attributes);
DALI_TEST_CHECK( lastActionCustom == "act1" );
END_TEST;
MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
DALI_TEST_CHECK( customHandle );
- TypeInfo::NameContainer names;
- TypeInfo::NameContainer baseNames;
-
- type.GetActions(names);
- baseType.GetActions(baseNames);
-
- DALI_TEST_EQUALS( names.size(), TEST_ACTION_COUNT + baseNames.size(), TEST_LOCATION );
-
- names.clear();
- baseNames.clear();
-
- type.GetSignals(names);
- baseType.GetSignals(baseNames);
+ DALI_TEST_EQUALS( type.GetActionCount(), TEST_ACTION_COUNT + baseType.GetActionCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( names.size(), TEST_SIGNAL_COUNT + baseNames.size(), TEST_LOCATION );
+ DALI_TEST_EQUALS( type.GetSignalCount(), TEST_SIGNAL_COUNT + baseType.GetSignalCount(), TEST_LOCATION );
{
TestConnectionTracker tracker;
BaseHandle handle = type.CreateInstance();
DALI_TEST_CHECK( handle );
- std::vector<Property::Value> attributes;
+ Property::Map attributes;
DALI_TEST_CHECK( handle.DoAction("act1", attributes) );
DALI_TEST_CHECK( lastActionCustom == "act1" );
BaseHandle handle = type.CreateInstance();
DALI_TEST_CHECK( handle );
- std::vector<Property::Value> attributes;
+ Property::Map attributes;
DALI_TEST_CHECK( !handle.DoAction( "unknown-action", attributes ) );
END_TEST;
// Check property count of type-info is 1
Property::IndexContainer indices;
typeInfo.GetPropertyIndices( indices );
- DALI_TEST_EQUALS( indices.size(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
// check property name count
- TypeInfo::NameContainer names;
- typeInfo.GetProperties(names);
- DALI_TEST_CHECK( 1 == names.size() );
+ DALI_TEST_CHECK( 1 == typeInfo.GetPropertyCount() );
// Ensure indices returned from actor and customActor differ by two
Actor actor = Actor::New();
actor.GetPropertyIndices( indices );
- unsigned int actorIndices = indices.size();
+ unsigned int actorIndices = indices.Size();
customActor.GetPropertyIndices( indices );
- unsigned int customActorIndices = indices.size();
+ unsigned int customActorIndices = indices.Size();
DALI_TEST_EQUALS( actorIndices + 2u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
END_TEST;
}
// Check property count of type-info is 1
Property::IndexContainer indices;
typeInfo.GetPropertyIndices( indices );
- DALI_TEST_EQUALS( indices.size(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
// Ensure indices returned from actor and customActor differ by one
Actor actor = Actor::New();
actor.GetPropertyIndices( indices );
- unsigned int actorIndices = indices.size();
+ unsigned int actorIndices = indices.Size();
customActor.GetPropertyIndices( indices );
- unsigned int customActorIndices = indices.size();
+ unsigned int customActorIndices = indices.Size();
DALI_TEST_EQUALS( actorIndices + 1u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
END_TEST;
// Check property count of type-info is 1
Property::IndexContainer indices;
typeInfo.GetPropertyIndices( indices );
- DALI_TEST_EQUALS( indices.size(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( indices.Size(), 1u, TEST_LOCATION );
// Register animatable property components
std::string animatablePropertyComponentName1( "animatable-prop-1-x" );
// Ensure indices returned from actor and customActor differ by three
Actor actor = Actor::New();
actor.GetPropertyIndices( indices );
- unsigned int actorIndices = indices.size();
+ unsigned int actorIndices = indices.Size();
customActor.GetPropertyIndices( indices );
- unsigned int customActorIndices = indices.size();
+ unsigned int customActorIndices = indices.Size();
DALI_TEST_EQUALS( actorIndices + 3u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
END_TEST;
application.Render(0);
DALI_TEST_CHECK(!a.IsVisible());
- std::vector<Property::Value> attributes;
+ Property::Map attributes;
DALI_TEST_CHECK(hdl.DoAction("show", attributes));
// Default properties
Property::IndexContainer indices;
actor.GetPropertyIndices( indices );
- const Property::IndexContainer::const_iterator endIter = indices.end();
- for ( Property::IndexContainer::iterator iter = indices.begin(); iter != endIter; ++iter )
+ const Property::IndexContainer::ConstIterator endIter = indices.End();
+
+ for ( Property::IndexContainer::Iterator iter = indices.Begin(); iter != endIter; ++iter )
{
map[ actor.GetPropertyName( *iter ) ] = actor.GetProperty( *iter );
}
}
}
+
+DALI_IMPORT_API bool SetRotation( const Property::Value& value, Quaternion& quaternion )
+{
+ bool done = false;
+ Property::Type type = value.GetType();
+ if( Property::VECTOR3 == type )
+ {
+ Vector3 v3;
+ value.Get(v3);
+ quaternion.SetEuler( Radian(Degree(v3.x)), Radian(Degree(v3.y)), Radian(Degree(v3.z)) );
+ done = true;
+ }
+ else if( Property::VECTOR4 == type )
+ {
+ Vector4 v4;
+ value.Get(v4);
+ quaternion = Quaternion(v4);
+ done = true;
+ }
+ else if( Property::ROTATION == type )
+ {
+ value.Get(quaternion);
+ done = true;
+ }
+
+ return done;
+}
+
} // namespace scripting
} // namespace Dali
*/
DALI_IMPORT_API void CreatePropertyMap( Image image, Property::Map& map );
+/**
+ * @brief Sets a quaterion rotation from a script provided value (quaternion,euler vector3,quaternion vector4)
+ *
+ * @param[in] value Propery value
+ * @param[out] quaternion Output Rotation
+ * @return true if quaternion was set
+ */
+DALI_IMPORT_API bool SetRotation( const Property::Value& value, Quaternion& quaternion );
+
}
} // namespace Dali
#include <cmath>
#include <algorithm>
#include <cfloat>
-#include <cstring> // for strcmp
// INTERNAL INCLUDES
struct Actor::RelayoutData
{
RelayoutData()
- : sizeModeFactor( Vector3::ONE ), preferredSize( Vector2::ZERO ), sizeSetPolicy( SizeScalePolicy::USE_SIZE_SET ), relayoutEnabled( false ), insideRelayout( false )
+ : sizeModeFactor( Vector3::ONE ), preferredSize( Vector2::ZERO ), sizeSetPolicy( SizeScalePolicy::USE_SIZE_SET ), relayoutEnabled( false ), insideRelayout( false )
{
// Set size negotiation defaults
for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
bool connected( true );
Actor* actor = dynamic_cast< Actor* >( object );
- if( 0 == strcmp( signalName.c_str(), SIGNAL_TOUCHED ) ) // don't want to convert char* to string
+ if( 0 == signalName.compare( SIGNAL_TOUCHED ) )
{
actor->TouchedSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_HOVERED ) )
+ else if( 0 == signalName.compare( SIGNAL_HOVERED ) )
{
actor->HoveredSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_WHEEL_EVENT ) )
+ else if( 0 == signalName.compare( SIGNAL_WHEEL_EVENT ) )
{
actor->WheelEventSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_ON_STAGE ) )
+ else if( 0 == signalName.compare( SIGNAL_ON_STAGE ) )
{
actor->OnStageSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_OFF_STAGE ) )
+ else if( 0 == signalName.compare( SIGNAL_OFF_STAGE ) )
{
actor->OffStageSignal().Connect( tracker, functor );
}
void Actor::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
{
- indices.reserve( DEFAULT_PROPERTY_COUNT );
+ indices.Reserve( DEFAULT_PROPERTY_COUNT );
for( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
{
- indices.push_back( i );
+ indices.PushBack( i );
}
}
for( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
{
const Internal::PropertyDetails* property = &DEFAULT_PROPERTY_DETAILS[ i ];
- if( 0 == strcmp( name.c_str(), property->name ) ) // dont want to convert rhs to string
+ if( 0 == name.compare( property->name ) )
{
index = i;
break;
return Node::New();
}
-bool Actor::DoAction( BaseObject* object, const std::string& actionName, const std::vector< Property::Value >& attributes )
+bool Actor::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& /* attributes */ )
{
bool done = false;
Actor* actor = dynamic_cast< Actor* >( object );
if( actor )
{
- if( 0 == strcmp( actionName.c_str(), ACTION_SHOW ) ) // dont want to convert char* to string
+ if( 0 == actionName.compare( ACTION_SHOW ) )
{
actor->SetVisible( true );
done = true;
}
- else if( 0 == strcmp( actionName.c_str(), ACTION_HIDE ) )
+ else if( 0 == actionName.compare( ACTION_HIDE ) )
{
actor->SetVisible( false );
done = true;
*/
static bool DoAction( BaseObject* object,
const std::string& actionName,
- const std::vector< Property::Value >& attributes );
+ const Property::Map& attributes );
public:
// For Animation
{
Actor::GetDefaultPropertyIndices( indices ); // Actor class properties
- indices.reserve( indices.size() + DEFAULT_PROPERTY_COUNT );
+ indices.Reserve( indices.Size() + DEFAULT_PROPERTY_COUNT );
int index = DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX;
for ( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i, ++index )
{
- indices.push_back( index );
+ indices.PushBack( index );
}
}
{
RenderableActor::GetDefaultPropertyIndices( indices ); // RenderableActor class properties
- indices.reserve( indices.size() + DEFAULT_PROPERTY_COUNT );
+ indices.Reserve( indices.Size() + DEFAULT_PROPERTY_COUNT );
int index = DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX;
for ( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i, ++index )
{
- indices.push_back( index );
+ indices.PushBack( index );
}
}
#include <dali/internal/event/actors/layer-impl.h>
// EXTERNAL INCLUDES
-#include <cstring> // for strcmp
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
void Layer::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
{
Actor::GetDefaultPropertyIndices( indices ); // Actor class properties
- indices.reserve( indices.size() + DEFAULT_PROPERTY_COUNT );
+ indices.Reserve( indices.Size() + DEFAULT_PROPERTY_COUNT );
int index = DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX;
for ( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i, ++index )
{
- indices.push_back( index );
+ indices.PushBack( index );
}
}
for( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
{
const Internal::PropertyDetails* property = &DEFAULT_PROPERTY_DETAILS[i];
- if( 0 == strcmp( name.c_str(), property->name ) ) // dont want to convert rhs to string
+ if( 0 == name.compare( property->name ) ) // dont want to convert rhs to string
{
index = i + DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX;
break;
return ret;
}
-bool Layer::DoAction( BaseObject* object, const std::string& actionName, const std::vector<Property::Value>& attributes )
+bool Layer::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& /*attributes*/ )
{
bool done = false;
Layer* layer = dynamic_cast<Layer*>( object );
if( layer )
{
- if( 0 == strcmp( actionName.c_str(), ACTION_RAISE ) )
+ if( 0 == actionName.compare( ACTION_RAISE ) )
{
layer->Raise();
done = true;
}
- else if( 0 == strcmp( actionName.c_str(), ACTION_LOWER ) )
+ else if( 0 == actionName.compare( ACTION_LOWER ) )
{
layer->Lower();
done = true;
}
- else if( 0 == strcmp( actionName.c_str(), ACTION_RAISE_TO_TOP ) )
+ else if( 0 == actionName.compare( ACTION_RAISE_TO_TOP ) )
{
layer->RaiseToTop();
done = true;
}
- else if( 0 == strcmp( actionName.c_str(), ACTION_LOWER_TO_BOTTOM ) )
+ else if( 0 == actionName.compare( ACTION_LOWER_TO_BOTTOM ) )
{
layer->LowerToBottom();
done = true;
/**
* @copydoc Dali::Internal::Actor::DoAction()
*/
- static bool DoAction(BaseObject* object, const std::string& actionName, const std::vector<Property::Value>& attributes);
+ static bool DoAction(BaseObject* object, const std::string& actionName, const Property::Map& attributes);
public: // Default property extensions from Object
/**
// CLASS HEADER
#include <dali/internal/event/animation/animation-impl.h>
+#include <dali/public-api/object/property-map.h>
// EXTERNAL INCLUDES
-#include <cstring> // for strcmp
// INTERNAL INCLUDES
#include <dali/public-api/actors/actor.h>
bool connected( true );
Animation* animation = dynamic_cast<Animation*>(object);
- if ( 0 == strcmp( signalName.c_str(), SIGNAL_FINISHED ) )
+ if( 0 == signalName.compare( SIGNAL_FINISHED ) )
{
animation->FinishedSignal().Connect( tracker, functor );
}
TimePeriod(delaySeconds, 0.0f/*immediate*/) ) );
}
-bool Animation::DoAction( BaseObject* object, const std::string& actionName, const std::vector<Property::Value>& attributes )
+bool Animation::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
{
bool done = false;
Animation* animation = dynamic_cast<Animation*>( object );
if( animation )
{
- if( 0 == strcmp( actionName.c_str(), ACTION_PLAY ) )
+ if( 0 == actionName.compare( ACTION_PLAY ) )
{
- if( attributes.size() > 0 )
+ if( Property::Value* value = attributes.Find("duration", Property::FLOAT) )
{
- animation->SetDuration( attributes[0].Get<float>() );
+ animation->SetDuration( value->Get<float>() );
}
animation->Play();
done = true;
}
- else if( 0 == strcmp( actionName.c_str(), ACTION_STOP ) )
+ else if( 0 == actionName.compare( ACTION_STOP ) )
{
animation->Stop();
done = true;
}
- else if( 0 == strcmp( actionName.c_str(), ACTION_PAUSE ) )
+ else if( 0 == actionName.compare( ACTION_PAUSE ) )
{
animation->Pause();
done = true;
* @param[in] attributes The attributes with which to perfrom this action.
* @return true if action was done
*/
- static bool DoAction(BaseObject* object, const std::string& actionName, const std::vector<Property::Value>& attributes);
+ static bool DoAction(BaseObject* object, const std::string& actionName, const Property::Map& attributes);
/**
* This callback is intended for internal use only, to avoid the overhead of using a signal.
void LinearConstrainer::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
{
- indices.reserve( DEFAULT_PROPERTY_COUNT );
+ indices.Reserve( DEFAULT_PROPERTY_COUNT );
for ( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
{
- indices.push_back( i );
+ indices.PushBack( i );
}
}
void PathConstrainer::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
{
- indices.reserve( DEFAULT_PROPERTY_COUNT );
+ indices.Reserve( DEFAULT_PROPERTY_COUNT );
for ( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
{
- indices.push_back( i );
+ indices.PushBack( i );
}
}
void Path::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
{
- indices.reserve( DEFAULT_PROPERTY_COUNT );
+ indices.Reserve( DEFAULT_PROPERTY_COUNT );
for ( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
{
- indices.push_back( i );
+ indices.PushBack( i );
}
}
void Object::GetPropertyIndices( Property::IndexContainer& indices ) const
{
- indices.clear();
+ indices.Clear();
// Default Properties
GetDefaultPropertyIndices( indices );
// Custom Properties
if ( mCustomProperties.Count() > 0 )
{
- indices.reserve( indices.size() + mCustomProperties.Count() );
+ indices.Reserve( indices.Size() + mCustomProperties.Count() );
PropertyMetadataLookup::ConstIterator iter = mCustomProperties.Begin();
const PropertyMetadataLookup::ConstIterator endIter = mCustomProperties.End();
int i=0;
for ( ; iter != endIter; ++iter, ++i )
{
- indices.push_back( PROPERTY_CUSTOM_START_INDEX + i );
+ indices.PushBack( PROPERTY_CUSTOM_START_INDEX + i );
}
}
}
return ret;
}
-bool TypeInfo::DoActionTo(BaseObject *object, const std::string &actionName, const std::vector<Property::Value> &properties)
+ bool TypeInfo::DoActionTo(BaseObject *object, const std::string &actionName, const Property::Map &properties)
{
bool done = false;
return mCreate;
}
-void TypeInfo::GetActions( Dali::TypeInfo::NameContainer& ret ) const
+size_t TypeInfo::GetActionCount() const
{
- for(ActionContainer::const_iterator iter = mActions.begin(); iter != mActions.end(); ++iter)
- {
- ret.push_back(iter->first);
- }
+ size_t count = mActions.size();
Dali::TypeInfo base = Dali::TypeRegistry::Get().GetTypeInfo( mBaseTypeName );
while( base )
{
- for(ActionContainer::const_iterator iter = GetImplementation(base).mActions.begin();
- iter != GetImplementation(base).mActions.end(); ++iter)
- {
- ret.push_back(iter->first);
- }
-
+ count += GetImplementation(base).mActions.size();
base = Dali::TypeRegistry::Get().GetTypeInfo( base.GetBaseName() );
}
+
+ return count;
}
-void TypeInfo::GetSignals(Dali::TypeInfo::NameContainer& ret) const
+std::string TypeInfo::GetActionName(size_t index) const
{
- for(ConnectorContainer::const_iterator iter = mSignalConnectors.begin(); iter != mSignalConnectors.end(); ++iter)
+ std::string name;
+
+ if( index < mActions.size() )
{
- ret.push_back(iter->first);
+ name = mActions[index].first;
}
+ else
+ {
+ size_t count = mActions.size();
+
+ Dali::TypeInfo base = Dali::TypeRegistry::Get().GetTypeInfo( mBaseTypeName );
+ while( base )
+ {
+ size_t baseCount = GetImplementation(base).mActions.size();
+
+ if( index < count + baseCount )
+ {
+ name = GetImplementation(base).mActions[ index - count ].first;
+ break;
+ }
+
+ count += baseCount;
+
+ base = Dali::TypeRegistry::Get().GetTypeInfo( base.GetBaseName() );
+ }
+ }
+
+ return name;
+}
+
+size_t TypeInfo::GetSignalCount() const
+{
+ size_t count = mSignalConnectors.size();
Dali::TypeInfo base = Dali::TypeRegistry::Get().GetTypeInfo( mBaseTypeName );
while( base )
{
- for(ConnectorContainer::const_iterator iter = GetImplementation(base).mSignalConnectors.begin();
- iter != GetImplementation(base).mSignalConnectors.end(); ++iter)
+ count += GetImplementation(base).mSignalConnectors.size();
+ base = Dali::TypeRegistry::Get().GetTypeInfo( base.GetBaseName() );
+ }
+
+ return count;
+}
+
+std::string TypeInfo::GetSignalName(size_t index) const
+{
+ std::string name;
+
+ if( index < mSignalConnectors.size() )
+ {
+ name = mSignalConnectors[index].first;
+ }
+ else
+ {
+ size_t count = mSignalConnectors.size();
+
+ Dali::TypeInfo base = Dali::TypeRegistry::Get().GetTypeInfo( mBaseTypeName );
+ while( base )
{
- ret.push_back(iter->first);
- }
+ size_t baseCount = GetImplementation(base).mSignalConnectors.size();
- base = Dali::TypeRegistry::Get().GetTypeInfo( base.GetBaseName() );
+ if( index < count + baseCount )
+ {
+ name = GetImplementation(base).mSignalConnectors[ index - count ].first;
+ break;
+ }
+
+ count += baseCount;
+
+ base = Dali::TypeRegistry::Get().GetTypeInfo( base.GetBaseName() );
+ }
}
+
+ return name;
}
-void TypeInfo::GetProperties( Dali::TypeInfo::NameContainer& ret ) const
+std::string TypeInfo::GetPropertyName(size_t index) const
{
+ std::string name;
Property::IndexContainer indices;
GetPropertyIndices(indices);
- ret.reserve(indices.size());
-
- for(Property::IndexContainer::iterator iter = indices.begin(); iter != indices.end(); ++iter)
+ if( index < indices.Size() )
{
- const std::string& name = GetPropertyName( *iter );
- if(name.size())
- {
- ret.push_back( name );
- }
- else
- {
- DALI_LOG_WARNING("Property had no name\n");
- }
+ name = GetPropertyName( indices[index] );
}
+
+ return name;
}
+
void TypeInfo::GetPropertyIndices( Property::IndexContainer& indices ) const
{
Dali::TypeInfo base = TypeRegistry::Get()->GetTypeInfo( mBaseTypeName );
if ( ! mRegisteredProperties.empty() )
{
- indices.reserve( indices.size() + mRegisteredProperties.size() );
+ indices.Reserve( indices.Size() + mRegisteredProperties.size() );
const RegisteredPropertyContainer::const_iterator endIter = mRegisteredProperties.end();
for ( RegisteredPropertyContainer::const_iterator iter = mRegisteredProperties.begin(); iter != endIter; ++iter )
{
- indices.push_back( iter->first );
+ indices.PushBack( iter->first );
}
}
}
DALI_ASSERT_ALWAYS( success && "Property component already registered" );
}
-unsigned int TypeInfo::GetPropertyCount() const
+size_t TypeInfo::GetPropertyCount() const
{
- unsigned int count( mRegisteredProperties.size() );
+ size_t count( mRegisteredProperties.size() );
Dali::TypeInfo base = TypeRegistry::Get()->GetTypeInfo( mBaseTypeName );
while ( base )
Dali::TypeInfo::CreateFunction GetCreator() const;
/**
- * @copydoc Dali::TypeInfo::GetActions
+ * @copydoc Dali::TypeInfo::GetActionCount
*/
- void GetActions( Dali::TypeInfo::NameContainer& container ) const;
+ size_t GetActionCount() const;
/**
- * @copydoc Dali::TypeInfo::GetSignals
+ * @copydoc Dali::TypeInfo::GetActionName
*/
- void GetSignals( Dali::TypeInfo::NameContainer& container) const;
+ std::string GetActionName(size_t index) const;
/**
- * @copydoc Dali::TypeInfo::GetProperties
+ * @copydoc Dali::TypeInfo::GetSignalCount
*/
- void GetProperties( Dali::TypeInfo::NameContainer& container) const;
+ size_t GetSignalCount() const;
+
+ /**
+ * @copydoc Dali::TypeInfo::GetSignalName
+ */
+ std::string GetSignalName(size_t index) const;
+
+ /**
+ * @copydoc Dali::TypeInfo::GetPropertyCount
+ */
+ size_t GetPropertyCount() const;
+
+ /**
+ * @copydoc Dali::TypeInfo::GetPropertyName
+ */
+ std::string GetPropertyName(size_t index) const;
/**
* Adds the property indices to the container specified.
* @param [in] properties The arguments of the action
* @return bool If the action could be executed
*/
- bool DoActionTo(BaseObject *object, const std::string &actionName, const std::vector<Property::Value> &properties);
+ bool DoActionTo(BaseObject *object, const std::string &actionName, const Property::Map &properties);
/**
* Connects a callback function with the object's signals.
bool ConnectSignal( BaseObject* object, ConnectionTrackerInterface* connectionTracker, const std::string& signalName, FunctorDelegate* functor );
/**
- * Retrieve the property count for this type.
- * @return The total number of properties.
- */
- unsigned int GetPropertyCount() const;
-
- /**
* Given a property name, retrieve the index.
* @param[in] name The name of the property.
* @return The index associated with that name.
return ret;
}
-Dali::TypeRegistry::NameContainer TypeRegistry::GetTypeNames() const
+size_t TypeRegistry::GetTypeNameCount() const
{
- Dali::TypeRegistry::NameContainer ret;
+ return mRegistryLut.size();
+}
+
+
+std::string TypeRegistry::GetTypeName(size_t index) const
+{
+ std::string name;
- for(RegistryMap::const_iterator iter = mRegistryLut.begin(); iter != mRegistryLut.end(); ++iter)
+ if( index < mRegistryLut.size() )
{
- ret.push_back(iter->first);
+ RegistryMap::const_iterator iter = mRegistryLut.begin();
+ std::advance(iter, index);
+ name = iter->first;
}
- return ret;
+ return name;
}
+
bool TypeRegistry::Register( const std::type_info& theTypeInfo, const std::type_info& baseTypeInfo,
Dali::TypeInfo::CreateFunction createInstance, bool callCreateOnInit )
{
return false;
}
-bool TypeRegistry::DoActionTo( BaseObject * const object, const std::string &actionName, const std::vector<Property::Value> &properties)
+bool TypeRegistry::DoActionTo( BaseObject * const object, const std::string &actionName, const Property::Map &properties)
{
bool done = false;
Dali::TypeInfo GetTypeInfo( const std::type_info& registerType );
/*
- * @copydoc Dali::TypeRegistry::GetTypeNames
+ * @copydoc Dali::TypeRegistry::GetTypeNameCount
*/
- Dali::TypeRegistry::NameContainer GetTypeNames() const;
+ size_t GetTypeNameCount() const;
+
+ /*
+ * @copydoc Dali::TypeRegistry::GetTypeName
+ */
+ std::string GetTypeName(size_t index) const;
/*
* Register a creation function under a unique name.
* @copydoc Dali::Internal::TypeInfo::DoActionTo
* Walks all base types until it finds a doer.
*/
- bool DoActionTo( BaseObject * const object, const std::string &actionName, const std::vector<Property::Value> &properties);
+ bool DoActionTo( BaseObject * const object, const std::string &actionName, const Property::Map& properties);
/**
* @copydoc Dali::BaseHandle::ConnectSignal()
void ShaderEffect::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
{
- indices.reserve( DEFAULT_PROPERTY_COUNT );
+ indices.Reserve( DEFAULT_PROPERTY_COUNT );
for ( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
{
- indices.push_back( i );
+ indices.PushBack( i );
}
}
}
}
-std::vector<Dali::Actor> GestureDetector::GetAttachedActors() const
+size_t GestureDetector::GetAttachedActorCount() const
{
- // Will only be used by Public API.
- // Unlikely that it will be called that often so copying should be OK.
+ return mAttachedActors.size();
+}
- std::vector<Dali::Actor> actors;
+Dali::Actor GestureDetector::GetAttachedActor(size_t index) const
+{
+ Dali::Actor actor;
- for ( GestureDetectorActorContainer::const_iterator iter = mAttachedActors.begin(), endIter = mAttachedActors.end(); iter != endIter; ++iter )
+ if( index < mAttachedActors.size() )
{
- actors.push_back(Dali::Actor(*iter));
+ actor = Dali::Actor( mAttachedActors[index] );
}
- return actors;
+ return actor;
}
bool GestureDetector::IsAttached(Actor& actor) const
void DetachAll();
/**
- * @copydoc Dali::GestureDetector::GetAttachedActors() const
+ * @copydoc Dali::GestureDetector::GetAttachedActorCount() const
*/
- std::vector<Dali::Actor> GetAttachedActors() const;
+ size_t GetAttachedActorCount() const;
+
+ /**
+ * @copydoc Dali::GestureDetector::GetAttachedActor() const
+ */
+ Dali::Actor GetAttachedActor(size_t index) const;
/**
* Returns a const reference to the container of attached actor pointers.
AddAngle( direction, threshold );
}
-const PanGestureDetector::AngleContainer& PanGestureDetector::GetAngles() const
+size_t PanGestureDetector::GetAngleCount() const
{
- return mAngleContainer;
+ return mAngleContainer.size();
}
+PanGestureDetector::AngleThresholdPair PanGestureDetector::GetAngle(size_t index) const
+{
+ PanGestureDetector::AngleThresholdPair ret( Radian(0),Radian(0) );
+
+ if( index < mAngleContainer.size() )
+ {
+ ret = mAngleContainer[index];
+ }
+
+ return ret;
+}
+
+
void PanGestureDetector::ClearAngles()
{
mAngleContainer.clear();
void PanGestureDetector::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
{
- indices.reserve( DEFAULT_PROPERTY_COUNT );
+ indices.Reserve( DEFAULT_PROPERTY_COUNT );
int index = DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX;
for ( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i, ++index )
{
- indices.push_back( index );
+ indices.PushBack( index );
}
}
{
public: // Typedefs
- typedef Dali::PanGestureDetector::AngleContainer AngleContainer;
typedef Dali::PanGestureDetector::AngleThresholdPair AngleThresholdPair;
+ typedef std::vector<AngleThresholdPair> AngleContainer;
public: // Creation
void AddDirection( Radian direction, Radian threshold );
/**
- * @copydoc Dali::PanGestureDetector::GetAngles()
+ * @copydoc Dali::PanGestureDetector::GetAngleCount()
*/
- const AngleContainer& GetAngles() const;
+ size_t GetAngleCount() const;
+
+ /**
+ * @copydoc Dali::PanGestureDetector::GetAngle()
+ */
+ AngleThresholdPair GetAngle(size_t index) const;
/**
* @copydoc Dali::PanGestureDetector::ClearAngles()
void AnimatableMesh::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
{
- indices.reserve( mPropertyCount );
+ indices.Reserve( mPropertyCount );
for ( int i = 0; i < mPropertyCount; ++i )
{
- indices.push_back( i );
+ indices.PushBack( i );
}
}
void RenderTask::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
{
- indices.reserve( DEFAULT_PROPERTY_COUNT );
+ indices.Reserve( DEFAULT_PROPERTY_COUNT );
for ( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
{
- indices.push_back( i );
+ indices.PushBack( i );
}
}
GetImplementation(*this).DetachAll();
}
-std::vector<Actor> GestureDetector::GetAttachedActors() const
+size_t GestureDetector::GetAttachedActorCount() const
{
- return GetImplementation(*this).GetAttachedActors();
+ return GetImplementation(*this).GetAttachedActorCount();
+}
+
+Actor GestureDetector::GetAttachedActor(size_t index) const
+{
+ return GetImplementation(*this).GetAttachedActor(index);
}
} // namespace Dali
void DetachAll();
/**
- * @brief Returns a vector of actors attached to the gesture detector.
+ * @brief Returns the number of actors attached to the gesture detector.
*
- * @return The attached actor vector.
+ * @return The count
* @pre The gesture detector has been initialized.
*/
- std::vector<Actor> GetAttachedActors() const;
+ size_t GetAttachedActorCount() const;
+
+ /**
+ * @brief Returns an actor by index. An empty handle if the index is not valid.
+ *
+ * @return The attached actor or an empty handle.
+ * @pre The gesture detector has been initialized.
+ */
+ Actor GetAttachedActor(size_t index) const;
protected:
GetImplementation(*this).AddDirection( direction, threshold );
}
-const PanGestureDetector::AngleContainer& PanGestureDetector::GetAngles() const
+size_t PanGestureDetector::GetAngleCount() const
{
- return GetImplementation(*this).GetAngles();
+ return GetImplementation(*this).GetAngleCount();
+}
+
+PanGestureDetector::AngleThresholdPair PanGestureDetector::GetAngle(size_t index) const
+{
+ return GetImplementation(*this).GetAngle(index);
}
void PanGestureDetector::ClearAngles()
// Directional Pan
typedef std::pair< Radian, Radian > AngleThresholdPair; ///< Range of angles for a direction
- typedef std::vector< AngleThresholdPair > AngleContainer; ///< Group of angular thresholds for all directions
static const Radian DIRECTION_LEFT; ///< For a left pan (-PI Radians).
static const Radian DIRECTION_RIGHT; ///< For a right pan (0 Radians).
void AddDirection( Radian direction, Radian threshold = DEFAULT_THRESHOLD );
/**
- * @brief Returns the container of all the angles this pan gesture detector emits a signal.
+ * @brief Returns the count of angles that this pan gesture detector emits a signal.
*
- * @return a const reference to the container of all the angles.
+ * @return The count.
* @pre The gesture detector has been initialized.
*/
- const AngleContainer& GetAngles() const;
+ size_t GetAngleCount() const;
+
+ /**
+ * @brief Returns the angle by index that this pan gesture detector emits a signal.
+ *
+ * @return an angle threshold pair, or a zero valued angle pair when index is invalid.
+ * @pre The gesture detector has been initialized.
+ * @pre The index is less than GetAngleCount()
+ */
+ AngleThresholdPair GetAngle(size_t index) const;
/**
* @brief Clears any directional angles that are used by the gesture detector.
return *this;
}
-bool BaseHandle::DoAction(const std::string& command, const std::vector<Property::Value>& attributes)
+bool BaseHandle::DoAction(const std::string& command, const Property::Map& attributes)
{
return GetImplementation(*this).DoAction( command, attributes );
}
* @param [in] attributes The list of attributes for the action.
* @return The action is performed by the object or not.
*/
- bool DoAction(const std::string& actionName, const std::vector<Property::Value>& attributes);
+ bool DoAction(const std::string& actionName, const Property::Map& attributes);
/**
* @brief Returns the type name for the Handle.
}
}
-bool BaseObject::DoAction(const std::string& actionName, const std::vector<Property::Value>& attributes)
+bool BaseObject::DoAction(const std::string& actionName, const Property::Map& attributes)
{
Dali::Internal::TypeRegistry* registry = Dali::Internal::TypeRegistry::Get();
/**
* @copydoc Dali::BaseHandle::DoAction
*/
- bool DoAction(const std::string& actionName, const std::vector<Property::Value>& attributes);
+ bool DoAction(const std::string& actionName, const Property::Map& attributes);
/**
* @copydoc Dali::BaseHandle::GetTypeName
return NULL; // Not found
}
+Property::Value* Property::Map::Find( const std::string& key, Property::Type type ) const
+{
+ for ( Container::iterator iter = mImpl->mContainer.begin(), endIter = mImpl->mContainer.end(); iter != endIter; ++iter )
+ {
+ // test type first to shortcut eval (possibly reducing string compares)
+ if( (iter->second.GetType() == type) && (iter->first == key) )
+ {
+ return &iter->second;
+ }
+ }
+ return NULL; // Not found
+}
+
void Property::Map::Clear()
{
mImpl->mContainer.clear();
Value* Find( const std::string& key ) const;
/**
+ * @brief Finds the value for the specified key if it exists and its type is type
+ *
+ * @param[in] key The key to find.
+ * @param[in] type The type to check.
+ *
+ * @return A const pointer to the value if it exists, NULL otherwise
+ */
+ Value* Find( const std::string& key, Property::Type type ) const;
+
+ /**
* @brief Clears the map.
*/
void Clear();
// INTERNAL INCLUDES
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/common/dali-vector.h>
namespace Dali
{
static const int INVALID_INDEX; ///< -1 is not a valid property index
static const int INVALID_COMPONENT_INDEX; ///< -1 is not a valid property index
- typedef std::vector< Index > IndexContainer; ///< A vector of property indices
+ typedef Dali::Vector< Index > IndexContainer; ///< A vector of property indices
/**
* @brief A value-type representing a property value.
return GetImplementation(*this).GetCreator();
}
-void TypeInfo::GetActions( TypeInfo::NameContainer& container ) const
+size_t TypeInfo::GetActionCount() const
{
- GetImplementation(*this).GetActions( container );
+ return GetImplementation(*this).GetActionCount();
}
-void TypeInfo::GetSignals( TypeInfo::NameContainer& container ) const
+std::string TypeInfo::GetActionName(size_t index)
{
- GetImplementation(*this).GetSignals( container );
+ return GetImplementation(*this).GetActionName(index);
}
-void TypeInfo::GetProperties( TypeInfo::NameContainer& container ) const
+size_t TypeInfo::GetSignalCount() const
{
- GetImplementation(*this).GetProperties( container );
+ return GetImplementation(*this).GetSignalCount();
}
+std::string TypeInfo::GetSignalName(size_t index)
+{
+ return GetImplementation(*this).GetSignalName(index);
+}
+
+size_t TypeInfo::GetPropertyCount() const
+{
+ return GetImplementation(*this).GetPropertyCount();
+}
+
+std::string TypeInfo::GetPropertyName(size_t index)
+{
+ return GetImplementation(*this).GetPropertyName(index);
+}
+
+
void TypeInfo::GetPropertyIndices( Property::IndexContainer& indices ) const
{
- indices.clear(); // We do not want to clear the container if called internally, so only clear here
+ indices.Clear(); // We do not want to clear the container if called internally, so only clear here
GetImplementation(*this).GetPropertyIndices( indices );
}
class TypeInfo;
};
-typedef std::vector<Property::Value> PropertyValueContainer;
-typedef PropertyValueContainer::iterator PropertyValueIter; ///< Iterator for Dali::PropertyValueContainer
-typedef PropertyValueContainer::const_iterator PropertyValueConstIter; ///< Const iterator for Dali::PropertyValueContainer
-
/**
* @brief TypeInfo class for instantiation of registered types and introspection of
* their actions and signals.
public:
typedef BaseHandle (*CreateFunction)(); ///< Function signature for creating an instance of the associated object type.
- typedef bool (*ActionFunction)(BaseObject*, const std::string&, const PropertyValueContainer&); ///< Function signature for creating scriptable actions
+ typedef bool (*ActionFunction)(BaseObject*, const std::string&, const Property::Map&); ///< Function signature for creating scriptable actions
/**
* @brief Connects a callback function with the object's signals.
*/
typedef Property::Value (*GetPropertyFunction)( BaseObject* object, Property::Index index );
- typedef std::vector<std::string> NameContainer; ///< Container of names for signals and actions
-
/**
* @brief Allows the creation of an empty TypeInfo handle.
*/
CreateFunction GetCreator() const;
/**
- * @brief Retrieve the actions for this type.
+ * @brief Retrieve the number of actions for this type.
+ *
+ * @return The count
+ */
+ size_t GetActionCount() const;
+
+ /**
+ * @brief Retrieve the action name for the index.
+ *
+ * @param[in] index Index to lookup
+ * @return action name or empty string where index is invalid
+ */
+ std::string GetActionName(size_t index);
+
+ /**
+ * @brief Retrieve the number of signals for this type.
*
- * @param[in] container of action names
+ * @return The count
*/
- void GetActions( NameContainer &container ) const;
+ size_t GetSignalCount() const;
/**
- * @brief Retrieve the signals for this type.
+ * @brief Retrieve the signal name for the index.
+ *
+ * @param[in] index Index to lookup
+ * @return signal name or empty string where index is invalid
+ */
+ std::string GetSignalName(size_t index);
+
+/**
+ * @brief Retrieve the number of propertys for this type.
*
- * @param[in] container of action names
+ * @return The count
*/
- void GetSignals( NameContainer &container ) const;
+ size_t GetPropertyCount() const;
/**
- * @brief Retrieve the event side registered properties for this type.
+ * @brief Retrieve the property name for the index.
*
- * @param[in] container of action names
+ * @param[in] index Index to lookup
+ * @return property name or empty string where index is invalid
*/
- void GetProperties( NameContainer &container ) const;
+ std::string GetPropertyName(size_t index);
// Properties
return GetImplementation(*this).GetTypeInfo( registerType );
}
-TypeRegistry::NameContainer TypeRegistry::GetTypeNames() const
+size_t TypeRegistry::GetTypeNameCount() const
{
- return GetImplementation(*this).GetTypeNames();
+ return GetImplementation(*this).GetTypeNameCount();
+}
+
+std::string TypeRegistry::GetTypeName(size_t index) const
+{
+ return GetImplementation(*this).GetTypeName(index);
}
TypeRegistry::TypeRegistry(Internal::TypeRegistry* internal)
class DALI_IMPORT_API TypeRegistry : public BaseHandle
{
public:
- typedef std::vector<std::string> NameContainer; ///< Container of type names
-
/**
* @brief Get Type Registry handle.
*
TypeInfo GetTypeInfo( const std::type_info& registerType );
/**
- * @brief Get type names.
+ * @brief Get type name count.
+ *
+ * @return The count
+ */
+ size_t GetTypeNameCount() const;
+
+ /**
+ * @brief Get type names by index.
*
- * @return list of known types by name
+ * @return The type name or an empty string when index is not valid
*/
- NameContainer GetTypeNames() const;
+ std::string GetTypeName(size_t index) const;
public: // Not intended for application developers