51 tokens.
newElmt(nTok++) = std::move(tok);
80 const std::string&
input,
108 void Foam::ITstream::reserveCapacity
145 Istream(static_cast<IOstreamOption>(is)),
159 name_(
std::move(is.name_)),
246 const std::string&
input,
280 os <<
"ITstream : " << name_.c_str() <<
", line ";
290 os << toks.
front().lineNumber();
292 if (toks.
front().lineNumber() < toks.
back().lineNumber())
294 os <<
'-' << toks.
back().lineNumber();
306 const label nToks = toks.
size();
308 if (nToks == 1 && toks.front().isStringType())
311 return toks.front().stringToken();
316 bool addSpace =
false;
317 for (
const token& tok : toks)
336 return peekAt(tokenIndex_);
344 const label nToks = toks.size();
353 lineNumber_ = toks.front().lineNumber();
359 else if (pos < 0 || pos >= nToks)
366 lineNumber_ = toks.back().lineNumber();
378 lineNumber_ = toks[tokenIndex_].lineNumber();
390 const label nToks = toks.size();
395 while (
n++ && tokenIndex_)
400 if (tokenIndex_ < nToks)
402 lineNumber_ = toks[tokenIndex_].lineNumber();
410 while (
n-- && tokenIndex_ < nToks)
415 if (tokenIndex_ < nToks)
417 lineNumber_ = toks[tokenIndex_].lineNumber();
439 const label nToks = toks.size();
441 if (tokenIndex_ < nToks)
443 tok = toks[tokenIndex_++];
444 lineNumber_ = tok.lineNumber();
446 if (tokenIndex_ == nToks)
456 <<
"attempt to read beyond EOF" 469 tok.lineNumber(toks.back().lineNumber());
473 tok.lineNumber(this->lineNumber());
545 reserveCapacity(tokenIndex_ + 1, lazy);
548 toks[tokenIndex_] = t;
555 reserveCapacity(tokenIndex_ + 1, lazy);
558 toks[tokenIndex_] = std::move(t);
565 reserveCapacity(tokenIndex_ + newTokens.
size(), lazy);
568 for (
const token& t : newTokens)
570 toks[tokenIndex_] = t;
578 reserveCapacity(tokenIndex_ + newTokens.
size(), lazy);
581 for (token& t : newTokens)
583 toks[tokenIndex_] = std::move(t);
598 Istream::operator=(is);
bool good() const noexcept
True if token is not UNDEFINED or ERROR.
void size(const label n)
Older name for setAddressableSize.
const token & peekBack() const noexcept
Examine putback token without removing it.
bool getBack(token &tok)
Get the put-back token if there is one.
void seek(label pos)
Move tokenIndex to the specified position.
bool bad() const noexcept
True if stream is corrupted.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void resize(const label len)
Adjust allocated size of list.
Input/output from string buffers.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
bool empty() const noexcept
True if List is empty (ie, size() is zero)
A token holds an item read from Istream.
T & front()
Access first element of the list, position [0].
void skip(label n=1)
Move tokenIndex relative to the current position.
A simple container for options an IOstream can normally have.
void operator=(const UList< T > &a)
Assignment to UList operator. Takes linear time.
std::string toString() const
Concatenate tokens into a space-separated std::string. The resulting string may contain quote charact...
List< token > tokenList
List of token, used for dictionary primitive entry (for example)
const token & peek() const
Failsafe peek at what the next read would return, including handling of any putback.
virtual Istream & read(token &t)
Return next token from stream.
static tokenList parse(const UList< char > &input, IOstreamOption streamOpt=IOstreamOption())
Create token list by parsing the input character sequence until no good tokens remain.
dimensionedScalar pos(const dimensionedScalar &ds)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
void clear()
Clear the list, i.e. set size to zero.
A class for handling words, derived from Foam::string.
static Istream & input(Istream &is, IntRange< T > &range)
virtual Istream & readRaw(char *data, std::streamsize count)
Low-level raw binary read.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
virtual void rewind()
Rewind the stream so that it may be read again.
Similar to IStringStream but using an externally managed buffer for its input. This allows the input ...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
label size() const noexcept
The number of elements in the List.
OBJstream os(runTime.globalPath()/outputName)
virtual void print(Ostream &os) const
Print stream description to Ostream.
label lineNumber() const noexcept
Const access to the current stream line number.
word format(conversionProperties.get< word >("format"))
const std::string version
OpenFOAM version (name or stringified number) as a std::string.
T & newElmt(const label i)
Return subscript-checked element of UList and resizing the list if required.
Generic input stream using a standard (STL) stream.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
bool hasPutback() const noexcept
True if putback token is in use.
T & back()
Access last element of the list, position [size()-1].
static label parseStream(ISstream &is, tokenList &tokens)
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
virtual Istream & read(token &tok)
Return next token from stream.
void push_back(const token &t, const bool lazy)
Copy append a token at the current tokenIndex, incrementing the index.
ITstream(const ITstream &is)
Copy construct.
void operator=(const ITstream &is)
Copy assignment, with rewind()
void print(Ostream &os) const
Print stream description to Ostream.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
An input stream of tokens.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...