mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: use readOption to fine-tune dictionary reading
- previously had 'mandatory' (bool) for advanced control of reading dictionary entries but its meaning was unclear in the calling code without extra code comments. Now use IOobjectOption::readOption instead, which allows further options (ie, NO_READ) and is more transparent as to its purpose in the code than a true/false bool flag was. This is a minor breaking change (infrequent, advanced usage only) - minor code cleanup in dictionary lookup methods
This commit is contained in:
@ -74,10 +74,10 @@ bool Foam::expressions::exprString::readEntry
|
||||
(
|
||||
const word& keyword,
|
||||
const dictionary& dict,
|
||||
bool mandatory
|
||||
IOobjectOption::readOption readOpt
|
||||
)
|
||||
{
|
||||
const bool ok = dict.readEntry(keyword, *this, keyType::LITERAL, mandatory);
|
||||
const bool ok = dict.readEntry(keyword, *this, keyType::LITERAL, readOpt);
|
||||
|
||||
if (ok && !empty())
|
||||
{
|
||||
|
||||
@ -175,7 +175,7 @@ public:
|
||||
(
|
||||
const word& keyword, //!< Lookup key. Uses LITERAL (not REGEX)
|
||||
const dictionary& dict,
|
||||
bool mandatory = true
|
||||
IOobjectOption::readOption readOpt = IOobjectOption::MUST_READ
|
||||
);
|
||||
|
||||
//- Read/expand optional entry with dictionary variables,
|
||||
|
||||
@ -195,7 +195,7 @@ inline bool Foam::expressions::exprString::readIfPresent
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
return readEntry(key, dict, false); // non-mandatory
|
||||
return readEntry(key, dict, IOobjectOption::READ_IF_PRESENT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user