STYLE: use range-for when looping dictionary entries.

- as part of the cleanup of dictionary access methods (c6520033c9)
  made the dictionary class single inheritance from IDLList<entry>.

  This eliminates any ambiguities for iterators and allows
  for simple use of range-for looping.

  Eg,
      for (const entry& e : topDict))
      {
          Info<< "entry:" << e.keyword() << " is dict:" << e.isDict() << nl;
      }

   vs

      forAllConstIter(dictionary, topDict, iter))
      {
          Info<< "entry:" << iter().keyword()
              << " is dict:" << iter().isDict() << nl;
      }
This commit is contained in:
Mark Olesen
2018-10-19 13:08:24 +02:00
parent 4e04c1966f
commit 07dafe7b0b
60 changed files with 636 additions and 653 deletions

View File

@ -93,14 +93,10 @@ Foam::cellSizeAndAlignmentControls::cellSizeAndAlignmentControls
{
label functionI = 0;
forAllConstIter(dictionary, shapeControlDict_, iter)
for (const entry& dEntry : shapeControlDict_)
{
word shapeControlEntryName = iter().keyword();
const dictionary& controlFunctionDict
(
shapeControlDict_.subDict(shapeControlEntryName)
);
const word& shapeControlEntryName = dEntry.keyword();
const dictionary& controlFunctionDict = dEntry.dict();
Info<< nl << "Shape Control : " << shapeControlEntryName << endl;
Info<< incrIndent;

View File

@ -535,16 +535,12 @@ Foam::conformationSurfaces::conformationSurfaces
Info<< nl << "Reading additionalFeatures" << endl;
}
forAllConstIter(dictionary, additionalFeaturesDict, iter)
for (const entry& dEntry : additionalFeaturesDict)
{
word featureName = iter().keyword();
const word& featureName = dEntry.keyword();
const dictionary& featureSubDict = dEntry.dict();
Info<< nl << " " << iter().keyword() << endl;
const dictionary& featureSubDict
(
additionalFeaturesDict.subDict(featureName)
);
Info<< nl << " " << featureName << endl;
readFeatures(featureSubDict, featureName, featureI);
}