Extend 'Token::deleteNext' by introducing a new parameter which determines how many tokens should be deleted. It's still not used, though.

This commit is contained in:
Edoardo Prezioso 2011-12-07 23:36:11 +01:00
parent 5cc5330d95
commit 76972e8dd3
3 changed files with 10 additions and 6 deletions

View File

@ -2,6 +2,7 @@ The cppcheck team, in alphabetical order:
Bill Egert Bill Egert
Daniel Marjamäki Daniel Marjamäki
Edoardo Prezioso
Gianluca Scacco Gianluca Scacco
Greg Hewgill Greg Hewgill
Hoang Tuan Su Hoang Tuan Su

View File

@ -121,11 +121,14 @@ std::string Token::strValue() const
return _str.substr(1, _str.length() - 2); return _str.substr(1, _str.length() - 2);
} }
void Token::deleteNext() void Token::deleteNext(unsigned long index)
{ {
Token *n = _next; while(_next && index--) {
_next = n->next(); Token *n = _next;
delete n; _next = n->next();
delete n;
}
if (_next) if (_next)
_next->previous(this); _next->previous(this);
else if (tokensBack) else if (tokensBack)

View File

@ -59,9 +59,9 @@ public:
} }
/** /**
* Unlink and delete next token. * Unlink and delete the next 'index' tokens.
*/ */
void deleteNext(); void deleteNext(unsigned long index = 1);
/** /**
* Returns token in given index, related to this token. * Returns token in given index, related to this token.