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.
first().lineNumber();
292 if (toks.
first().lineNumber() < toks.
last().lineNumber())
294 os <<
'-' << toks.
last().lineNumber();
310 for (
const token& tok : *
this)
331 return peekAt(tokenIndex_);
339 const label nToks = toks.
size();
348 lineNumber_ = toks.first().lineNumber();
354 else if (pos < 0 || pos >= nToks)
361 lineNumber_ = toks.last().lineNumber();
373 lineNumber_ = toks[tokenIndex_].lineNumber();
385 const label nToks = toks.size();
390 while (
n++ && tokenIndex_)
395 if (tokenIndex_ < nToks)
397 lineNumber_ = toks[tokenIndex_].lineNumber();
405 while (
n-- && tokenIndex_ < nToks)
410 if (tokenIndex_ < nToks)
412 lineNumber_ = toks[tokenIndex_].lineNumber();
434 const label nToks = toks.size();
436 if (tokenIndex_ < nToks)
438 tok = toks[tokenIndex_++];
439 lineNumber_ = tok.lineNumber();
441 if (tokenIndex_ == nToks)
451 <<
"attempt to read beyond EOF" 464 tok.lineNumber(toks.last().lineNumber());
468 tok.lineNumber(this->lineNumber());
540 reserveCapacity(tokenIndex_ + 1, lazy);
543 toks[tokenIndex_] = t;
550 reserveCapacity(tokenIndex_ + 1, lazy);
553 toks[tokenIndex_] = std::move(t);
560 reserveCapacity(tokenIndex_ + newTokens.
size(), lazy);
563 for (
const token& t : newTokens)
565 toks[tokenIndex_] = t;
573 reserveCapacity(tokenIndex_ + newTokens.
size(), lazy);
576 for (token& t : newTokens)
578 toks[tokenIndex_] = std::move(t);
593 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.
List< token > tokenList
List of tokens, used for a IOdictionary entry.
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 the UList is empty (ie, size() is zero)
A token holds an item read from Istream.
void skip(label n=1)
Move tokenIndex relative to the current position.
T & first()
Access first element of the list, position [0].
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...
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...
OBJstream os(runTime.globalPath()/outputName)
virtual void print(Ostream &os) const
Print stream description to Ostream.
T & last()
Access last element of the list, position [size()-1].
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.
label size() const noexcept
The number of elements in the UList.
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 ...