Nibbler: Removed unused ::parseDigits method
This commit is contained in:
@@ -632,48 +632,6 @@ bool Nibbler::getPartialUUID (std::string& result)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Parse the longest integer using the next 'limit' characters of 'result'
|
|
||||||
// following position 'i' (when strict is true, the number of digits must be
|
|
||||||
// equal to limit).
|
|
||||||
bool Nibbler::parseDigits(
|
|
||||||
std::string::size_type& i,
|
|
||||||
int& result,
|
|
||||||
unsigned int limit,
|
|
||||||
bool strict /* = true */)
|
|
||||||
{
|
|
||||||
// If the result has already been set
|
|
||||||
if (result != -1)
|
|
||||||
return false;
|
|
||||||
for (unsigned int f = limit; f > 0; --f)
|
|
||||||
{
|
|
||||||
// Check that the nibbler has enough unparsed characters
|
|
||||||
if (i + f <= _length)
|
|
||||||
{
|
|
||||||
// Check that 'f' of them are digits
|
|
||||||
unsigned int g;
|
|
||||||
for (g = 0; g < f; g++)
|
|
||||||
if (! Lexer::isDigit ((*_input)[i + g]))
|
|
||||||
break;
|
|
||||||
// Parse the integer when it is the case
|
|
||||||
if (g == f)
|
|
||||||
{
|
|
||||||
if (f == 1)
|
|
||||||
result = (*_input)[i] - '0';
|
|
||||||
else
|
|
||||||
result = atoi (_input->substr (i, f).c_str ());
|
|
||||||
// Update the global cursor before returning
|
|
||||||
i += f;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Do not try smaller limits if the option is strict on the size
|
|
||||||
if (strict)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Assumes that the options are sorted by decreasing length, so that if the
|
// Assumes that the options are sorted by decreasing length, so that if the
|
||||||
// options contain 'fourteen' and 'four', the stream is first matched against
|
// options contain 'fourteen' and 'four', the stream is first matched against
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
bool getUUID (std::string&);
|
bool getUUID (std::string&);
|
||||||
bool getPartialUUID (std::string&);
|
bool getPartialUUID (std::string&);
|
||||||
bool parseDigits(std::string::size_type&, int&, unsigned int, bool strict = true);
|
|
||||||
bool getOneOf (const std::vector <std::string>&, std::string&);
|
bool getOneOf (const std::vector <std::string>&, std::string&);
|
||||||
bool getName (std::string&);
|
bool getName (std::string&);
|
||||||
bool getWord (std::string&);
|
bool getWord (std::string&);
|
||||||
|
|||||||
Reference in New Issue
Block a user