ENH: rationalize dictionary access methods

- use keyType::option enum to consolidate searching options.
  These enumeration names should be more intuitive to use
  and improve code readability.

    Eg,   lookupEntry(key, keyType::REGEX);
    vs    lookupEntry(key, false, true);

  or

    Eg,   lookupEntry(key, keyType::LITERAL_RECURSIVE);
    vs    lookupEntry(key, true, false);

- new findEntry(), findDict(), findScoped() methods with consolidated
  search options for shorter naming and access names more closely
  aligned with other components. Behave simliarly to the
  methods lookupEntryPtr(), subDictPtr(), lookupScopedEntryPtr(),
  respectively. Default search parameters consistent with lookupEntry().

    Eg, const entry* e = dict.findEntry(key);
    vs  const entry* e = dict.lookupEntryPtr(key, false, true);

- added '*' and '->' dereference operators to dictionary searchers.
This commit is contained in:
Mark Olesen
2018-10-15 16:16:12 +02:00
parent 4f9e45fbab
commit c6520033c9
56 changed files with 769 additions and 753 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -437,7 +437,7 @@ Foam::string Foam::stringOps::getVariable
{
string value;
const entry* eptr = dict.lookupScopedEntryPtr(name, true, false);
const entry* eptr = dict.findScoped(name, keyType::LITERAL_RECURSIVE);
if (eptr)
{
@ -720,20 +720,16 @@ void Foam::stringOps::inplaceExpand
varBeg + 1 + delim,
varEnd - varBeg - 2*delim
),
false
false // Already validated
);
// Lookup in the dictionary without wildcards.
// See note in primitiveEntry
const entry* eptr = dict.lookupScopedEntryPtr
(
varName,
true,
false
);
const entry* eptr =
dict.findScoped(varName, keyType::LITERAL_RECURSIVE);
// if defined - copy its entries
// Copy its entries if defined
if (eptr)
{
OStringStream buf;