Exemplo n.º 1
0
void *ListIteratorData(const ListIterator *iterator)
{
    if (!iterator)
    {
        return NULL;
    }
    if (IsIteratorValid(iterator))
    {
        // The list has moved forward, the iterator is invalid now
        return NULL;
    }
    return iterator->current->payload;
}
Exemplo n.º 2
0
int ListIteratorLast(ListIterator *iterator)
{
    if (!iterator)
    {
        return -1;
    }
    if (IsIteratorValid(iterator))
    {
        // The list has moved forward, the iterator is invalid now
        return -1;
    }
    iterator->current = iterator->origin->last;
    return 0;
}
Exemplo n.º 3
0
Arquivo: list.c Projeto: nperron/core
bool ListIteratorHasPrevious(const ListIterator *iterator)
{
    if (!iterator)
    {
        return false;
    }
    if (IsIteratorValid(iterator))
    {
        // The list has moved forward, the iterator is invalid now
        return false;
    }
    if (iterator->current->previous)
    {
        return true;
    }
    return false;
}
Exemplo n.º 4
0
int ListIteratorPrevious(ListIterator *iterator)
{
    if (!iterator)
    {
        return -1;
    }
    if (IsIteratorValid(iterator))
    {
        // The list has moved forward, the iterator is invalid now
        return -1;
    }
    // Ok, check if we are at the end
    if (iterator->current && iterator->current->previous)
    {
        iterator->current = iterator->current->previous;
    }
    else
    {
        return -1;
    }
    return 0;
}