An input stream of tokens. More...
Public Member Functions | |
ITstream (const ITstream &is) | |
Copy construct. More... | |
ITstream (const string &name, const UList< token > &tokens, streamFormat format=ASCII, versionNumber version=currentVersion) | |
Construct from components. More... | |
ITstream (const string &name, List< token > &&tokens, streamFormat format=ASCII, versionNumber version=currentVersion) | |
Construct from components, transferring the tokens. More... | |
ITstream (const string &name, const UList< char > &input, streamFormat format=ASCII, versionNumber version=currentVersion) | |
Construct token list by parsing the input character sequence. More... | |
ITstream (const string &name, const std::string &input, streamFormat format=ASCII, versionNumber version=currentVersion) | |
Construct token list by parsing the input string. More... | |
ITstream (const string &name, const char *input, streamFormat format=ASCII, versionNumber version=currentVersion) | |
Construct token list by parsing the input character sequence. More... | |
virtual | ~ITstream ()=default |
Destructor. More... | |
virtual const fileName & | name () const |
Return the name of the stream. More... | |
virtual fileName & | name () |
Return non-const access to the name of the stream. More... | |
label | tokenIndex () const |
The current token index when reading, or the insertion point. More... | |
label & | tokenIndex () |
Non-const access to the current token index. More... | |
label | nRemainingTokens () const |
The number of remaining tokens. More... | |
ios_base::fmtflags | flags () const |
Return flags of output stream. More... | |
virtual Istream & | read (token &tok) |
Return next token from stream. More... | |
virtual Istream & | read (char &) |
Read a character. More... | |
virtual Istream & | read (word &) |
Read a word. More... | |
virtual Istream & | read (string &) |
Read a string (including enclosing double-quotes) More... | |
virtual Istream & | read (label &) |
Read a label. More... | |
virtual Istream & | read (floatScalar &) |
Read a floatScalar. More... | |
virtual Istream & | read (doubleScalar &) |
Read a doubleScalar. More... | |
virtual Istream & | read (char *data, std::streamsize) |
Read binary block. More... | |
virtual Istream & | readRaw (char *data, std::streamsize count) |
Low-level raw binary read. More... | |
virtual bool | beginRawRead () |
Start of low-level raw binary read. More... | |
virtual bool | endRawRead () |
End of low-level raw binary read. More... | |
virtual void | rewind () |
Rewind the stream so that it may be read again. More... | |
void | seek (label pos) |
Move the tokenIndex to the specified position. More... | |
void | append (const token &t, const bool lazy) |
void | append (token &&t, const bool lazy) |
void | append (const tokenList &newTokens, const bool lazy) |
void | append (tokenList &&newTokens, const bool lazy) |
ios_base::fmtflags | flags (const ios_base::fmtflags) |
Set flags of stream. More... | |
void | print (Ostream &os) const |
Print stream description to Ostream. More... | |
std::string | toString () const |
void | operator= (const ITstream &is) |
Copy assignment, with rewind() More... | |
void | operator= (const tokenList &toks) |
Copy assignment of tokens, with rewind() More... | |
void | operator= (tokenList &&toks) |
Move assignment of tokens, with rewind() More... | |
Public Member Functions inherited from Istream | |
Istream (const Istream &)=default | |
Copy construct. More... | |
virtual | ~Istream ()=default |
Destructor. More... | |
Istream (IOstreamOption streamOpt=IOstreamOption()) | |
Istream (streamFormat fmt, versionNumber ver=currentVersion, compressionType comp=compressionType::UNCOMPRESSED) | |
Construct with format, version (compression) More... | |
void | putBack (const token &tok) |
Put back token. More... | |
bool | getBack (token &tok) |
Get the put back token if there is one and return true. More... | |
bool | peekBack (token &tok) |
Peek at the put back token without removing it. More... | |
bool | readBegin (const char *funcName) |
Begin read of data chunk, starts with '('. More... | |
bool | readEnd (const char *funcName) |
End read of data chunk, ends with ')'. More... | |
char | readBeginList (const char *funcName) |
Begin read of list data, starts with '(' or '{'. More... | |
char | readEndList (const char *funcName) |
End read of list data, ends with ')' or '}'. More... | |
Istream & | operator() () const |
Return a non-const reference to const Istream. More... | |
Public Member Functions inherited from IOstream | |
IOstream (const IOstream &)=default | |
Copy construct. More... | |
virtual | ~IOstream ()=default |
Destructor. More... | |
IOstream (IOstreamOption streamOpt=IOstreamOption()) | |
IOstream (streamFormat fmt, versionNumber ver, compressionType comp=compressionType::UNCOMPRESSED) | |
Construct with format, version (compression) More... | |
virtual bool | check (const char *operation) const |
Check IOstream status for given operation. More... | |
bool | fatalCheck (const char *operation) const |
Check IOstream status for given operation. More... | |
bool | opened () const |
Return true if stream has been opened. More... | |
bool | closed () const |
Return true if stream is closed. More... | |
bool | good () const |
Return true if next operation might succeed. More... | |
bool | eof () const |
Return true if end of input seen. More... | |
bool | fail () const |
Return true if next operation will fail. More... | |
bool | bad () const |
Return true if stream is corrupted. More... | |
operator bool () const | |
Return true if the stream has not failed. More... | |
bool | operator! () const |
Return true if the stream has failed. More... | |
unsigned | labelByteSize () const |
The label byte-size associated with the stream. More... | |
unsigned | scalarByteSize () const |
The scalar byte-size associated with the stream. More... | |
void | setLabelByteSize (unsigned nbytes) |
Set the label byte-size associated with the stream. More... | |
void | setScalarByteSize (unsigned nbytes) |
Set the scalar byte-size associated with the stream. More... | |
template<class T = label> | |
std::enable_if< std::is_integral< T >::value, bool >::type | checkLabelSize () const |
template<class T = scalar> | |
std::enable_if< std::is_floating_point< T >::value, bool >::type | checkScalarSize () const |
label | lineNumber () const |
Const access to the current stream line number. More... | |
label & | lineNumber () |
Non-const access to the current stream line number. More... | |
label | lineNumber (const label num) |
Set the stream line number. More... | |
void | setEof () |
Set stream to have reached eof. More... | |
void | setFail () |
Set stream to have failed. More... | |
void | setBad () |
Set stream to be bad. More... | |
ios_base::fmtflags | setf (const ios_base::fmtflags f) |
Set flags of stream. More... | |
ios_base::fmtflags | setf (const ios_base::fmtflags f, const ios_base::fmtflags mask) |
Set flags of given field of stream. More... | |
void | unsetf (const ios_base::fmtflags f) |
Unset flags of stream. More... | |
void | print (Ostream &os, const int streamState) const |
Print information about the stream state bits. More... | |
InfoProxy< IOstream > | info () const |
Return info proxy. More... | |
Public Member Functions inherited from IOstreamOption | |
constexpr | IOstreamOption (streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept |
constexpr | IOstreamOption (streamFormat fmt, compressionType comp, versionNumber ver) noexcept |
Construct from components (format, compression, version) More... | |
constexpr | IOstreamOption (streamFormat fmt, versionNumber ver, compressionType comp=compressionType::UNCOMPRESSED) noexcept |
Construct from components (format, version, compression) More... | |
IOstreamOption (const IOstreamOption &opt, streamFormat fmt) noexcept | |
Copy construct with change of format. More... | |
streamFormat | format () const noexcept |
Get the current stream format. More... | |
streamFormat | format (const streamFormat fmt) noexcept |
Set the stream format. More... | |
streamFormat | format (const word &formatName) |
Set the stream format from string value. More... | |
compressionType | compression () const noexcept |
Get the stream compression. More... | |
compressionType | compression (const compressionType comp) noexcept |
Set the stream compression. More... | |
compressionType | compression (const word &compName) |
Set the stream compression from string value. More... | |
versionNumber | version () const noexcept |
Get the stream version. More... | |
versionNumber | version (const versionNumber ver) noexcept |
Set the stream version. More... | |
versionNumber | version (const token &tok) |
Set the stream version from token. More... | |
Public Member Functions inherited from List< T > | |
constexpr | List () noexcept |
Null constructor. More... | |
List (const label len) | |
Construct with given size. More... | |
List (const label len, const T &val) | |
Construct with given size and value for all elements. More... | |
List (const label len, const zero) | |
Construct with given size initializing all elements to zero. More... | |
List (const one, const T &val) | |
Construct with length=1, copying the value as the only content. More... | |
List (const one, T &&val) | |
Construct with length=1, moving the value as the only content. More... | |
List (const one, const zero) | |
Construct with length=1, initializing content to zero. More... | |
List (const List< T > &a) | |
Copy construct from list. More... | |
List (const UList< T > &a) | |
Copy construct contents from list. More... | |
List (List< T > &a, bool reuse) | |
Construct as copy or re-use as specified. More... | |
List (const UList< T > &list, const labelUList &indices) | |
Copy construct subset of list. More... | |
template<unsigned N> | |
List (const UList< T > &list, const FixedList< label, N > &indices) | |
Copy construct subset of list. More... | |
template<class InputIterator > | |
List (InputIterator begIter, InputIterator endIter) | |
Construct given begin/end iterators. More... | |
template<unsigned N> | |
List (const FixedList< T, N > &list) | |
Construct as copy of FixedList<T, N> More... | |
List (const PtrList< T > &list) | |
Construct as copy of PtrList<T> More... | |
List (const SLList< T > &list) | |
Construct as copy of SLList<T> More... | |
template<class Addr > | |
List (const IndirectListBase< T, Addr > &list) | |
Construct as copy of IndirectList contents. More... | |
List (std::initializer_list< T > list) | |
Construct from an initializer list. More... | |
List (List< T > &&list) | |
Move construct from List. More... | |
template<int SizeMin> | |
List (DynamicList< T, SizeMin > &&list) | |
Move construct from DynamicList. More... | |
List (SortableList< T > &&list) | |
Move construct from SortableList. More... | |
List (SLList< T > &&list) | |
Move construct from SLList. More... | |
List (Istream &is) | |
Construct from Istream. More... | |
autoPtr< List< T > > | clone () const |
Clone. More... | |
~List () | |
Destructor. More... | |
void | resize (const label newSize) |
Adjust allocated size of list. More... | |
void | resize (const label newSize, const T &val) |
Adjust allocated size of list and set val for new elements. More... | |
void | setSize (const label newSize) |
Alias for resize(const label) More... | |
void | setSize (const label newSize, const T &val) |
Alias for resize(const label, const T&) More... | |
void | clear () |
Clear the list, i.e. set size to zero. More... | |
void | append (const T &val) |
Append an element at the end of the list. More... | |
void | append (T &&val) |
Move append an element at the end of the list. More... | |
void | append (const UList< T > &list) |
Append a List to the end of this list. More... | |
template<class Addr > | |
void | append (const IndirectListBase< T, Addr > &list) |
Append IndirectList contents at the end of this list. More... | |
void | transfer (List< T > &list) |
template<int SizeMin> | |
void | transfer (DynamicList< T, SizeMin > &list) |
void | transfer (SortableList< T > &list) |
T & | newElmt (const label i) |
void | operator= (const UList< T > &a) |
Assignment to UList operator. Takes linear time. More... | |
void | operator= (const List< T > &list) |
Assignment operator. Takes linear time. More... | |
void | operator= (const SLList< T > &list) |
Assignment to SLList operator. Takes linear time. More... | |
template<class Addr > | |
void | operator= (const IndirectListBase< T, Addr > &list) |
Assignment from IndirectList. Takes linear time. More... | |
template<unsigned N> | |
void | operator= (const FixedList< T, N > &list) |
Copy assignment from FixedList. More... | |
void | operator= (std::initializer_list< T > list) |
Assignment to an initializer list. More... | |
void | operator= (const T &val) |
Assignment of all entries to the given value. More... | |
void | operator= (const zero) |
Assignment of all entries to zero. More... | |
void | operator= (List< T > &&list) |
Move assignment. Takes constant time. More... | |
template<int SizeMin> | |
void | operator= (DynamicList< T, SizeMin > &&list) |
Move assignment. Takes constant time. More... | |
void | operator= (SortableList< T > &&list) |
Move assignment. Takes constant time. More... | |
void | operator= (SLList< T > &&list) |
Move assignment. Takes constant time. More... | |
void | shallowCopy (const UList< T > &)=delete |
No shallowCopy permitted. More... | |
template<class TypeT = T> | |
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type | set (const label i, bool val=true) |
A bitSet::set() method for a list of bool. More... | |
template<> | |
void | resize (const label newSize) |
Static Public Member Functions | |
static tokenList | parse (const UList< char > &input, streamFormat format=ASCII) |
static tokenList | parse (const std::string &input, streamFormat format=ASCII) |
static tokenList | parse (const char *input, streamFormat format=ASCII) |
Static Public Member Functions inherited from IOstream | |
static unsigned int | defaultPrecision () |
Return the default precision. More... | |
static unsigned int | defaultPrecision (unsigned int prec) |
Reset the default precision. More... | |
Static Public Member Functions inherited from IOstreamOption | |
static streamFormat | formatEnum (const word &formatName, const streamFormat deflt=streamFormat::ASCII) |
static streamFormat | formatEnum (const word &key, const dictionary &dict, const streamFormat deflt=streamFormat::ASCII) |
Failsafe construct streamFormat from optional dictionary lookup. More... | |
static compressionType | compressionEnum (const word &compName, const compressionType deflt=compressionType::UNCOMPRESSED) |
The compression enum corresponding to the string. More... | |
static compressionType | compressionEnum (const word &key, const dictionary &dict, const compressionType deflt=compressionType::UNCOMPRESSED) |
Failsafe construct compressionType from optional dictionary lookup. More... | |
Static Public Member Functions inherited from List< T > | |
static const List< T > & | null () |
Return a null List. More... | |
Additional Inherited Members | |
Public Types inherited from IOstream | |
enum | streamAccess : char { CLOSED = 0, OPENED } |
Enumeration for stream open/closed state. More... | |
Public Types inherited from IOstreamOption | |
enum | streamFormat : char { ASCII = 0, BINARY } |
Data format (ascii | binary) More... | |
enum | compressionType : char { UNCOMPRESSED = 0, COMPRESSED } |
Compression treatment (UNCOMPRESSED | COMPRESSED) More... | |
Public Types inherited from List< T > | |
typedef SubList< T > | subList |
Declare type of subList. More... | |
Static Public Attributes inherited from IOstream | |
static unsigned int | precision_ |
Default precision. More... | |
Static Public Attributes inherited from IOstreamOption | |
static const Enum< streamFormat > | formatNames |
Stream format names (ascii, binary) More... | |
static const versionNumber | currentVersion |
The current version number (2.0) More... | |
Protected Member Functions inherited from IOstream | |
void | setOpened () |
Set stream opened. More... | |
void | setClosed () |
Set stream closed. More... | |
void | setState (ios_base::iostate state) |
Set stream state. More... | |
void | setGood () |
Set stream to be good. More... | |
Protected Attributes inherited from IOstream | |
streamAccess | openClosed_ |
ios_base::iostate | ioState_ |
unsigned short | labelByteSize_ |
The label byte-size (could also be stored as byte) More... | |
unsigned short | scalarByteSize_ |
The scalar byte-size (could also be stored as byte) More... | |
label | lineNumber_ |
The file line. More... | |
Static Protected Attributes inherited from IOstream | |
static fileName | staticName_ |
Name for any generic stream - normally treat as readonly. More... | |
Copy construct.
Definition at line 90 of file ITstream.H.
References IOstream::setGood(), and IOstream::setOpened().
|
inline |
Construct from components.
Definition at line 103 of file ITstream.H.
References IOstream::setGood(), and IOstream::setOpened().
|
inline |
Construct from components, transferring the tokens.
Definition at line 121 of file ITstream.H.
References IOstream::setGood(), and IOstream::setOpened().
ITstream | ( | const string & | name, |
const UList< char > & | input, | ||
streamFormat | format = ASCII , |
||
versionNumber | version = currentVersion |
||
) |
Construct token list by parsing the input character sequence.
Uses UIListStream internally.
Definition at line 141 of file ITstream.C.
References format(), ITstream::rewind(), and Foam::foamVersion::version.
ITstream | ( | const string & | name, |
const std::string & | input, | ||
streamFormat | format = ASCII , |
||
versionNumber | version = currentVersion |
||
) |
Construct token list by parsing the input string.
Uses UIListStream internally.
Definition at line 161 of file ITstream.C.
References format(), ITstream::rewind(), and Foam::foamVersion::version.
ITstream | ( | const string & | name, |
const char * | input, | ||
streamFormat | format = ASCII , |
||
versionNumber | version = currentVersion |
||
) |
Construct token list by parsing the input character sequence.
Uses UIListStream internally.
Definition at line 181 of file ITstream.C.
References format(), ITstream::rewind(), and Foam::foamVersion::version.
|
virtualdefault |
Destructor.
|
static |
Create token list by parsing the input character sequence until no good tokens remain.
Definition at line 56 of file ITstream.C.
References IOstreamOption::currentVersion, and format().
Referenced by dictionary::tokens().
|
static |
Create token list by parsing the input string until no good tokens remain.
Definition at line 70 of file ITstream.C.
References IOstreamOption::currentVersion, and format().
|
static |
Create token list by parsing the input character sequence until no good tokens remain.
Definition at line 90 of file ITstream.C.
References IOstreamOption::currentVersion, and format().
|
inlinevirtual |
Return the name of the stream.
Reimplemented from IOstream.
Reimplemented in primitiveEntry.
Definition at line 204 of file ITstream.H.
Referenced by primitiveEntry::name().
|
inlinevirtual |
Return non-const access to the name of the stream.
Reimplemented from IOstream.
Reimplemented in primitiveEntry.
Definition at line 210 of file ITstream.H.
|
inline |
The current token index when reading, or the insertion point.
Definition at line 216 of file ITstream.H.
|
inline |
Non-const access to the current token index.
Definition at line 222 of file ITstream.H.
|
inline |
The number of remaining tokens.
Definition at line 228 of file ITstream.H.
Referenced by entry::checkITstream(), and dictionary::checkITstream().
|
inlinevirtual |
|
virtual |
Return next token from stream.
Implements Istream.
Definition at line 251 of file ITstream.C.
References Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, Istream::getBack(), token::lineNumber(), and token::reset().
|
virtual |
Read a character.
Implements Istream.
Definition at line 300 of file ITstream.C.
References NotImplemented.
|
virtual |
Read a word.
Implements Istream.
Definition at line 307 of file ITstream.C.
References NotImplemented.
|
virtual |
Read a string (including enclosing double-quotes)
Implements Istream.
Definition at line 314 of file ITstream.C.
References NotImplemented.
|
virtual |
Read a label.
Implements Istream.
Definition at line 321 of file ITstream.C.
References NotImplemented.
|
virtual |
Read a floatScalar.
Implements Istream.
Definition at line 328 of file ITstream.C.
References NotImplemented.
|
virtual |
Read a doubleScalar.
Implements Istream.
Definition at line 335 of file ITstream.C.
References NotImplemented.
|
virtual |
Read binary block.
Implements Istream.
Definition at line 349 of file ITstream.C.
References NotImplemented.
|
virtual |
Low-level raw binary read.
Implements Istream.
Definition at line 342 of file ITstream.C.
References NotImplemented.
|
inlinevirtual |
|
inlinevirtual |
|
virtual |
Rewind the stream so that it may be read again.
Implements Istream.
Definition at line 356 of file ITstream.C.
Referenced by Foam::exprTools::getList(), ITstream::ITstream(), and primitiveEntry::stream().
void seek | ( | label | pos | ) |
Move the tokenIndex to the specified position.
Using seek(0) is identical to rewind. Using seek(-1) moves to the end.
Definition at line 362 of file ITstream.C.
References Foam::pos().
Copy append a token at the current tokenIndex, incrementing the index.
Definition at line 408 of file ITstream.C.
Move append a token at the current tokenIndex, incrementing the index.
Definition at line 418 of file ITstream.C.
Copy append a tokenList at the current tokenIndex, incrementing the index.
newTokens | the list of tokens to copy append |
lazy | leaves any excess capacity for further appends. The caller will be responsible for resizing later. |
Definition at line 428 of file ITstream.C.
Move append a tokenList at the current tokenIndex, incrementing the index.
newTokens | the list of tokens to move append |
lazy | leaves any excess capacity for further appends. The caller will be responsible for resizing later. |
Definition at line 441 of file ITstream.C.
|
inlinevirtual |
|
virtual |
Print stream description to Ostream.
Reimplemented from IOstream.
Definition at line 202 of file ITstream.C.
References IOstream::lineNumber(), and IOstream::print().
std::string toString | ( | ) | const |
Concatenate tokens into a space-separated std::string. The resulting string may contain quote characters.
Definition at line 226 of file ITstream.C.
References StringStreamAllocator< StreamType >::str().
Referenced by expressionEntry::inplaceExpand().
void operator= | ( | const ITstream & | is | ) |
Copy assignment, with rewind()
Definition at line 458 of file ITstream.C.
References List< T >::operator=().
void operator= | ( | const tokenList & | toks | ) |
Copy assignment of tokens, with rewind()
Definition at line 468 of file ITstream.C.
References List< T >::operator=().
void operator= | ( | tokenList && | toks | ) |
Move assignment of tokens, with rewind()
Definition at line 476 of file ITstream.C.
References List< T >::operator=().