From 340fcebaede1c64245c8cd33929ae686862a9239 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 18 Nov 2008 21:08:03 +0000 Subject: [PATCH] demonstrate wildcard --- applications/test/dictionary/dictionaryTest.C | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/applications/test/dictionary/dictionaryTest.C b/applications/test/dictionary/dictionaryTest.C index 6064102781..37ae9bd90c 100644 --- a/applications/test/dictionary/dictionaryTest.C +++ b/applications/test/dictionary/dictionaryTest.C @@ -45,6 +45,27 @@ int main(int argc, char *argv[]) Info<< testDict << endl; + { + dictionary someDict; + someDict.add(keyType("a.*", true), "subdictValue"); + + dictionary dict; + dict.add("someDict", someDict); + dict.add(keyType(".*", true), "parentValue"); + + Info<< "dict:" << dict << endl; + + // Wildcard find. + Info<< "Wildcard find \"abc\" in top directory : " + << dict.lookup("abc") << endl; + Info<< "Wildcard find \"abc\" in sub directory : " + << dict.subDict("someDict").lookup("abc") + << endl; + Info<< "Recursive wildcard find \"def\" in sub directory : " + << dict.subDict("someDict").lookup("def", true) + << endl; + } + return 0; }