mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Pig: Added ::skipN
This commit is contained in:
parent
abbc273d19
commit
07070baa73
2 changed files with 19 additions and 0 deletions
18
src/Pig.cpp
18
src/Pig.cpp
|
@ -38,6 +38,24 @@ Pig::Pig (const std::string& text)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
bool Pig::skipN (const int quantity)
|
||||||
|
{
|
||||||
|
auto save = _cursor;
|
||||||
|
|
||||||
|
auto count = 0;
|
||||||
|
while (count++ < quantity)
|
||||||
|
{
|
||||||
|
if (! utf8_next_char (_text, _cursor))
|
||||||
|
{
|
||||||
|
_cursor = save;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
bool Pig::skipWS ()
|
bool Pig::skipWS ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,6 +34,7 @@ class Pig
|
||||||
public:
|
public:
|
||||||
Pig (const std::string&);
|
Pig (const std::string&);
|
||||||
|
|
||||||
|
bool skipN (const int quantity = 1);
|
||||||
bool skipWS ();
|
bool skipWS ();
|
||||||
|
|
||||||
bool getDigit (int&);
|
bool getDigit (int&);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue