From b5fd57793472ff2adb028871ac154da95befcea8 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Thu, 14 Jan 2021 12:33:15 +0000 Subject: [PATCH] ISstream::getLine: continuation lines are now optional --- src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C | 6 +++--- src/OpenFOAM/db/IOstreams/Sstreams/ISstream.H | 5 +++-- src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C | 5 +++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C index 6d7bdaf903..c1dec2e0ab 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C +++ b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C @@ -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); diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.H b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.H index 597f9ae184..11aeac7043 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.H +++ b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.H @@ -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&); diff --git a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C index 0e95dc4cc6..5ac5b505c8 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C +++ b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C @@ -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