1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 Implementation of parser: test the state of either an istream or an
27 ostream. Report an error if there is one.
29 \*---------------------------------------------------------------------------*/
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 // Print state of ostream.
38 void Foam::state(ostream& to, const string& s)
40 state_value osState = state_value(to.rdstate());
44 case _good: // Do not anything 'unusual'.
49 << "Output stream: premature end of stream", s << endl;
53 SeriousErrorIn("state(ostream& to, const string& s)")
54 << "Output stream failure (bad format?)", s << endl;
58 SeriousErrorIn("state(ostream& to, const string& s)")
59 << "Output stream failure and end of stream", s << endl;
63 SeriousErrorIn("state(ostream& to, const string& s)")
64 << "Serious output stream failure", s << endl;
68 SeriousErrorIn("state(ostream& to, const string& s)")
69 << "Output stream failure of unknown type", s << endl
70 << "Stream state value = ", osState << endl;
78 // Print state of istream.
79 void Foam::state(istream& from, const string& s)
81 state_value isState = state_value(from.rdstate());
85 case _good: // Do not anything 'unusual'.
90 << "Input stream: premature end of stream", s << endl;
91 Info<< "If all else well, possibly a quote mark missing" << endl;
95 SeriousErrorIn("state(istream& from, const string& s)")
96 << "Input stream failure (bad format?)", s << endl;
97 Info<< "If all else well, possibly a quote mark missing" << endl;
100 case (_fail + _eof) :
101 SeriousErrorIn("state(istream& from, const string& s)")
102 << "Input stream failure and end of stream", s << endl;
103 Info<< "If all else well, possibly a quote mark missing" << endl;
107 SeriousErrorIn("state(istream& from, const string& s)")
108 << "Serious input stream failure", s << endl;
112 SeriousErrorIn("state(istream& from, const string& s)")
113 << "Input stream failure of unknown type", s << endl;
114 SeriousErrorIn("state(istream& from, const string& s)")
115 << "Stream state value = ", isState << endl;
123 // ************************************************************************* //