functionEntry: Simplified the primitiveEntry created when functions are disabled

This commit is contained in:
Henry Weller
2019-08-20 23:36:49 +01:00
parent c5d4d5e17b
commit da52b23f41
3 changed files with 11 additions and 10 deletions

View File

@ -49,16 +49,14 @@ namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::string Foam::functionEntry::readLine(const word& key, Istream& is)
Foam::word Foam::functionEntry::readLine(Istream& is)
{
string s;
word s;
dynamic_cast<ISstream&>(is).getLine(s);
return key + s;
return s;
}
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
bool Foam::functionEntry::insert
@ -95,8 +93,8 @@ Foam::functionEntry::functionEntry
:
primitiveEntry
(
word(key + dict.name() + Foam::name(is.lineNumber())),
token(word(readLine(key, is)), is.lineNumber())
key,
token(readLine(is), is.lineNumber())
)
{}
@ -192,6 +190,8 @@ void Foam::functionEntry::write(Ostream& os) const
{
os.indent();
writeKeyword(os, keyword());
for (label i=0; i<size(); ++i)
{
os << operator[](i);

View File

@ -67,8 +67,9 @@ class functionEntry
{
// Private Member Functions
//- Read line as string token
static string readLine(const word& key, Istream& is);
//- Read line as word token
static word readLine(Istream& is);
protected:

View File

@ -373,7 +373,6 @@ bool Foam::functionObjectList::readFunctionObject
funcDict.set("region", region);
}
// Merge this functionObject dictionary into functionsDict
const word funcCallKeyword = string::validate<word>(funcCall);
dictionary funcArgsDict;
funcArgsDict.add(funcCallKeyword, funcDict);
@ -400,6 +399,7 @@ bool Foam::functionObjectList::readFunctionObject
requiredFields.insert(wordList(expandedFuncDict.lookup("fields")));
}
// Merge this functionObject dictionary into functionsDict
functionsDict.merge(funcArgsDict);
functionsDict.subDict(funcCallKeyword).name() = funcDict.name();