STYLE: adjust coding style for C++11 features and OpenFOAM-1706 methods

This commit is contained in:
Mark Olesen
2017-07-06 09:23:09 +02:00
parent c50368ecc6
commit 818c9b2da3

View File

@ -391,11 +391,11 @@ void Foam::argList::getRootCase()
fileName casePath; fileName casePath;
// [-case dir] specified // [-case dir] specified
HashTable<string>::const_iterator iter = options_.find("case"); auto optIter = options_.cfind("case");
if (iter != options_.end()) if (optIter.found())
{ {
casePath = iter(); casePath = optIter.object();
casePath.clean(); casePath.clean();
if (casePath.empty() || casePath == ".") if (casePath.empty() || casePath == ".")
@ -679,15 +679,12 @@ void Foam::argList::parse
source = options_["decomposeParDict"]; source = options_["decomposeParDict"];
if (isDir(source)) if (isDir(source))
{ {
adjustOpt = true;
source = source/"decomposeParDict"; source = source/"decomposeParDict";
adjustOpt = true;
} }
if // Case-relative if not absolute and not "./" etc
( if (!source.isAbsolute() && !source.startsWith("."))
!source.isAbsolute()
&& !(source.size() && source[0] == '.')
)
{ {
source = rootPath_/globalCase_/source; source = rootPath_/globalCase_/source;
adjustOpt = true; adjustOpt = true;
@ -1169,32 +1166,26 @@ void Foam::argList::printUsage() const
Info<< "\noptions:\n"; Info<< "\noptions:\n";
wordList opts = validOptions.sortedToc(); const wordList opts = validOptions.sortedToc();
forAll(opts, optI) for (const word& optionName : opts)
{ {
const word& optionName = opts[optI];
HashTable<string>::const_iterator iter = validOptions.find(optionName);
Info<< " -" << optionName; Info<< " -" << optionName;
label len = optionName.size() + 3; // Length includes leading ' -' label len = optionName.size() + 3; // Length includes leading ' -'
if (iter().size()) auto optIter = validOptions.cfind(optionName);
if (optIter().size())
{ {
// Length includes space and between option/param and '<>' // Length includes space between option/param and '<>'
len += iter().size() + 3; len += optIter().size() + 3;
Info<< " <" << iter().c_str() << '>'; Info<< " <" << optIter().c_str() << '>';
} }
HashTable<string>::const_iterator usageIter = auto usageIter = optionUsage.cfind(optionName);
optionUsage.find(optionName);
if (usageIter != optionUsage.end()) if (usageIter.found())
{ {
printOptionUsage printOptionUsage(len, usageIter());
(
len,
usageIter()
);
} }
else else
{ {
@ -1204,26 +1195,13 @@ void Foam::argList::printUsage() const
// Place srcDoc/doc/help options at the end // Place srcDoc/doc/help options at the end
Info<< " -srcDoc"; Info<< " -srcDoc";
printOptionUsage printOptionUsage(9, "display source code in browser" );
(
9,
"display source code in browser"
);
Info<< " -doc"; Info<< " -doc";
printOptionUsage printOptionUsage(6, "display application documentation in browser");
(
6,
"display application documentation in browser"
);
Info<< " -help"; Info<< " -help";
printOptionUsage printOptionUsage(7, "print the usage");
(
7,
"print the usage"
);
printNotes(); printNotes();
@ -1245,20 +1223,20 @@ void Foam::argList::displayDoc(bool source) const
// For source code: change foo_8C.html to foo_8C_source.html // For source code: change foo_8C.html to foo_8C_source.html
if (source) if (source)
{ {
forAll(docExts, extI) for (fileName& ext : docExts)
{ {
docExts[extI].replace(".", "_source."); ext.replace(".", "_source.");
} }
} }
fileName docFile; fileName docFile;
bool found = false; bool found = false;
forAll(docDirs, dirI) for (const fileName& dir : docDirs)
{ {
forAll(docExts, extI) for (const fileName& ext : docExts)
{ {
docFile = docDirs[dirI]/executable_ + docExts[extI]; docFile = dir/executable_ + ext;
docFile.expand(); docFile.expand();
if (isFile(docFile)) if (isFile(docFile))