mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: align Enum methods with HashTable
- deprecate get(key, deflt) in favour of lookup(key, deflt).
Method name compatibility with HashTable.
- deprecate operator().
The meaning is too opaque and equally served by other means:
- use get(key) instead of operator()(key).
Const access whereas HashTable::operator()(key)
creates missing entry.
- lookup(key, deflt) - instead of operator()(key, deflt).
Const access whereas HashTable::operator()(key, deflt)
creates a missing entry.
- make Enum iterable to allow participation in range-for etc.
This commit is contained in:
@ -258,7 +258,7 @@ static int driverTokenType
|
||||
{
|
||||
const word fieldType(driver_.getFieldClassName(ident));
|
||||
|
||||
int tokType = fieldTokenEnums().get(fieldType, -1);
|
||||
int tokType = fieldTokenEnums().lookup(fieldType, -1);
|
||||
|
||||
if (tokType > 0)
|
||||
{
|
||||
@ -328,7 +328,7 @@ bool Foam::expressions::patchExpr::scanner::dispatch_method
|
||||
<< "Method:" << ident
|
||||
<< " at " << driver_.parsePosition() << nl;
|
||||
|
||||
const int methType = fieldMethodEnums.get(ident, -1);
|
||||
const int methType = fieldMethodEnums.lookup(ident, -1);
|
||||
|
||||
if (methType > 0)
|
||||
{
|
||||
@ -367,7 +367,7 @@ bool Foam::expressions::patchExpr::scanner::dispatch_ident
|
||||
else
|
||||
{
|
||||
// Check for function name
|
||||
tokType = funcTokenEnums.get(ident, -1);
|
||||
tokType = funcTokenEnums.lookup(ident, -1);
|
||||
|
||||
if (tokType > 0)
|
||||
{
|
||||
@ -381,7 +381,7 @@ bool Foam::expressions::patchExpr::scanner::dispatch_ident
|
||||
|
||||
#ifdef HAS_LOOKBEHIND_TOKENS
|
||||
// Specials such "cset" also reset the look-behind
|
||||
tokType = lookBehindTokenEnums.get(ident, -1);
|
||||
tokType = lookBehindTokenEnums.lookup(ident, -1);
|
||||
|
||||
if (tokType > 0)
|
||||
{
|
||||
@ -423,7 +423,7 @@ bool Foam::expressions::patchExpr::scanner::dispatch_ident
|
||||
(
|
||||
quoted || dot == std::string::npos
|
||||
? -1
|
||||
: fieldMethodEnums.get(ident.substr(dot+1), -1)
|
||||
: fieldMethodEnums.lookup(ident.substr(dot+1), -1)
|
||||
);
|
||||
|
||||
if
|
||||
|
||||
Reference in New Issue
Block a user