if( actor->GetChildCount() > 0 )
{
- for( ActorPtr& child : actor->GetChildrenInternal() )
+ for( auto& child : actor->GetChildrenInternal() )
{
EmitVisibilityChangedSignalRecursively( child, visible, DevelActor::VisibilityChange::PARENT );
}
}
else if( mChildren )
{
- ActorIter end = mChildren->end();
- for( ActorIter iter = mChildren->begin(); iter != end; ++iter )
+ for( const auto& actor : *mChildren )
{
- child = (*iter)->FindChildByName( actorName );
+ child = actor->FindChildByName( actorName );
if( child )
{
}
else if( mChildren )
{
- ActorIter end = mChildren->end();
- for( ActorIter iter = mChildren->begin(); iter != end; ++iter )
+ for( const auto& actor : *mChildren )
{
- child = (*iter)->FindChildById( id );
+ child = actor->FindChildById( id );
if( child )
{
// to guard against GetParent() & Unparent() calls from CustomActor destructors.
if( mChildren )
{
- ActorConstIter endIter = mChildren->end();
- for( ActorIter iter = mChildren->begin(); iter != endIter; ++iter )
+ for( const auto& actor : *mChildren )
{
- (*iter)->SetParent( nullptr );
+ actor->SetParent( nullptr );
}
}
delete mChildren;
RecursiveConnectToScene( connectionList, parentDepth + 1 );
// Notify applications about the newly connected actors.
- const ActorIter endIter = connectionList.end();
- for( ActorIter iter = connectionList.begin(); iter != endIter; ++iter )
+ for( const auto& actor : connectionList )
{
- (*iter)->NotifyStageConnection();
+ actor->NotifyStageConnection();
}
RelayoutRequest();
// Recursively connect children
if( mChildren )
{
- ActorConstIter endIter = mChildren->end();
- for( ActorIter iter = mChildren->begin(); iter != endIter; ++iter )
+ for( const auto& actor : *mChildren )
{
- (*iter)->SetScene( *mScene );
- (*iter)->RecursiveConnectToScene( connectionList, depth + 1 );
+ actor->SetScene( *mScene );
+ actor->RecursiveConnectToScene( connectionList, depth + 1 );
}
}
}
RecursiveDisconnectFromStage( disconnectionList );
// Notify applications about the newly disconnected actors.
- const ActorIter endIter = disconnectionList.end();
- for( ActorIter iter = disconnectionList.begin(); iter != endIter; ++iter )
+ for( const auto& actor : disconnectionList )
{
- (*iter)->NotifyStageDisconnection();
+ actor->NotifyStageDisconnection();
}
}
// Recursively disconnect children
if( mChildren )
{
- ActorConstIter endIter = mChildren->end();
- for( ActorIter iter = mChildren->begin(); iter != endIter; ++iter )
+ for( const auto& child : *mChildren )
{
- (*iter)->RecursiveDisconnectFromStage( disconnectionList );
+ child->RecursiveDisconnectFromStage( disconnectionList );
}
}
// Create/add to children of this node
if( mChildren )
{
- for( ActorContainer::iterator it = mChildren->begin(); it != mChildren->end(); ++it )
+ for( const auto& child : *mChildren )
{
- Actor* childActor = (*it).Get();
+ Actor* childActor = child.Get();
++depthIndex;
childActor->DepthTraverseActorTree( sceneGraphNodeDepths, depthIndex );
}
// Check that we havn't gotten into an infinite loop
ActorDimensionPair searchActor = ActorDimensionPair( this, dimension );
bool recursionFound = false;
- for( ActorDimensionStack::iterator it = recursionStack.begin(), itEnd = recursionStack.end(); it != itEnd; ++it )
+ for( auto& element : recursionStack )
{
- if( *it == searchActor )
+ if( element == searchActor )
{
recursionFound = true;
break;
ActorContainer& siblings = *(mParent->mChildren);
if( siblings.back() != this ) // If not already at end
{
- ActorContainer::iterator iter = std::find( siblings.begin(), siblings.end(), this );
+ auto iter = std::find( siblings.begin(), siblings.end(), this );
if( iter != siblings.end() )
{
siblings.erase(iter);
{
ActorPtr thisPtr(this); // ensure this actor remains referenced.
- ActorContainer::iterator iter = std::find( siblings.begin(), siblings.end(), this );
+ auto iter = std::find( siblings.begin(), siblings.end(), this );
if( iter != siblings.end() )
{
siblings.erase(iter);
{
ActorPtr thisPtr(this); // ensure this actor remains referenced.
- ActorContainer::iterator targetIter = std::find( siblings.begin(), siblings.end(), &target );
- ActorContainer::iterator thisIter = std::find( siblings.begin(), siblings.end(), this );
+ auto targetIter = std::find( siblings.begin(), siblings.end(), &target );
+ auto thisIter = std::find( siblings.begin(), siblings.end(), this );
if( thisIter < targetIter )
{
siblings.erase(thisIter);
{
ActorPtr thisPtr(this); // ensure this actor remains referenced.
- ActorContainer::iterator targetIter = std::find( siblings.begin(), siblings.end(), &target );
- ActorContainer::iterator thisIter = std::find( siblings.begin(), siblings.end(), this );
+ auto targetIter = std::find( siblings.begin(), siblings.end(), &target );
+ auto thisIter = std::find( siblings.begin(), siblings.end(), this );
if( thisIter > targetIter )
{
if( actor->GetChildCount() > 0 )
{
- for( ActorPtr& child : actor->GetChildrenInternal() )
+ for( const auto& child : actor->GetChildrenInternal() )
{
InheritLayoutDirectionRecursively( child, direction );
}
}
// Remove any redundant sub-tree heads
- for( std::vector< Dali::Actor >::iterator it = potentialRedundantSubRoots.begin(), itEnd = potentialRedundantSubRoots.end(); it != itEnd; ++it )
+ for( auto& subRoot : potentialRedundantSubRoots )
{
- Dali::Actor subRoot = *it;
-
RemoveRequest( subRoot );
}
Internal::Actor* actorPtr = &GetImplementation( actor );
// Only add the rootActor if it is not already recorded
- bool found = false;
- for( auto&& item : mDirtyLayoutSubTrees )
- {
- if( item == actorPtr )
- {
- found = true;
- break;
- }
- }
+ auto itr = std::find( mDirtyLayoutSubTrees.begin(), mDirtyLayoutSubTrees.end(), actorPtr );
- if( !found )
+ if( itr == mDirtyLayoutSubTrees.end() )
{
mDirtyLayoutSubTrees.PushBack( actorPtr );
}
{
Internal::Actor* actorPtr = &GetImplementation( actor );
- // Remove actor from dirty sub trees
- for( RawActorList::Iterator it = mDirtyLayoutSubTrees.Begin(), itEnd = mDirtyLayoutSubTrees.End(); it != itEnd; ++it )
- {
- if( *it == actorPtr )
- {
- mDirtyLayoutSubTrees.Erase( it );
- break;
- }
- }
+ mDirtyLayoutSubTrees.Erase( std::remove( mDirtyLayoutSubTrees.begin(),
+ mDirtyLayoutSubTrees.end(),
+ actorPtr ),
+ mDirtyLayoutSubTrees.end() );
}
void RelayoutController::Request()
// 1. Finds all top-level controls from the dirty list and allocate them the size of the scene
// These controls are paired with the parent/scene size and added to the stack.
- for( RawActorList::Iterator it = mDirtyLayoutSubTrees.Begin(), itEnd = mDirtyLayoutSubTrees.End(); it != itEnd; ++it )
+ for( auto& dirtyActor : mDirtyLayoutSubTrees )
{
- Internal::Actor* dirtyActor = *it;
-
// Need to test if actor is valid (could have been deleted and had the pointer cleared)
if( dirtyActor )
{
void RelayoutController::FindAndZero( const RawActorList& list, const Dali::RefObject* object )
{
// Object has been destroyed so clear it from this list
- for( RawActorList::Iterator it = list.Begin(), itEnd = list.End(); it != itEnd; ++it )
+ for( auto& actor : list )
{
- BaseObject* actor = *it;
-
if( actor && ( actor == object ) )
{
- *it = NULL; // Reset the pointer in the list. We don't want to remove it in case something is iterating over the list.
+ actor = nullptr; // Reset the pointer in the list. We don't want to remove it in case something is iterating over the list.
}
}
}