mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: word::validated without underscore prefix by default (issue #518)
- this now appears to be the more common use case.
This commit is contained in:
@ -83,7 +83,8 @@ int main(int argc, char *argv[])
|
|||||||
Info<<"camel-case => " << (word("camel") & "case") << nl;
|
Info<<"camel-case => " << (word("camel") & "case") << nl;
|
||||||
for (const auto& s : { " text with \"spaces'", "08/15 value" })
|
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;
|
Info<< nl;
|
||||||
|
|
||||||
|
|||||||
@ -113,9 +113,9 @@ public:
|
|||||||
inline static bool valid(char c);
|
inline static bool valid(char c);
|
||||||
|
|
||||||
//- Construct a validated word, in which all invalid characters have
|
//- 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.
|
// 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
|
// File-like functions
|
||||||
|
|||||||
@ -365,7 +365,7 @@ void Foam::ccm::reader::readProblemDescription_boundaryRegion
|
|||||||
}
|
}
|
||||||
else
|
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())
|
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);
|
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())
|
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
|
// index starting at 1
|
||||||
const label selId = ++nCellSelections;
|
const label selId = ++nCellSelections;
|
||||||
|
|
||||||
cellTable_.setName(selId, word::validated(name));
|
cellTable_.setName(selId, word::validated(name, true));
|
||||||
cellTable_.setMaterial(selId, "fluid");
|
cellTable_.setMaterial(selId, "fluid");
|
||||||
|
|
||||||
for (label i = 0; i < count; ++i)
|
for (label i = 0; i < count; ++i)
|
||||||
@ -170,7 +170,7 @@ void Foam::fileFormats::FIREMeshReader::readSelections(ISstream& is)
|
|||||||
// index starting at 0
|
// index starting at 0
|
||||||
const label selId = nFaceSelections++;
|
const label selId = nFaceSelections++;
|
||||||
|
|
||||||
faceNames.append(word::validated(name));
|
faceNames.append(word::validated(name, true));
|
||||||
|
|
||||||
for (label i = 0; i < count; ++i)
|
for (label i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -64,7 +64,7 @@ Foam::fileFormats::STARCDsurfaceFormatCore::readInpCellTable
|
|||||||
if (ctnameRE.match(line, groups))
|
if (ctnameRE.match(line, groups))
|
||||||
{
|
{
|
||||||
const label tableId = atoi(groups[0].c_str());
|
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())
|
if (!tableName.empty())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user