34 void Foam::primitiveEntry::append
36 const token& currToken,
37 const dictionary& dict,
45 else if (currToken.isFunctionName())
47 if (!expandFunction(currToken.functionNameToken(),
dict, is))
52 else if (currToken.isVariable())
54 if (!expandVariable(currToken.variableToken(),
dict))
66 bool Foam::primitiveEntry::expandFunction
68 const functionName& hashFn,
69 const dictionary& parentDict,
73 const word fn = hashFn(1, hashFn.size() - 1);
82 "primitiveEntry::read(const dictionary&, Istream&) start" 95 append(currToken, dict, is);
130 append(currToken, dict, is);
136 "primitiveEntry::read(const dictionary&, Istream&) end" 139 if (currToken.
good())
162 std::ostringstream os;
163 os <<
"ill defined primitiveEntry starting at keyword '" 165 <<
" on line " << keywordLineNumber
189 is.
name() +
'/' + key,
204 is.
name() +
'/' + key,
242 this->
write(os,
false);
259 const label nPrintTokens = 10;
261 os <<
" primitiveEntry '" << e.
keyword() <<
"' comprises ";
265 os <<
nl <<
" " << e[i].
info();
268 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.
Ostream & writeKeyword(Foam::Ostream &os, const keyType &kw)
Write the keyword to the Ostream with the current level of indentation.
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.
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.
static const dictionary null
Null dictionary.
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...
const dictionary & dict() const
This entry is not a dictionary,.
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.
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.