The #remove directive can now take a wordRe type

This commit is contained in:
Mark Olesen
2009-07-31 12:50:03 +02:00
parent e38822ad1a
commit 9c04f3118c
2 changed files with 11 additions and 17 deletions

View File

@ -26,6 +26,7 @@ License
#include "removeEntry.H"
#include "dictionary.H"
#include "stringListOps.H"
#include "IStringStream.H"
#include "OStringStream.H"
#include "addToMemberFunctionSelectionTable.H"
@ -64,22 +65,12 @@ bool Foam::functionEntries::removeEntry::execute
Istream& is
)
{
token currToken(is);
is.putBack(currToken);
wordList dictKeys = parentDict.toc();
labelList indices = findStrings<word>(readList<wordRe>(is), dictKeys);
if (currToken == token::BEGIN_LIST)
forAll(indices, indexI)
{
wordList keys(is);
forAll(keys, keyI)
{
parentDict.remove(keys[keyI]);
}
}
else
{
word key(is);
parentDict.remove(key);
parentDict.remove(dictKeys[indices[indexI]]);
}
return true;

View File

@ -28,13 +28,16 @@ Class
Description
Remove a dictionary entry.
The @c \#remove directive takes a word or a list of words. For example,
The @c \#remove directive takes a list or a single wordRe.
For example,
@verbatim
#remove entry0
#remove ( entry1 entry2 entry3 )
#remove ( entry1 entry2 entry3 otherEntry )
#remove "entry[1-3]"
#remove ( "entry[1-3]" otherEntry )
@endverbatim
The removable only occurs in the current context.
The removal only occurs in the current context.
Removing sub-entries or parent entries is not supported.
SourceFiles