Commit 4d126bfe authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: add dictionary optionalSubDict() method as per .org change (20-Apr)

parent cd8083eb
......@@ -743,6 +743,24 @@ Foam::dictionary Foam::dictionary::subOrEmptyDict
}
const Foam::dictionary& Foam::dictionary::optionalSubDict
(
const word& keyword
) const
{
const entry* entryPtr = lookupEntryPtr(keyword, false, true);
if (entryPtr)
{
return entryPtr->dict();
}
else
{
return *this;
}
}
Foam::wordList Foam::dictionary::toc() const
{
wordList keys(size());
......
......@@ -436,6 +436,10 @@ public:
const bool mustRead = false
) const;
//- Find and return a sub-dictionary if found
// otherwise return this dictionary
const dictionary& optionalSubDict(const word& keyword) const;
//- Return the table of contents
wordList toc() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment