Commit 822d20cb authored by Mark OLESEN's avatar Mark OLESEN
Browse files

STYLE: word::validated without underscore prefix by default (issue #518)

- this now appears to be the more common use case.
parent 481513bb
......@@ -83,7 +83,8 @@ int main(int argc, char *argv[])
Info<<"camel-case => " << (word("camel") & "case") << nl;
for (const auto& s : { " text with \"spaces'", "08/15 value" })
{
Info<<"validated \"" << s << "\" => " << word::validated(s) << nl;
Info<<"validated \"" << s << "\" => "
<< word::validated(s, true) << nl;
}
Info<< nl;
......
......@@ -113,9 +113,9 @@ public:
inline static bool valid(char c);
//- Construct a validated word, in which all invalid characters have
// been stripped out. Normally also prefix any leading digit
// been stripped out. Optionally prefix any leading digit
// with '_' to have words that work nicely as dictionary keywords.
static word validated(const std::string& s, const bool prefix=true);
static word validated(const std::string& s, const bool prefix=false);
// File-like functions
......
......@@ -365,7 +365,7 @@ void Foam::ccm::reader::readProblemDescription_boundaryRegion
}
else
{
dict.add(opt, word::validated(str));
dict.add(opt, word::validated(str, true));
}
}
......@@ -407,7 +407,7 @@ void Foam::ccm::reader::readProblemDescription_boundaryRegion
if (!str.empty())
{
dict.add(opt, word::validated(str));
dict.add(opt, word::validated(str, true));
}
}
......@@ -472,7 +472,7 @@ void Foam::ccm::reader::readProblemDescription_cellTable
str = "zone_" + ::Foam::name(Id);
}
dict.add(opt, word::validated(str));
dict.add(opt, word::validated(str, true));
}
......@@ -484,7 +484,7 @@ void Foam::ccm::reader::readProblemDescription_cellTable
if (!str.empty())
{
dict.add(opt, word::validated(str));
dict.add(opt, word::validated(str, true));
}
}
......
......@@ -155,7 +155,7 @@ void Foam::fileFormats::FIREMeshReader::readSelections(ISstream& is)
// index starting at 1
const label selId = ++nCellSelections;
cellTable_.setName(selId, word::validated(name));
cellTable_.setName(selId, word::validated(name, true));
cellTable_.setMaterial(selId, "fluid");
for (label i = 0; i < count; ++i)
......@@ -170,7 +170,7 @@ void Foam::fileFormats::FIREMeshReader::readSelections(ISstream& is)
// index starting at 0
const label selId = nFaceSelections++;
faceNames.append(word::validated(name));
faceNames.append(word::validated(name, true));
for (label i = 0; i < count; ++i)
{
......
......@@ -64,7 +64,7 @@ Foam::fileFormats::STARCDsurfaceFormatCore::readInpCellTable
if (ctnameRE.match(line, groups))
{
const label tableId = atoi(groups[0].c_str());
const word tableName = word::validated(groups[1]);
const word tableName = word::validated(groups[1], true);
if (!tableName.empty())
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment