mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Signed-off-by: Paul Beckingham <paul@beckingham.net>
Bug #836 - Make A3 use same the number representation as the user.
This commit is contained in:
parent
6473c9f39b
commit
3a4871e975
5 changed files with 25 additions and 9 deletions
|
@ -377,7 +377,7 @@ bool Nibbler::getUnsignedInt (int& result)
|
|||
// e:
|
||||
// e|E (+|-)?
|
||||
//
|
||||
bool Nibbler::getNumber (double& result)
|
||||
bool Nibbler::getNumber (std::string& result)
|
||||
{
|
||||
std::string::size_type i = _cursor;
|
||||
|
||||
|
@ -417,7 +417,7 @@ bool Nibbler::getNumber (double& result)
|
|||
while (i < _length && isdigit (_input[i]))
|
||||
++i;
|
||||
|
||||
result = strtof (_input.substr (_cursor, i - _cursor).c_str (), NULL);
|
||||
result = _input.substr (_cursor, i - _cursor);
|
||||
_cursor = i;
|
||||
return true;
|
||||
}
|
||||
|
@ -425,7 +425,7 @@ bool Nibbler::getNumber (double& result)
|
|||
return false;
|
||||
}
|
||||
|
||||
result = strtof (_input.substr (_cursor, i - _cursor).c_str (), NULL);
|
||||
result = _input.substr (_cursor, i - _cursor);
|
||||
_cursor = i;
|
||||
return true;
|
||||
}
|
||||
|
@ -433,6 +433,20 @@ bool Nibbler::getNumber (double& result)
|
|||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Nibbler::getNumber (double &result)
|
||||
{
|
||||
bool isnumber;
|
||||
std::string s;
|
||||
|
||||
isnumber = getNumber (s);
|
||||
if (isnumber)
|
||||
{
|
||||
result = strtof (s.c_str (), NULL);
|
||||
}
|
||||
return isnumber;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// number:
|
||||
// int frac? exp?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue