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 );
* @{ */
//=======================================
enum IteratorRestriction {
ALL_OBJECTS,
TARGET_OBJECTS,
SOURCE_OBJECTS
};
typedef QStringList IteratorRestriction;
const QStringList ALL_OBJECTS;
const QStringList TARGET_OBJECTS ("target");
const QStringList SOURCE_OBJECTS ("source");
/** \brief Core Data Iterator
*
......
......@@ -63,16 +63,21 @@ BaseObjectIterator::BaseObjectIterator( IteratorRestriction _restriction , DataT
while ( (currentPos != objectRoot()) ) {
// Return only target objects if requested
if ( (restriction_ == TARGET_OBJECTS) && (! currentPos->target() ) ) {
currentPos = currentPos->next();
continue;
}
// Return only source objects if requested
if ( (restriction_ == SOURCE_OBJECTS) && (! currentPos->source() ) ) {
currentPos = currentPos->next();
continue;
// Return only selected objects if requested
if (!restriction_.isEmpty ()) {
bool found = false;
foreach (QString rest, restriction_)
if (currentPos->flags().contains(rest))
{
found = true;
break;
}
if (!found)
{
currentPos = currentPos->next();
continue;
}
}
// Return only the right dataType
......@@ -124,16 +129,21 @@ BaseObjectIterator& BaseObjectIterator::operator++() {
while ( (currentPos != objectRoot() ) ) {
// Return only target objects if requested
if ( (restriction_ == TARGET_OBJECTS) && (! currentPos->target() ) ) {
currentPos = currentPos->next();
continue;
}
// Return only source objects if requested
if ( (restriction_ == SOURCE_OBJECTS) && (! currentPos->source() ) ) {
currentPos = currentPos->next();
continue;
// Return only selected objects if requested
if (!restriction_.isEmpty ()) {
bool found = false;
foreach (QString rest, restriction_)
if (currentPos->flags().contains(rest))
{
found = true;
break;
}
if (!found)
{
currentPos = currentPos->next();
continue;
}
}
// 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