Nibbler::backN

- Added a method to support multi-byte backstep through a string.
- Added unit tests.
This commit is contained in:
Paul Beckingham 2013-08-31 16:02:51 -04:00
parent 2281c5a6bf
commit 663c82837c
3 changed files with 28 additions and 4 deletions

View file

@ -1077,6 +1077,18 @@ bool Nibbler::skipRx (const std::string& regex)
}
#endif
////////////////////////////////////////////////////////////////////////////////
bool Nibbler::backN (const int quantity /*= 1*/)
{
if (_cursor >= quantity)
{
_cursor -= quantity;
return true;
}
return false;
}
////////////////////////////////////////////////////////////////////////////////
void Nibbler::getRemainder (std::string& result)
{

View file

@ -93,6 +93,8 @@ public:
bool skipRx (const std::string&);
#endif
bool backN (const int quantity = 1);
void getRemainder (std::string&);
char next ();