- Removed unused Nibbler::getHex.
This commit is contained in:
Paul Beckingham 2015-02-17 10:58:45 -05:00
parent 520067f522
commit c11601e30e
3 changed files with 4 additions and 43 deletions

View file

@ -403,33 +403,6 @@ bool Nibbler::getInt (int& result)
return false;
}
////////////////////////////////////////////////////////////////////////////////
bool Nibbler::getHex (int& result)
{
std::string::size_type i = _cursor;
if (i < _length)
{
if (_input[i] == '-')
++i;
else if (_input[i] == '+')
++i;
}
// TODO Potential for use of find_first_not_of
while (i < _length && isxdigit (_input[i]))
++i;
if (i > _cursor)
{
result = strtoimax (_input.substr (_cursor, i - _cursor).c_str (), NULL, 16);
_cursor = i;
return true;
}
return false;
}
////////////////////////////////////////////////////////////////////////////////
bool Nibbler::getUnsignedInt (int& result)
{

View file

@ -68,7 +68,6 @@ public:
bool getDigit3 (int&);
bool getDigit2 (int&);
bool getInt (int&);
bool getHex (int&);
bool getUnsignedInt (int&);
bool getNumber (std::string&);
bool getNumber (double&);

View file

@ -40,15 +40,15 @@ int main (int argc, char** argv)
{
#ifdef NIBBLER_FEATURE_DATE
#ifdef NIBBLER_FEATURE_REGEX
UnitTest t (417);
UnitTest t (410);
#else
UnitTest t (387);
UnitTest t (380);
#endif
#else
#ifdef NIBBLER_FEATURE_REGEX
UnitTest t (353);
UnitTest t (346);
#else
UnitTest t (329);
UnitTest t (322);
#endif
#endif
@ -83,7 +83,6 @@ int main (int argc, char** argv)
t.notok (n.getQuoted ('"', s), "trivial: getQuoted");
t.notok (n.getDigit (i), "trivial: getDigit");
t.notok (n.getInt (i), "trivial: getInt"); // 10
t.notok (n.getHex (i), "trivial: getHex");
t.notok (n.getUnsignedInt (i), "trivial: getUnsignedInt");
t.notok (n.getUntilEOL (s), "trivial: getUntilEOL");
t.notok (n.getUntilEOS (s), "trivial: getUntilEOS");
@ -301,16 +300,6 @@ int main (int argc, char** argv)
t.is (i, -4, " '-4' : getInt () -> '-4'");
t.ok (n.depleted (), " '' : depleted () -> true");
// bool getHex (int&);
t.diag ("Nibbler::getHex");
n = Nibbler ("123 7b");
t.ok (n.getHex (i), " '123 7b' : getHex () -> true");
t.is (i, 291, " '123 7b' : getHex () -> '291'");
t.ok (n.skip (' '), " ' 7b' : skip (' ') -> true");
t.ok (n.getHex (i), " '7b' : getHex () -> true");
t.is (i, 123, " '7b' : getHex () -> '123'");
t.ok (n.depleted (), " '' : depleted () -> true");
// bool getUnsignedInt (int&i);
t.diag ("Nibbler::getUnsignedInt");
n = Nibbler ("123 4");