mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: dangling dictionary reference for expression BCs
- exposed by the new embedded function handling. Requires local copies of dictionary content instead (similar to coded BCs handling) BUG: incorrect formatting for expression function output ENH: simpler copyDict version taking wordList instead of wordRes - corresponds to the most common use case at the moment ENH: expression string writeEntry method - write as verbatim for better readability
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -86,4 +86,36 @@ Foam::expressions::exprString::expand
|
||||
}
|
||||
|
||||
|
||||
bool Foam::expressions::exprString::writeEntry
|
||||
(
|
||||
const word& keyword,
|
||||
Ostream& os,
|
||||
bool writeEmpty
|
||||
) const
|
||||
{
|
||||
const bool ok = (writeEmpty || !empty());
|
||||
|
||||
if (ok)
|
||||
{
|
||||
if (!keyword.empty())
|
||||
{
|
||||
os.writeKeyword(keyword);
|
||||
}
|
||||
|
||||
// Write as regular or verbatim string
|
||||
|
||||
token tok(*this);
|
||||
if (!empty())
|
||||
{
|
||||
tok.setType(token::tokenType::VERBATIM);
|
||||
}
|
||||
|
||||
os.write(tok);
|
||||
os.endEntry();
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -183,6 +183,19 @@ public:
|
||||
|
||||
//- Move assign from string. No expansions, no comment stripping
|
||||
inline exprString& operator=(std::string&& str);
|
||||
|
||||
|
||||
// Write
|
||||
|
||||
//- Dictionary entry for expression string, normally suppressing
|
||||
//- empty strings. Generally used verbatim output (readability)
|
||||
// \return true if entry was written
|
||||
bool writeEntry
|
||||
(
|
||||
const word& keyword,
|
||||
Ostream& os,
|
||||
bool writeEmpty = false
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user