mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
ENH: Enabled dictionaries to be expanded in lists
This commit is contained in:
@ -28,6 +28,7 @@ License
|
||||
#include "dictionaryEntry.H"
|
||||
#include "regExp.H"
|
||||
#include "OSHA1stream.H"
|
||||
#include "DynamicList.H"
|
||||
|
||||
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
|
||||
|
||||
@ -277,6 +278,25 @@ Foam::SHA1Digest Foam::dictionary::digest() const
|
||||
}
|
||||
|
||||
|
||||
Foam::tokenList Foam::dictionary::tokens() const
|
||||
{
|
||||
// linearise dictionary into a string
|
||||
OStringStream os;
|
||||
write(os, false);
|
||||
IStringStream is(os.str());
|
||||
|
||||
// parse string as tokens
|
||||
DynamicList<token> tokens;
|
||||
token t;
|
||||
while (is.read(t))
|
||||
{
|
||||
tokens.append(t);
|
||||
}
|
||||
|
||||
return tokenList(tokens.xfer());
|
||||
}
|
||||
|
||||
|
||||
bool Foam::dictionary::found
|
||||
(
|
||||
const word& keyword,
|
||||
|
||||
@ -262,6 +262,9 @@ public:
|
||||
//- Return the SHA1 digest of the dictionary contents
|
||||
SHA1Digest digest() const;
|
||||
|
||||
//- Return the dictionary as a list of tokens
|
||||
tokenList tokens() const;
|
||||
|
||||
|
||||
// Search and lookup
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -72,7 +72,14 @@ bool Foam::primitiveEntry::expandVariable
|
||||
// ...if defined append its tokens into this
|
||||
if (ePtr)
|
||||
{
|
||||
append(ePtr->stream());
|
||||
if (ePtr->isDict())
|
||||
{
|
||||
append(ePtr->dict().tokens());
|
||||
}
|
||||
else
|
||||
{
|
||||
append(ePtr->stream());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user