예제 #1
0
파일: testlist.cpp 프로젝트: ivandzen/HSDB
Bool testlist::Child::insertAfterFreeChild(const Child & child, const Child & prev)  {
    if(!prev.isExists() || !child.isExists())
        return false;
    Child nxt = prev.getNextChildFreeChild();
    child.setNextChildFreeChild(nxt);
    prev.setNextChildFreeChild(child);
    setNumFreeChilds(getNumFreeChilds() - 1);
    child.setupFreeChildHandler();
    return true;
}
예제 #2
0
파일: testlist.cpp 프로젝트: ivandzen/HSDB
Bool testlist::Child::pushFreeChild(const Child & child)  {
    if( !child.isExists())
        return false;
    child.setNextChildFreeChild(getFirstFreeChild());
    setFirstFreeChild(child);
    setNumFreeChilds(getNumFreeChilds() + 1);
    child.setupFreeChildHandler();
    return true;
}
예제 #3
0
파일: testlist.cpp 프로젝트: ivandzen/HSDB
Bool testlist::Child::removeFreeChild(const Child & child)  {
    if( !child.isExists() )
        return false;
    Child prev;
    Child current;
    for(current = getFirstFreeChild(); current.isValid() && current != child; current = current.getNextChildFreeChild())
        prev = current;
    if(!current.isValid())
    {
        return false; //! data corrupted
    }
    current.removeFreeChildHandler();
    if(prev.isValid())
        prev.setNextChildFreeChild(current.getNextChildFreeChild());
    else
        setFirstFreeChild(current.getNextChildFreeChild());
    current.setNextChildFreeChild(Child());
    setNumFreeChilds(getNumFreeChilds() - 1);
    return true;
}
예제 #4
0
파일: testlist.cpp 프로젝트: ivandzen/HSDB
testlist::Child testlist::Child::popFreeChild()  {
    Child result = getFirstFreeChild();
    if(result.isValid())
    {
        result.removeFreeChildHandler();
        setFirstFreeChild(result.getNextChildFreeChild());
        result.setNextChildFreeChild(Child());
        setNumFreeChilds(getNumFreeChilds() - 1);
    }
    return result;
}