mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
C++11: Improved CppCoreGuidelines compliance
This commit is contained in:
parent
f550e8a1a7
commit
6a2b861b1d
2 changed files with 8 additions and 9 deletions
|
@ -35,9 +35,7 @@
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
Pig::Pig (const std::string& text)
|
Pig::Pig (const std::string& text)
|
||||||
: _text (text)
|
: _text {text}
|
||||||
, _cursor (0)
|
|
||||||
, _saved (0)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,6 +215,7 @@ bool Pig::getDigits (int& result)
|
||||||
_cursor = prev;
|
_cursor = prev;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
prev = _cursor;
|
prev = _cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,7 +418,7 @@ bool Pig::getOneOf (
|
||||||
const std::vector <std::string>& options,
|
const std::vector <std::string>& options,
|
||||||
std::string& found)
|
std::string& found)
|
||||||
{
|
{
|
||||||
for (auto& option : options)
|
for (const auto& option : options)
|
||||||
{
|
{
|
||||||
if (skipLiteral (option))
|
if (skipLiteral (option))
|
||||||
{
|
{
|
||||||
|
@ -469,7 +468,7 @@ std::string Pig::peek (const int quantity) const
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::string::size_type Pig::cursor ()
|
std::string::size_type Pig::cursor () const
|
||||||
{
|
{
|
||||||
return _cursor;
|
return _cursor;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
class Pig
|
class Pig
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Pig (const std::string&);
|
explicit Pig (const std::string&);
|
||||||
|
|
||||||
bool skip (int);
|
bool skip (int);
|
||||||
bool skipN (const int quantity = 1);
|
bool skipN (const int quantity = 1);
|
||||||
|
@ -56,7 +56,7 @@ public:
|
||||||
bool eos () const;
|
bool eos () const;
|
||||||
int peek () const;
|
int peek () const;
|
||||||
std::string peek (const int) const;
|
std::string peek (const int) const;
|
||||||
std::string::size_type cursor ();
|
std::string::size_type cursor () const;
|
||||||
std::string::size_type save ();
|
std::string::size_type save ();
|
||||||
std::string::size_type restore ();
|
std::string::size_type restore ();
|
||||||
|
|
||||||
|
@ -64,8 +64,8 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string& _text;
|
const std::string& _text;
|
||||||
std::string::size_type _cursor;
|
std::string::size_type _cursor {0};
|
||||||
std::string::size_type _saved;
|
std::string::size_type _saved {0};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue