renamed literalRE option

This commit is contained in:
mattijs
2009-09-21 10:59:19 +01:00
parent af62832bff
commit 9415727b94

View File

@ -54,6 +54,13 @@ Description
} }
@endverbatim @endverbatim
Usage
- changeDictionary [OPTION]
@param -literalRE \n
Do not interpret regular expressions; treat them as any other keyword.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -84,7 +91,7 @@ bool addEntry
dictionary& thisDict, dictionary& thisDict,
entry& thisEntry, entry& thisEntry,
const entry& mergeEntry, const entry& mergeEntry,
const bool literalWildcards const bool literalRE
) )
{ {
bool changed = false; bool changed = false;
@ -99,7 +106,7 @@ bool addEntry
( (
const_cast<dictionary&>(thisEntry.dict()), const_cast<dictionary&>(thisEntry.dict()),
mergeEntry.dict(), mergeEntry.dict(),
literalWildcards literalRE
) )
) )
{ {
@ -118,15 +125,15 @@ bool addEntry
// Dictionary merging/editing. // Dictionary merging/editing.
// literalWildcards: // literalRE:
// - true: behave like dictionary::merge, i.e. add wildcards just like // - true: behave like dictionary::merge, i.e. add regexps just like
// any other key. // any other key.
// - false : interpret wildcard as a rule for items to be matched. // - false : interpret wildcard as a rule for items to be matched.
bool merge bool merge
( (
dictionary& thisDict, dictionary& thisDict,
const dictionary& mergeDict, const dictionary& mergeDict,
const bool literalWildcards const bool literalRE
) )
{ {
bool changed = false; bool changed = false;
@ -147,7 +154,7 @@ bool merge
{ {
const keyType& key = mergeIter().keyword(); const keyType& key = mergeIter().keyword();
if (literalWildcards || !key.isPattern()) if (literalRE || !key.isPattern())
{ {
entry* entryPtr = thisDict.lookupEntryPtr entry* entryPtr = thisDict.lookupEntryPtr
( (
@ -170,7 +177,7 @@ bool merge
thisDict, thisDict,
*entryPtr, *entryPtr,
mergeIter(), mergeIter(),
literalWildcards literalRE
) )
) )
{ {
@ -189,7 +196,7 @@ bool merge
// Pass 2. Wildcard matches (if any) on any non-match keys. // Pass 2. Wildcard matches (if any) on any non-match keys.
if (!literalWildcards && thisKeysSet.size() > 0) if (!literalRE && thisKeysSet.size() > 0)
{ {
wordList thisKeys(thisKeysSet.toc()); wordList thisKeys(thisKeysSet.toc());
@ -219,7 +226,7 @@ bool merge
thisDict, thisDict,
thisEntry, thisEntry,
mergeIter(), mergeIter(),
literalWildcards literalRE
) )
) )
{ {
@ -239,19 +246,19 @@ bool merge
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
argList::validOptions.insert("instance", "instance"); argList::validOptions.insert("instance", "instance");
argList::validOptions.insert("literalWildcards", ""); argList::validOptions.insert("literalRE", "");
#include "addRegionOption.H" #include "addRegionOption.H"
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
#include "createNamedMesh.H" #include "createNamedMesh.H"
bool literalWildcards = args.optionFound("literalWildcards"); bool literalRE = args.optionFound("literalRE");
if (literalWildcards) if (literalRE)
{ {
Info<< "Not interpreting any wildcards in the changeDictionaryDict." Info<< "Not interpreting any regular expressions (RE)"
<< endl << " in the changeDictionaryDict." << endl
<< "Instead they are handled as any other entry, i.e. added if" << "Instead they are handled as any other entry, i.e. added if"
<< " not present." << endl; << " not present." << endl;
} }
@ -341,7 +348,7 @@ int main(int argc, char *argv[])
Info<< "Merging entries from " << replaceDict.toc() << endl; Info<< "Merging entries from " << replaceDict.toc() << endl;
// Merge the replacements in // Merge the replacements in
merge(fieldDict, replaceDict, literalWildcards); merge(fieldDict, replaceDict, literalRE);
Info<< "fieldDict:" << fieldDict << endl; Info<< "fieldDict:" << fieldDict << endl;
@ -407,7 +414,7 @@ int main(int argc, char *argv[])
Info<< "Merging entries from " << replaceDict.toc() << endl; Info<< "Merging entries from " << replaceDict.toc() << endl;
// Merge the replacements in // Merge the replacements in
merge(fieldDict, replaceDict, literalWildcards); merge(fieldDict, replaceDict, literalRE);
Info<< "Writing modified fieldDict " << fieldName << endl; Info<< "Writing modified fieldDict " << fieldName << endl;
fieldDict.regIOobject::write(); fieldDict.regIOobject::write();