Go to the documentation of this file.
39 char *endptr =
nullptr;
41 const uintmax_t parsed = ::strtoumax(buf, &endptr, 10);
43 const uint32_t val = uint32_t(parsed);
48 ? parsing::errorType::RANGE
52 if (err != parsing::errorType::NONE)
65 char *endptr =
nullptr;
67 const uintmax_t parsed = ::strtoumax(buf, &endptr, 10);
69 val = uint32_t(parsed);
87 <<
"Bad token - could not get uint32"
100 const uintmax_t parsed = uintmax_t(std::round(sval));
101 val = 0 + uint32_t(parsed);
106 if ((sval < -1
e-4) || parsed > UINT32_MAX)
109 <<
"Expected label (uint32), value out-of-range "
115 else if (1
e-4 < std::abs(sval - scalar(parsed)))
118 <<
"Expected label (uint32), found non-integral value "
128 <<
"Wrong token type - expected label (uint32), found "
151 os.
write(label(val));
label labelToken() const
Return label value.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
bool isScalar() const
Token is FLOAT or DOUBLE.
errorType checkConversion(const char *buf, char *endptr)
Sanity check after strtof, strtod, etc.
Istream & operator>>(Istream &, directionInfo &)
uint32_t readUint32(Istream &is)
Read uint32_t from stream.
A token holds an item read from Istream.
bool good() const
True if token is not UNDEFINED or ERROR.
bool isLabel() const
Token is LABEL.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
InfoProxy< token > info() const
Return info proxy for printing token information to a stream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
const Foam::Enum< errorType > errorNames
Strings corresponding to the errorType.
errorType
Enumeration for possible parsing error.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
errorManipArg< error, int > exit(error &err, const int errNo=1)
scalar scalarToken() const
Return float or double value.
const dimensionedScalar e
Elementary charge.
void setBad()
Set stream to be bad.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...