bool Foam::functionEntries::includeEntry::execute ( dictionary& parentDict, Istream& is ) { const fileName fName(includeFileName(is)); IFstream ifs(fName); if (ifs) { if (Foam::functionEntries::includeEntry::report) { Info<< fName << endl; } parentDict.read(ifs); return true; } else { FatalIOErrorIn ( "functionEntries::includeEntry::includeEntry" "(dictionary& parentDict, Istream&)", is ) << "Cannot open include file " << ifs.name() << " while reading dictionary " << parentDict.name() << exit(FatalIOError); return false; } }
bool Foam::functionEntries::codeStream::execute ( dictionary& parentDict, Istream& is ) { Info<< "Using #codeStream at line " << is.lineNumber() << " in file " << parentDict.name() << endl; dynamicCode::checkSecurity ( "functionEntries::codeStream::execute(..)", parentDict ); // get code dictionary // must reference parent for stringOps::expand to work nicely dictionary codeDict("#codeStream", parentDict, is); streamingFunctionType function = getFunction(parentDict, codeDict); // use function to write stream OStringStream os(is.format()); (*function)(os, parentDict); // get the entry from this stream IStringStream resultStream(os.str()); parentDict.read(resultStream); return true; }
bool Foam::functionEntries::includeEntry::execute ( dictionary& parentDict, Istream& is ) { const fileName rawFName(is); const fileName fName ( includeFileName(is.name().path(), rawFName, parentDict) ); IFstream ifs(fName); if (ifs) { if (Foam::functionEntries::includeEntry::log) { Info<< fName << endl; } parentDict.read(ifs); return true; } else { FatalIOErrorInFunction ( is ) << "Cannot open include file " << (ifs.name().size() ? ifs.name() : rawFName) << " while reading dictionary " << parentDict.name() << exit(FatalIOError); return false; } }
bool Foam::functionEntries::negEntry::execute ( dictionary& parentDict, Istream& is ) { // Reinsert negated variable into dictionary IStringStream resultStream(negateVariable(parentDict, is)); parentDict.read(resultStream); return true; }
bool Foam::functionEntries::includeIfPresentEntry::execute ( dictionary& parentDict, Istream& is ) { IFstream ifs(includeFileName(is)); if (ifs) { parentDict.read(ifs); } return true; }