ISstream::getLine: continuation lines are now optional

This commit is contained in:
Henry Weller
2021-01-14 12:33:15 +00:00
parent 58ae03c9eb
commit b5fd577934
3 changed files with 9 additions and 7 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -769,13 +769,13 @@ Foam::Istream& Foam::ISstream::readVerbatim(verbatimString& str)
}
Foam::ISstream& Foam::ISstream::getLine(string& s)
Foam::ISstream& Foam::ISstream::getLine(string& s, const bool continuation)
{
getline(is_, s);
setState(is_.rdstate());
lineNumber_++;
while (s.back() == '\\')
while (continuation && s.back() == '\\')
{
string contLine;
getline(is_, contLine);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -133,7 +133,8 @@ public:
inline ISstream& putback(const char&);
//- Read line into a string
ISstream& getLine(string&);
// with optional support for continuation lines
ISstream& getLine(string&, const bool continuation = true);
//- Read a '(...)' delimited set of characters into a string
Istream& readList(string&);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -126,7 +126,8 @@ void Foam::dynamicCode::copyAndFilter
string line;
do
{
is.getLine(line);
// Read the next line without continuation
is.getLine(line, false);
// Expand according to mapping.
// Expanding according to env variables might cause too many