42 #ifndef Foam_ITstream_H 43 #define Foam_ITstream_H 78 void reserveCapacity(
const label newCapacity);
90 void reset(
const char*
input,
size_t nbytes);
119 const string&
name =
"input" 126 const string&
name =
"input",
135 const string&
name =
"input" 143 const string&
name =
"input" 152 const string&
name =
"input" 159 const std::string&
input,
161 const string&
name =
"input" 170 const string&
name =
"input" 173 #if __cplusplus >= 201703L 184 reset(
s.data(),
s.size());
198 reset(
s.data(),
s.size());
211 reset(
s.data(),
s.size());
265 return parse_chars(
input.cdata(),
input.size(), streamOpt);
276 return parse_chars(
input.data(),
input.size(), streamOpt);
287 return parse_chars(
input, strlen(
input), streamOpt);
290 #if __cplusplus >= 201703L 299 return parse_chars(
s.data(),
s.size(), streamOpt);
311 return parse_chars(
s.data(),
s.size(), streamOpt);
322 return parse_chars(
s.data(),
s.size(), streamOpt);
331 virtual const fileName&
name()
const override {
return name_; }
334 virtual fileName&
name() {
return name_; }
365 return peekNoFail(0);
384 return peekNoFail(tokenIndex_);
393 const token&
peekToken(
const label i)
const {
return peekNoFail(i); };
404 label old(tokenIndex_);
440 const
token::punctuationToken delimOpen,
441 const
token::punctuationToken delimClose,
504 virtual
std::ios_base::fmtflags
flags()
const override 506 return std::ios_base::fmtflags(0);
511 std::ios_base::fmtflags
flags(std::ios_base::fmtflags)
override 513 return std::ios_base::fmtflags(0);
551 virtual bool endRawRead()
override {
return false; }
560 void print(Ostream&
os)
const override;
570 using Istream::operator();
576 void operator=(
const UList<token>& toks);
583 #ifdef Foam_IOstream_extras 589 const UList<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.
A class for handling file names.
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].
label remove(const labelRange &range)
Remove a (start,size) subset from the list and move remaining elements down.
const token & front() const noexcept
Failsafe peek at the token at the front of the tokenList.
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.
List< token > tokenList
List of token, used for dictionary primitive entry (for example)
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.
const tokenList & tokens() const noexcept
The token contents (read-only access)
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)
const token & currentToken() const noexcept
Read access to the token at the current tokenIndex.
#define FOAM_DEPRECATED_STRICT(since, replacement)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
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.
static tokenList parse(const UList< char > &input, IOstreamOption streamOpt=IOstreamOption())
Create token list by parsing the input character sequence until no good tokens remain.
const Type * findCompound(label pos=0) const
Find compoundToken of specified Type, starting at the specified position. The position -1 indicates t...
constexpr UList() noexcept
Default construct, zero-sized and nullptr.
const token & peek() const noexcept
Failsafe peek at what the next read would return, including handling of any putback.
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 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].
Rudimentary functionality similar to std::span for holding memory view.
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 ...
const T * cdata() const noexcept
Return pointer to the underlying array serving as data storage.
void print(Ostream &os) const override
Print stream description to Ostream.
bool skip(label n=1) noexcept
Move tokenIndex relative to the current position.
virtual bool endRawRead() override
End of low-level raw binary read : no-op.
ITstream(const ITstream &is)
Copy construct.
void operator=(const ITstream &is)
Copy assignment, with rewind()
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
constexpr List() noexcept
Default construct.
void seek(label pos) noexcept
Move tokenIndex to the specified position and adjust the stream status (open/good/eof ...
const token & back() const noexcept
Failsafe peek at the token at the back of the tokenList.
virtual std::ios_base::fmtflags flags() const override
Return current stream flags. Dummy for token stream, returns 0.
An input stream of tokens.
virtual void rewind() override
Rewind the stream so that it may be read again. Same as seek(0)
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.