41 return sptr ? sptr->
stdStream().tellg() : std::streampos(0);
73 putBackAvail_ =
false;
74 putBackToken_.
reset();
83 <<
"Attempt to put back onto bad stream"
86 else if (putBackAvail_)
89 <<
"Attempt to put back another token"
105 <<
"Attempt to put back onto bad stream"
108 else if (putBackAvail_)
111 <<
"Attempt to put back another token"
116 putBackAvail_ =
true;
117 putBackToken_ = std::move(tok);
127 <<
"Attempt to get back from bad stream"
130 else if (putBackAvail_)
132 putBackAvail_ =
false;
133 tok = std::move(putBackToken_);
143 const token delimiter(*
this);
150 <<
"' while reading " << funcName
151 <<
", found " << delimiter.info() <<
nl
161 const token delimiter(*
this);
168 <<
"' while reading " << funcName
169 <<
", found " << delimiter.info()
170 <<
" at stream position " << stream_tellg(
this) <<
nl
180 const token delimiter(*
this);
188 <<
"' while reading " << funcName
189 <<
", found " << delimiter.info()
195 return delimiter.pToken();
201 const token delimiter(*
this);
209 <<
"' while reading " << funcName
210 <<
", found " << delimiter.info()
211 <<
" at stream position " << stream_tellg(
this) <<
nl
217 return delimiter.pToken();
235 return const_cast<Istream&
>(*this);
void setBad() noexcept
Set stream state to be 'bad'.
bool good() const noexcept
True if next operation might succeed.
bool bad() const noexcept
True if stream is corrupted.
Generic input stream using a standard (STL) stream.
virtual const std::istream & stdStream() const
Const access to underlying std::istream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
bool getBack(token &tok)
Retrieve the put-back token if there is one.
Istream & operator()() const
Return a non-const reference to const Istream.
char readEndList(const char *funcName)
End read of list data, ends with ')' or '}'.
virtual void rewind()=0
Rewind the stream so that it may be read again.
bool readEnd(const char *funcName)
End read of data chunk, ends with ')'.
const token & peekBack() const noexcept
Examine putback token without removing it.
Istream(const Istream &)=default
Copy construct.
char readBeginList(const char *funcName)
Begin read of list data, starts with '(' or '{'.
void putBackClear()
Drop the putback token.
bool readBegin(const char *funcName)
Begin read of data chunk, starts with '('.
void putBack(const token &tok)
Put back a token (copy). Only a single put back is permitted.
A token holds an item read from Istream.
@ BEGIN_BLOCK
Begin block [isseparator].
@ END_BLOCK
End block [isseparator].
@ BEGIN_LIST
Begin list [isseparator].
@ END_LIST
End list [isseparator].
punctuationToken pToken() const
Return punctuation character.
void reset()
Reset token to UNDEFINED and clear any allocated storage.
static const token undefinedToken
An undefined token.
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.
static void check(const int retVal, const char *what)
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)
constexpr char nl
The newline '\n' character (0x0a).