mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-20 13:23:08 +02:00
Nibbler
- Implemented Nibbler::getN, which allows for faster extraction of compound tokens if the length is known.
This commit is contained in:
parent
10c1203c87
commit
0ecf93553c
2 changed files with 14 additions and 0 deletions
|
@ -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,
|
||||
|
|
|
@ -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&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue