34 void Foam::primitiveEntry::append
36 const token& currToken,
37 const dictionary& dict,
41 if (currToken.isWord())
43 const word& w = currToken.wordToken();
50 !(w[0] ==
'$' && expandVariable(w, dict))
51 && !(w[0] ==
'#' && expandFunction(w, dict, is))
58 else if (currToken.isVariable())
60 const string& w = currToken.stringToken();
69 && expandVariable(w, dict)
83 bool Foam::primitiveEntry::expandFunction
86 const dictionary& parentDict,
90 word functionName =
keyword(1, keyword.size()-1);
99 "primitiveEntry::read(const dictionary&, Istream&) start" 102 label blockCount = 0;
112 append(currToken, dict, is);
147 append(currToken, dict, is);
153 "primitiveEntry::read(const dictionary&, Istream&) end" 156 if (currToken.
good())
179 std::ostringstream os;
180 os <<
"ill defined primitiveEntry starting at keyword '" 182 <<
" on line " << keywordLineNumber
206 is.
name() +
'.' + key,
221 is.
name() +
'.' + key,
269 this->
write(os,
false);
286 const label nPrintTokens = 10;
288 os <<
" primitiveEntry '" << e.
keyword() <<
"' comprises ";
292 os <<
nl <<
" " << e[i].
info();
295 if (e.
size() > nPrintTokens)
A class for handling keywords in dictionaries.
void write(Ostream &) const
Write.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const keyType & keyword() const
Return keyword.
bool bad() const
Return true if stream is corrupted.
List< token > tokenList
List of tokens, used for a IOdictionary entry.
A list of keyword definitions, which are a keyword followed by any number of values (e...
T & operator[](const label)
Return element of UList.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
InfoProxy< primitiveEntry > info() const
Return info proxy.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
void size(const label)
Override size to be inconsistent with allocated storage.
static const dictionary null
Null dictionary.
A token holds items read from Istream.
T & newElmt(const label)
Return subscript-checked element of UList.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Istream(streamFormat format=ASCII, versionNumber version=currentVersion, compressionType compression=UNCOMPRESSED)
Set stream status.
versionNumber version() const
Return the stream version.
label lineNumber() const
Return current stream line number.
A keyword and a list of tokens is a 'primitiveEntry'. An primitiveEntry can be read, written and printed, and the types and values of its tokens analysed.
entry(const keyType &)
Construct from keyword.
static int disableFunctionEntries
virtual Istream & read(token &)=0
Return next token from stream.
virtual const fileName & name() const
Return the name of the stream.
label tokenIndex() const
Return the current token index.
static bool execute(const word &functionName, dictionary &parentDict, Istream &)
Execute the functionEntry in a sub-dict context.
ITstream(const string &name, const UList< token > &tokens, streamFormat format=ASCII, versionNumber version=currentVersion)
Construct from components.
streamFormat format() const
Return current stream format.
void fatalCheck(const char *operation) const
Check IOstream status for given operation.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
void setSize(const label)
Reset size of List.
A helper class for outputting values to Ostream.
void print(Ostream &) const
Print description of IOstream to Ostream.
primitiveEntry(const keyType &, Istream &)
Construct from keyword and a Istream.
const fileName & name() const
Return the dictionary name.
virtual bool read(const dictionary &, Istream &)
Read tokens from the given stream.
virtual Ostream & write(const token &)=0
Write next token to stream.
const doubleScalar e
Elementary charge.
label size() const
Return the number of elements in the UList.
A keyword and a list of tokens is an 'entry'.
#define SafeFatalIOErrorInFunction(ios, msg)
Report an error message using Foam::FatalIOError.