mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: subdict output with leading name (issue #255)
- Introduce dictionary::writeEntries for better code-reuse.
Before
======
os << nl << indent << "name";
dict.write(os);
After
=====
dict.write(os, "name");
This commit is contained in:
@ -48,14 +48,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
{
|
||||
dictionary dict;
|
||||
dict.add("aaOPENMPIcc", 1);
|
||||
dict.add(word("aa" + getEnv("WM_MPLIB") + "cc"), 16);
|
||||
|
||||
string s("DDD${aa${WM_MPLIB}cc}EEE");
|
||||
stringOps::inplaceExpand(s, dict, true, false);
|
||||
Info<< "variable expansion:" << s << endl;
|
||||
}
|
||||
|
||||
|
||||
Info<< nl
|
||||
<< "FOAM_CASE=" << getEnv("FOAM_CASE") << nl
|
||||
<< "FOAM_CASENAME=" << getEnv("FOAM_CASENAME") << nl
|
||||
@ -65,7 +64,9 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
{
|
||||
dictionary dict1(IFstream("testDict")());
|
||||
Info<< "dict1: " << dict1 << nl
|
||||
dict1.writeEntry("dict1", Info);
|
||||
|
||||
Info<< nl
|
||||
<< "toc: " << dict1.toc() << nl
|
||||
<< "keys: " << dict1.keys() << nl
|
||||
<< "patterns: " << dict1.keys(true) << endl;
|
||||
@ -89,14 +90,14 @@ int main(int argc, char *argv[])
|
||||
<< "no = " << dict4.name() << " " << dict4.toc() << endl;
|
||||
}
|
||||
|
||||
|
||||
IOobject::writeDivider(Info);
|
||||
|
||||
{
|
||||
dictionary dict(IFstream("testDictRegex")());
|
||||
dict.add(keyType("fooba[rz]", true), "anything");
|
||||
|
||||
Info<< "dict:" << dict << nl
|
||||
dict.writeEntry("testDictRegex", Info);
|
||||
Info<< nl
|
||||
<< "toc: " << dict.toc() << nl
|
||||
<< "keys: " << dict.keys() << nl
|
||||
<< "patterns: " << dict.keys(true) << endl;
|
||||
|
||||
Reference in New Issue
Block a user