state.C
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
00031 #include "error.H"
00032 #include "token.H"
00033 #include "int.H"
00034
00035
00036
00037
00038 void Foam::state(ostream& to, const string& s)
00039 {
00040 state_value osState = state_value(to.rdstate());
00041
00042 switch (osState)
00043 {
00044 case _good:
00045 break;
00046
00047 case _eof:
00048 Info
00049 << "Output stream: premature end of stream", s << endl;
00050 break;
00051
00052 case _fail:
00053 SeriousErrorIn("state(ostream& to, const string& s)")
00054 << "Output stream failure (bad format?)", s << endl;
00055 break;
00056
00057 case (_fail + _eof) :
00058 SeriousErrorIn("state(ostream& to, const string& s)")
00059 << "Output stream failure and end of stream", s << endl;
00060 break;
00061
00062 case _bad:
00063 SeriousErrorIn("state(ostream& to, const string& s)")
00064 << "Serious output stream failure", s << endl;
00065 break;
00066
00067 default:
00068 SeriousErrorIn("state(ostream& to, const string& s)")
00069 << "Output stream failure of unknown type", s << endl
00070 << "Stream state value = ", osState << endl;
00071 break;
00072 }
00073
00074 return;
00075 }
00076
00077
00078
00079 void Foam::state(istream& from, const string& s)
00080 {
00081 state_value isState = state_value(from.rdstate());
00082
00083 switch (isState)
00084 {
00085 case _good:
00086 break;
00087
00088 case _eof:
00089 Info
00090 << "Input stream: premature end of stream", s << endl;
00091 Info<< "If all else well, possibly a quote mark missing" << endl;
00092 break;
00093
00094 case _fail:
00095 SeriousErrorIn("state(istream& from, const string& s)")
00096 << "Input stream failure (bad format?)", s << endl;
00097 Info<< "If all else well, possibly a quote mark missing" << endl;
00098 break;
00099
00100 case (_fail + _eof) :
00101 SeriousErrorIn("state(istream& from, const string& s)")
00102 << "Input stream failure and end of stream", s << endl;
00103 Info<< "If all else well, possibly a quote mark missing" << endl;
00104 break;
00105
00106 case _bad:
00107 SeriousErrorIn("state(istream& from, const string& s)")
00108 << "Serious input stream failure", s << endl;
00109 break;
00110
00111 default:
00112 SeriousErrorIn("state(istream& from, const string& s)")
00113 << "Input stream failure of unknown type", s << endl;
00114 SeriousErrorIn("state(istream& from, const string& s)")
00115 << "Stream state value = ", isState << endl;
00116 break;
00117 }
00118
00119 return;
00120 }
00121
00122
00123
Copyright © 2000-2009 OpenCFD Ltd