Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include <OpenFOAM/error.H>
00031 #include <OpenFOAM/token.H>
00032 #include <OpenFOAM/int.H>
00033
00034
00035
00036
00037 void Foam::state(ostream& to, const string& s)
00038 {
00039 state_value osState = state_value(to.rdstate());
00040
00041 switch (osState)
00042 {
00043 case _good:
00044 break;
00045
00046 case _eof:
00047 Info
00048 << "Output stream: premature end of stream", s << endl;
00049 break;
00050
00051 case _fail:
00052 SeriousErrorIn("state(ostream& to, const string& s)")
00053 << "Output stream failure (bad format?)", s << endl;
00054 break;
00055
00056 case (_fail + _eof) :
00057 SeriousErrorIn("state(ostream& to, const string& s)")
00058 << "Output stream failure and end of stream", s << endl;
00059 break;
00060
00061 case _bad:
00062 SeriousErrorIn("state(ostream& to, const string& s)")
00063 << "Serious output stream failure", s << endl;
00064 break;
00065
00066 default:
00067 SeriousErrorIn("state(ostream& to, const string& s)")
00068 << "Output stream failure of unknown type", s << endl
00069 << "Stream state value = ", osState << endl;
00070 break;
00071 }
00072
00073 return;
00074 }
00075
00076
00077
00078 void Foam::state(istream& from, const string& s)
00079 {
00080 state_value isState = state_value(from.rdstate());
00081
00082 switch (isState)
00083 {
00084 case _good:
00085 break;
00086
00087 case _eof:
00088 Info
00089 << "Input stream: premature end of stream", s << endl;
00090 Info<< "If all else well, possibly a quote mark missing" << endl;
00091 break;
00092
00093 case _fail:
00094 SeriousErrorIn("state(istream& from, const string& s)")
00095 << "Input stream failure (bad format?)", s << endl;
00096 Info<< "If all else well, possibly a quote mark missing" << endl;
00097 break;
00098
00099 case (_fail + _eof) :
00100 SeriousErrorIn("state(istream& from, const string& s)")
00101 << "Input stream failure and end of stream", s << endl;
00102 Info<< "If all else well, possibly a quote mark missing" << endl;
00103 break;
00104
00105 case _bad:
00106 SeriousErrorIn("state(istream& from, const string& s)")
00107 << "Serious input stream failure", s << endl;
00108 break;
00109
00110 default:
00111 SeriousErrorIn("state(istream& from, const string& s)")
00112 << "Input stream failure of unknown type", s << endl;
00113 SeriousErrorIn("state(istream& from, const string& s)")
00114 << "Stream state value = ", isState << endl;
00115 break;
00116 }
00117
00118 return;
00119 }
00120
00121
00122