mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
The #remove directive can now take a wordRe type
This commit is contained in:
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user