39 char *endptr =
nullptr;
41 const uintmax_t parsed = ::strtoumax(buf, &endptr, 10);
43 const uint64_t val = uint64_t(parsed);
65 char *endptr =
nullptr;
67 const uintmax_t parsed = ::strtoumax(buf, &endptr, 10);
69 val = uint64_t(parsed);
96 <<
"Bad token - could not get uint64"
97 << exit(FatalIOError);
104 val = t.uint64Token();
106 else if (t.isScalar())
108 const scalar sval(t.scalarToken());
109 const uintmax_t parsed = uintmax_t(std::round(sval));
110 val = 0 + uint64_t(parsed);
115 if ((sval < -1
e-4) || parsed > UINT64_MAX)
118 <<
"Expected label (uint64), value out-of-range "
120 <<
exit(FatalIOError);
124 else if (1
e-4 < std::abs(sval - scalar(parsed)))
127 <<
"Expected label (uint64), found non-integral value "
129 <<
exit(FatalIOError);
137 <<
"Wrong token type - expected label (uint64), found "
139 <<
exit(FatalIOError);
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
void setBad() noexcept
Set stream state to be 'bad'.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A token holds an item read from Istream.
bool good() const noexcept
True if token is not UNDEFINED or ERROR.
bool isScalar() const noexcept
Token is FLOAT or DOUBLE.
bool is_uint64() const noexcept
Token is UNSIGNED_INTEGER_64 or is convertible to one.
scalar scalarToken() const
Return float or double value.
uint64_t uint64Token() const
Return int64 value, convert from other integer type or Error.
InfoProxy< token > info() const noexcept
Return info proxy, for printing token information to a stream.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
OBJstream os(runTime.globalPath()/outputName)
errorType
Enumeration for possible parsing error.
@ NONE
No error encountered.
const Foam::Enum< errorType > errorNames
Strings corresponding to the errorType.
errorType checkConversion(const char *buf, char *endptr)
Sanity check after strtof, strtod, etc.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
Istream & operator>>(Istream &, directionInfo &)
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
errorManipArg< error, int > exit(error &err, const int errNo=1)
uint64_t readUint64(Istream &is)
Read uint64_t from stream.