예제 #1
0
void NassiBricksCompositeIterator::Next()
{
    if ( current )
    {
        if ( itr ) // iterator for childs is created
        {
            itr->Next();
            if ( itr->IsDone() ) // reached last in chain
            {
                delete itr;
                itr = nullptr;
                if ( SetItrNextChild() ) //try next in chain
                {
                    current = itr->CurrentItem();
                }
                else // no more chains found
                {
                    SetNext();
                    child = 0;
                    return;
                }
            }
            else // child iterator has a valid item:
                current = itr->CurrentItem();
        }
        else // itr == 0
        {
            if ( current->GetChildCount() > 0 )  // current->nChilds > 0 )
            {
                currentParent = current;
                if ( SetItrNextChild() ) //try next in chain
                {
                    current = itr->CurrentItem();
                }
                else // no more chains found
                {
                    SetNext();
                    child = 0;
                    return;
                }
            }
            else
            {
                SetNext();
                child = 0;
                return;
            }
        }
    }
}
예제 #2
0
void NassiBricksCompositeIterator::Next()
{
    if ( current )
    {
        if ( itr ) // iterator for childs is created
        {
            itr->Next();
            if ( itr->IsDone() ) // letztes in kette erreicht
            {
                delete itr;
                itr = (NassiBricksCompositeIterator *)NULL;
                if ( SetItrNextChild() ) //nächste kette versuchen
                {
                    current = itr->CurrentItem();
                }
                else // keine kette mehr gefunden
                {
                    SetNext();
                    child = 0;
                    return;
                }
            }
            else // child iterator has a valid item:
                current = itr->CurrentItem();
        }
        else // itr == 0
        {
            if ( current->GetChildCount() > 0 )  // current->nChilds > 0 )
            {
                currentParent = current;
                if ( SetItrNextChild() ) //nächste kette versuchen
                {
                    current = itr->CurrentItem();
                }
                else // keine kette mehr gefunden
                {
                    SetNext();
                    child = 0;
                    return;
                }
            }
            else
            {
                SetNext();
                child = 0;
                return;
            }
        }
    }
}
예제 #3
0
bool NassiBricksCompositeIterator::SetItrNextChild()
{
    if ( child < currentParent->GetChildCount() ) //currentParent->nChilds )//not yet iterated throug all childs
    {
        itr = new NassiBricksCompositeIterator(currentParent->GetChild(child));  //(currentParent->childBlocks.Item(child) );// [child]);
        child++;
        if ( !itr->IsDone() )
        {
            current = itr->CurrentItem();
            return(true);
        }
        else//neuer itr nicht gültig
        {
            delete itr;
            itr = nullptr;
            return( SetItrNextChild() );
        }
    }
    else
        return false;
}