- Fixed bug in serialization which caused threads to be saved with a "lats-for" field of 0
- Added some comments to the string_to code git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@956 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
2497aa3bc6
commit
8b7a4ed569
2 changed files with 10 additions and 6 deletions
|
@ -51,6 +51,8 @@ namespace sgpem
|
|||
if (tokens.size() != 1)
|
||||
throw domain_error(_("too few or too many tokens"));
|
||||
|
||||
// use the token, not the string, so whitespaces at the end of the string are
|
||||
// not considered errors by the last test
|
||||
istringstream iss(tokens[0]);
|
||||
T result;
|
||||
|
||||
|
@ -65,10 +67,10 @@ namespace sgpem
|
|||
throw domain_error(e.what());
|
||||
}
|
||||
|
||||
// disable exceptions, otherwise peek() will throw them!
|
||||
// how useless!!!
|
||||
// disable exceptions, otherwise peek() will throw them on eof!
|
||||
iss.exceptions(ios_base::goodbit);
|
||||
|
||||
// check if there is still stuff in the stream, there shouldn't
|
||||
if (iss.peek() != istringstream::traits_type::eof())
|
||||
throw domain_error(_("incorrect number format"));
|
||||
|
||||
|
@ -85,6 +87,8 @@ namespace sgpem
|
|||
if (tokens.size() != 1)
|
||||
throw domain_error(_("too few or too many tokens"));
|
||||
|
||||
// use the token, not the string, so whitespaces at the end of the string are
|
||||
// not considered errors by the last test
|
||||
istringstream iss(tokens[0]);
|
||||
bool value;
|
||||
|
||||
|
@ -99,10 +103,10 @@ namespace sgpem
|
|||
throw domain_error(e.what());
|
||||
}
|
||||
|
||||
// disable exceptions, otherwise peek() will throw them!
|
||||
// how useless!!!
|
||||
// disable exceptions, otherwise peek() will throw them on eof!
|
||||
iss.exceptions(ios_base::goodbit);
|
||||
|
||||
// check if there is still stuff in the stream, there shouldn't
|
||||
if (iss.peek() != istringstream::traits_type::eof())
|
||||
throw domain_error(_("incorrect boolean"));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue