Commit 41c5cff3 authored by Jan Möbius's avatar Jan Möbius

Dennis:

Allow-iteration-over-different-object-flags

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6633 383ad7c9-94d9-4d36-a494-682f7c89f535
parent be2442c1
...@@ -301,11 +301,11 @@ QPoint mapToLocal( const QPoint _point ); ...@@ -301,11 +301,11 @@ QPoint mapToLocal( const QPoint _point );
* @{ */ * @{ */
//======================================= //=======================================
enum IteratorRestriction { typedef QStringList IteratorRestriction;
ALL_OBJECTS,
TARGET_OBJECTS, const QStringList ALL_OBJECTS;
SOURCE_OBJECTS const QStringList TARGET_OBJECTS ("target");
}; const QStringList SOURCE_OBJECTS ("source");
/** \brief Core Data Iterator /** \brief Core Data Iterator
* *
......
...@@ -63,16 +63,21 @@ BaseObjectIterator::BaseObjectIterator( IteratorRestriction _restriction , DataT ...@@ -63,16 +63,21 @@ BaseObjectIterator::BaseObjectIterator( IteratorRestriction _restriction , DataT
while ( (currentPos != objectRoot()) ) { while ( (currentPos != objectRoot()) ) {
// Return only target objects if requested // Return only selected objects if requested
if ( (restriction_ == TARGET_OBJECTS) && (! currentPos->target() ) ) { if (!restriction_.isEmpty ()) {
currentPos = currentPos->next(); bool found = false;
continue; foreach (QString rest, restriction_)
} if (currentPos->flags().contains(rest))
{
// Return only source objects if requested found = true;
if ( (restriction_ == SOURCE_OBJECTS) && (! currentPos->source() ) ) { break;
currentPos = currentPos->next(); }
continue;
if (!found)
{
currentPos = currentPos->next();
continue;
}
} }
// Return only the right dataType // Return only the right dataType
...@@ -124,16 +129,21 @@ BaseObjectIterator& BaseObjectIterator::operator++() { ...@@ -124,16 +129,21 @@ BaseObjectIterator& BaseObjectIterator::operator++() {
while ( (currentPos != objectRoot() ) ) { while ( (currentPos != objectRoot() ) ) {
// Return only target objects if requested // Return only selected objects if requested
if ( (restriction_ == TARGET_OBJECTS) && (! currentPos->target() ) ) { if (!restriction_.isEmpty ()) {
currentPos = currentPos->next(); bool found = false;
continue; foreach (QString rest, restriction_)
} if (currentPos->flags().contains(rest))
{
// Return only source objects if requested found = true;
if ( (restriction_ == SOURCE_OBJECTS) && (! currentPos->source() ) ) { break;
currentPos = currentPos->next(); }
continue;
if (!found)
{
currentPos = currentPos->next();
continue;
}
} }
// Return only the right dataType // Return only the right dataType
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment