Nibbler
- Implemented Nibbler::getN, which allows for faster extraction of compound tokens if the length is known.
This commit is contained in:
@@ -216,6 +216,19 @@ bool Nibbler::getUntilEOS (std::string& result)
|
|||||||
return false;
|
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 (
|
bool Nibbler::getQuoted (
|
||||||
char c,
|
char c,
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ public:
|
|||||||
bool getAllOneOf (const std::string&, std::string&);
|
bool getAllOneOf (const std::string&, std::string&);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
bool getN (const int, std::string&);
|
||||||
bool getQuoted (char, std::string&, bool quote = false);
|
bool getQuoted (char, std::string&, bool quote = false);
|
||||||
bool getDigit (int&);
|
bool getDigit (int&);
|
||||||
bool getInt (int&);
|
bool getInt (int&);
|
||||||
|
|||||||
Reference in New Issue
Block a user