Go to the documentation of this file.
40 char *endptr =
nullptr;
42 const intmax_t parsed = ::strtoimax(buf, &endptr, 10);
44 const int32_t val = int32_t(parsed);
48 (parsed < INT32_MIN || parsed > INT32_MAX)
49 ? parsing::errorType::RANGE
53 if (err != parsing::errorType::NONE)
66 char *endptr =
nullptr;
68 const intmax_t parsed = ::strtoimax(buf, &endptr, 10);
70 val = int32_t(parsed);
74 (parsed < INT32_MIN || parsed > INT32_MAX)
97 <<
"Bad token - could not get int32"
107 if (t.isPunctuation())
110 if (prefix == token::PLUS || prefix == token::MINUS)
120 (prefix == token::MINUS)
121 ? (0 - t.labelToken())
125 else if (t.isScalar())
129 (prefix == token::MINUS)
130 ? (0 - t.scalarToken())
133 const intmax_t parsed = intmax_t(std::round(sval));
134 val = 0 + int32_t(parsed);
139 if (parsed < INT32_MIN || parsed > INT32_MAX)
142 <<
"Expected integral (int32), value out-of-range "
148 else if (1
e-4 < std::abs(sval - scalar(parsed)))
151 <<
"Expected integral (int32), found non-integral value "
161 <<
"Wrong token type - expected label (int32), found ";
162 if (prefix == token::PLUS || prefix == token::MINUS)
178 os.write(label(val));
184 #if (__SIZEOF_LONG__ == 4)
187 return operator>>(is,
reinterpret_cast<int32_t&
>(val));
192 return (
os << int32_t(val));
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
bool isLabel() const noexcept
errorType checkConversion(const char *buf, char *endptr)
Istream & operator>>(Istream &, directionInfo &)
A token holds an item read from Istream.
punctuationToken pToken() const
Ostream & operator<<(Ostream &, const boundaryPatch &p)
InfoProxy< token > info() const
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
bool isPunctuation() const noexcept
const Foam::Enum< errorType > errorNames
virtual bool check(const char *operation) const
OBJstream os(runTime.globalPath()/outputName)
int32_t readInt32(Istream &is)
bool isScalar() const noexcept
errorManipArg< error, int > exit(error &err, const int errNo=1)
bool good() const noexcept
scalar scalarToken() const
const dimensionedScalar e
#define FatalIOErrorInFunction(ios)
An Ostream is an abstract base class for all output systems (streams, files, token lists,...