BUG: Ostream: streaming of unexpanded variables over processorstreams

This commit is contained in:
mattijs
2013-03-05 15:58:32 +00:00
parent 1cf9d85b87
commit cb74377832
5 changed files with 27 additions and 7 deletions

View File

@ -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
@ -172,6 +172,13 @@ Foam::Istream& Foam::UIPstream::read(token& t)
t.type() = token::VERBATIMSTRING;
return *this;
}
case token::VARIABLE :
{
// Recurse to read actual string
read(t);
t.type() = token::VARIABLE;
return *this;
}
case token::STRING :
{
string* pval = new string;

View File

@ -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
@ -159,6 +159,11 @@ Foam::Ostream& Foam::UOPstream::write(const token& t)
write(char(token::VERBATIMSTRING));
write(t.stringToken());
}
else if (t.type() == token::VARIABLE)
{
write(char(token::VARIABLE));
write(t.stringToken());
}
else
{
notImplemented("Ostream& UOPstream::write(const token&)");

View File

@ -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
@ -39,6 +39,10 @@ Foam::Ostream& Foam::OSstream::write(const token& t)
write(char(token::HASH));
write(char(token::END_BLOCK));
}
else if (t.type() == token::VARIABLE)
{
writeQuoted( t.stringToken(), false);
}
return *this;
}

View File

@ -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
@ -75,6 +75,10 @@ Foam::Ostream& Foam::prefixOSstream::write(const token& t)
write(char(token::HASH));
write(char(token::END_BLOCK));
}
else if (t.type() == token::VARIABLE)
{
writeQuoted(t.stringToken(), false);
}
return *this;
}

View File

@ -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
@ -75,8 +75,8 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const token& t)
break;
case token::VARIABLE:
// Write variable as word so without ""
os.writeQuoted(*t.stringTokenPtr_, false);
// Behaviour differs according to stream type
os.write(t);
break;
case token::LABEL: