42 #ifndef Foam_ITstream_H 43 #define Foam_ITstream_H 78 void reserveCapacity(
const label newCapacity);
82 inline const token& peekNoFail(
const label i)
const 87 ? tokenList::operator[](i)
107 const string&
name =
"input" 114 const string&
name =
"input",
123 const string&
name =
"input" 131 const string&
name =
"input" 140 const string&
name =
"input" 147 const std::string&
input,
149 const string&
name =
"input" 158 const string&
name =
"input" 216 const std::string&
input,
234 virtual const fileName&
name()
const override {
return name_; }
259 const token&
front()
const {
return peekNoFail(0); }
268 const token&
peek()
const;
272 const token&
currentToken()
const {
return peekNoFail(tokenIndex_); }
280 const token&
peekToken(
const label i)
const {
return peekNoFail(i); };
291 label old(tokenIndex_);
313 bool skip(label
n = 1);
382 virtual ios_base::fmtflags
flags()
const override 384 return ios_base::fmtflags(0);
388 ios_base::fmtflags
flags(
const ios_base::fmtflags)
override 390 return ios_base::fmtflags(0);
428 virtual bool endRawRead()
override {
return false; }
431 virtual void rewind()
override;
437 void print(Ostream&
os)
const override;
447 using Istream::operator();
453 void operator=(
const UList<token>& toks);
460 #ifdef Foam_IOstream_extras 466 const UList<token>& tokens,
477 List<token>&& tokens,
virtual bool beginRawRead() override
Start of low-level raw binary read : no-op.
void add_tokens(const token &tok)
Copy append a token at the current tokenIndex, incrementing the index.
static const token undefinedToken
An undefined token.
const token & front() const
Failsafe peek at the token at the front of the tokenList.
A class for handling file names.
void seek(label pos)
Move tokenIndex to the specified position.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
label endLineNumber() const
The line number of the last token in stream.
A range or interval of labels defined by a start and a size.
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 * data() noexcept
Return pointer to the underlying array serving as data storage.
T & front()
Access first element of the list, position [0].
A simple container for options an IOstream can normally have.
std::string toString() const
Concatenate tokens into a space-separated std::string. The resulting string may contain quote charact...
label startLineNumber() const
The line number of the first token in stream.
label tokenIndex() const noexcept
The current token index when reading, or the insertion point.
label nRemainingTokens() const noexcept
Number of tokens remaining.
const token & peek() const
Failsafe peek at what the next read would return, including handling of any putback.
static tokenList parse(const UList< char > &input, IOstreamOption streamOpt=IOstreamOption())
Create token list by parsing the input character sequence until no good tokens remain.
constexpr IOstreamOption(streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept
Default construct (ASCII, UNCOMPRESSED, currentVersion) or construct with format, compression...
dimensionedScalar pos(const dimensionedScalar &ds)
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
virtual Istream & read(token &tok) override
Return next token from stream.
virtual Istream & readRaw(char *data, std::streamsize count) override
Low-level raw binary read : triggers not implemented error.
static Istream & input(Istream &is, IntRange< T > &range)
bool hasPutback() const noexcept
True if putback token is in use.
const token & peekFirst() const
Same as front()
void push_back(const token &t, bool)
punctuationToken
Standard punctuation tokens (a character)
#define FOAM_DEPRECATED_STRICT(since, replacement)
const token & currentToken() const
Read access to the token at the current tokenIndex.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
label find(const T &val) const
Find index of the first occurrence of the value.
void append(const token &t, bool)
virtual const fileName & name() const override
The name of the input token stream.
label size() const noexcept
The number of elements in the container.
OBJstream os(runTime.globalPath()/outputName)
label lineNumber() const noexcept
Const access to the current stream line number.
virtual ios_base::fmtflags flags() const override
Get stream flags - always 0.
constexpr UList() noexcept
Default construct, zero-sized and nullptr.
virtual ~ITstream()=default
Destructor.
bool hasPutback() const noexcept
True if putback token is in use.
labelRange find(const token::punctuationToken delimOpen, const token::punctuationToken delimClose, label pos=0) const
Find range containing matching delimiter pair, starting at the the specified position. The position -1 indicates to continue from the present tokenIndex() position.
streamFormat
Data format (ascii | binary)
T & back()
Access last element of the list, position [size()-1].
static ITstream & empty_stream()
Return reference to an empty ITstream, for functions needing to return an ITstream reference but whic...
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
virtual void rewind() override
Rewind the stream so that it may be read again. Same as seek(0)
void print(Ostream &os) const override
Print stream description to Ostream.
virtual bool endRawRead() override
End of low-level raw binary read : no-op.
bool skip(label n=1)
Move tokenIndex relative to the current position.
ITstream(const ITstream &is)
Copy construct.
void operator=(const ITstream &is)
Copy assignment, with rewind()
const token & back() const
Failsafe peek at the token at the back of the tokenList.
constexpr List() noexcept
Default construct.
An input stream of tokens.
Istream(const Istream &)=default
Copy construct.
const token & peekToken(const label i) const
Failsafe read access to token at given position in the tokenList.
ITstream extract(const labelRange &range)
Remove a (start,size) subset from the list and move remaining elements down.