Commit b2e2cf64 authored by Ellen Dekkers's avatar Ellen Dekkers

OpenFlipper/BasePlugin: Bugfix base iterator

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5050 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 334e645c
......@@ -154,7 +154,7 @@ DLLEXPORT
bool getObject( const int _identifier , BaseObject*& _object );
/** This functions returns the object with the given id regardless of the type of object.
* See get_object( int _identifier , BaseObject*& _object ) for more details.
* See get_object( int _identifier , ject*& _object ) for more details.
*/
DLLEXPORT
bool getObject( const int _identifier , BaseObjectData*& _object );
......@@ -451,11 +451,6 @@ class DLLEXPORT BaseObjectIterator {
/// Restriction of the iterator
IteratorRestriction restriction_;
/** Takes an object and goes through the object tree to the next BaseObject
* It stops at the root node.
*/
inline void proceedToNextBaseObject(BaseObject*& _object);
};
// /// Return Iterator to Mesh End
......@@ -467,7 +462,7 @@ ObjectIterator objectsEnd();
/// Return Iterator to Object End
DLLEXPORT
ObjectIterator baseObjectsEnd();
BaseObjectIterator baseObjectsEnd();
/** @} */
......
......@@ -59,27 +59,26 @@ BaseObjectIterator::BaseObjectIterator( IteratorRestriction _restriction , DataT
// Start at the root Node
BaseObject* currentPos = objectRoot();
// Take the first element which is an BaseObject
proceedToNextBaseObject(currentPos);
currentPos = currentPos->next();
while ( (currentPos != objectRoot()) ) {
// Return only target objects if requested
if ( (restriction_ == TARGET_OBJECTS) && (! currentPos->target() ) ) {
proceedToNextBaseObject(currentPos);
currentPos = currentPos->next();
continue;
}
// Return only source objects if requested
if ( (restriction_ == SOURCE_OBJECTS) && (! currentPos->source() ) ) {
proceedToNextBaseObject(currentPos);
currentPos = currentPos->next();
continue;
}
// Return only the right dataType
if ( _dataType != DATA_ALL )
if ( ! (currentPos->dataType( dataType_ ) ) ) {
proceedToNextBaseObject(currentPos);
currentPos = currentPos->next();
continue;
}
......@@ -121,25 +120,25 @@ BaseObjectIterator& BaseObjectIterator::operator++() {
BaseObject* currentPos = dynamic_cast< BaseObject* >(pos_);
// Get the next objectData element in the tree
proceedToNextBaseObject(currentPos);
currentPos = currentPos->next();
while ( (currentPos != objectRoot() ) ) {
// Return only target objects if requested
if ( (restriction_ == TARGET_OBJECTS) && (! currentPos->target() ) ) {
proceedToNextBaseObject(currentPos);
currentPos = currentPos->next();
continue;
}
// Return only source objects if requested
if ( (restriction_ == SOURCE_OBJECTS) && (! currentPos->source() ) ) {
proceedToNextBaseObject(currentPos);
currentPos = currentPos->next();
continue;
}
// Return only the right dataType
if ( ! (currentPos->dataType( dataType_ ) ) ) {
proceedToNextBaseObject(currentPos);
currentPos = currentPos->next();
continue;
}
......@@ -168,19 +167,9 @@ BaseObject* BaseObjectIterator::operator*() {
}
/// Return Iterator to Object End
BaseObjectIterator BaseObjectsEnd() {
BaseObjectIterator baseObjectsEnd() {
return BaseObjectIterator(0);
}
void BaseObjectIterator::proceedToNextBaseObject(BaseObject*& _object) {
_object = _object->next();
// Go through the tree and stop at the root node or if we found a BaseObject Object
while ( (_object != objectRoot()) )
_object = _object->next();
}
}
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