1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 Implementation of parser: test the state of either an istream or an
26 ostream. Report an error if there is one.
28 \*---------------------------------------------------------------------------*/
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 // Print state of ostream.
37 void Foam::state(ostream& to, const string& s)
39 state_value osState = state_value(to.rdstate());
43 case _good: // Do not anything 'unusual'.
48 << "Output stream: premature end of stream", s << endl;
52 SeriousErrorIn("state(ostream& to, const string& s)")
53 << "Output stream failure (bad format?)", s << endl;
57 SeriousErrorIn("state(ostream& to, const string& s)")
58 << "Output stream failure and end of stream", s << endl;
62 SeriousErrorIn("state(ostream& to, const string& s)")
63 << "Serious output stream failure", s << endl;
67 SeriousErrorIn("state(ostream& to, const string& s)")
68 << "Output stream failure of unknown type", s << endl
69 << "Stream state value = ", osState << endl;
77 // Print state of istream.
78 void Foam::state(istream& from, const string& s)
80 state_value isState = state_value(from.rdstate());
84 case _good: // Do not anything 'unusual'.
89 << "Input stream: premature end of stream", s << endl;
90 Info<< "If all else well, possibly a quote mark missing" << endl;
94 SeriousErrorIn("state(istream& from, const string& s)")
95 << "Input stream failure (bad format?)", s << endl;
96 Info<< "If all else well, possibly a quote mark missing" << endl;
100 SeriousErrorIn("state(istream& from, const string& s)")
101 << "Input stream failure and end of stream", s << endl;
102 Info<< "If all else well, possibly a quote mark missing" << endl;
106 SeriousErrorIn("state(istream& from, const string& s)")
107 << "Serious input stream failure", s << endl;
111 SeriousErrorIn("state(istream& from, const string& s)")
112 << "Input stream failure of unknown type", s << endl;
113 SeriousErrorIn("state(istream& from, const string& s)")
114 << "Stream state value = ", isState << endl;
122 // ************************************************************************* //