Updated Dictionary class, added a new method
This commit is contained in:
parent
513007f2da
commit
9bd5329d99
@ -124,6 +124,34 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean remove(int indice)
|
||||
{
|
||||
char indiceToStr[10];
|
||||
sprintf(indiceToStr,"%d", indice);
|
||||
return remove(indiceToStr);
|
||||
}
|
||||
|
||||
boolean removeAt(int index)
|
||||
{
|
||||
unsigned int position(0);
|
||||
if(_head->_next == NULL) return false;
|
||||
|
||||
Dictionary *cursor = _head, *toDelete(NULL);
|
||||
|
||||
while(!isListEmpty(cursor->_next))
|
||||
{
|
||||
if(position++ == index)
|
||||
{
|
||||
toDelete = cursor->_next;
|
||||
cursor->_next = cursor->_next->_next;
|
||||
delete toDelete;
|
||||
return true;
|
||||
}
|
||||
cursor = cursor->_next;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
T* get(const char *parameter)
|
||||
{
|
||||
if(parameter == NULL) return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user