ENH: consolidate, cleanup some string methods

- consolidate word::validated() into word::validate() and also allow
  as short form for string::validate<word>(). Also less confusing than
  having similarly named methods that essentially do the same thing.

- more consistent const access when iterating over strings

- add valid(char) for keyType and wordRe
This commit is contained in:
Mark Olesen
2017-08-02 12:33:35 +02:00
parent 3f6e130c91
commit e70fc61660
43 changed files with 258 additions and 320 deletions

View File

@ -207,7 +207,7 @@ int main(int argc, char *argv[])
// #include "checkHasMovingMesh.H"
// #include "checkHasLagrangian.H"
IOobjectList objects(mesh, timeDirs[timeDirs.size()-1].name());
IOobjectList objects(mesh, timeDirs.last().name());
forAll(timeDirs, timeI)
{

View File

@ -488,7 +488,7 @@ mtype {space}"MTYPE:"{space}
<cellStreamTitle>{spaceNl}{word}{spaceNl} {
word streamName(Foam::string::validate<word>(YYText()));
const word streamName(word::validate(YYText()));
BEGIN(cellStreamFlags);
}

View File

@ -370,7 +370,7 @@ void readPhysNames(IFstream& inFile, Map<word>& physicalNames)
lineStr >> regionI >> regionName;
Info<< " " << regionI << '\t'
<< string::validate<word>(regionName) << endl;
<< word::validate(regionName) << endl;
}
else if (nSpaces == 2)
{
@ -380,21 +380,21 @@ void readPhysNames(IFstream& inFile, Map<word>& physicalNames)
if (physType == 1)
{
Info<< " " << "Line " << regionI << '\t'
<< string::validate<word>(regionName) << endl;
<< word::validate(regionName) << endl;
}
else if (physType == 2)
{
Info<< " " << "Surface " << regionI << '\t'
<< string::validate<word>(regionName) << endl;
<< word::validate(regionName) << endl;
}
else if (physType == 3)
{
Info<< " " << "Volume " << regionI << '\t'
<< string::validate<word>(regionName) << endl;
<< word::validate(regionName) << endl;
}
}
physicalNames.insert(regionI, string::validate<word>(regionName));
physicalNames.insert(regionI, word::validate(regionName));
}
inFile.getLine(line);

View File

@ -512,7 +512,7 @@ void readSets
>> dofSet >> tempSet >> contactSet >> nFaces;
is.getLine(line);
word groupName = string::validate<word>(line);
const word groupName = word::validate(line);
Info<< "For group " << group
<< " named " << groupName