- Implemented Nibbler::getN, which allows for faster extraction of
  compound tokens if the length is known.
This commit is contained in:
Paul Beckingham 2011-07-24 14:25:53 -04:00
parent 10c1203c87
commit 0ecf93553c
2 changed files with 14 additions and 0 deletions

View file

@ -216,6 +216,19 @@ bool Nibbler::getUntilEOS (std::string& result)
return false;
}
////////////////////////////////////////////////////////////////////////////////
bool Nibbler::getN (const int quantity, std::string& result)
{
if (mCursor + quantity < mLength)
{
result = mInput.substr (mCursor, quantity);
mCursor += quantity;
return true;
}
return false;
}
////////////////////////////////////////////////////////////////////////////////
bool Nibbler::getQuoted (
char c,

View file

@ -53,6 +53,7 @@ public:
bool getAllOneOf (const std::string&, std::string&);
*/
bool getN (const int, std::string&);
bool getQuoted (char, std::string&, bool quote = false);
bool getDigit (int&);
bool getInt (int&);