1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
#include <iostream>
#include <algorithm>
#include <iterator>
#include <bobcat/mstream>
using namespace std;
using namespace FBB;
int main(int argc, char **argv)
try
{
cout << sizeof(Mstream) << ' ' << sizeof(Mbuf) << '\n';
imsg << "Informational: " << endl;
imsg.off();
cout << "The i-msg stream is now off. This message should appear once" <<
endl;
imsg << "The i-msg stream is now off. This message should appear once" <<
endl;
imsg << "The i-msg stream is now off. This message should appear once" <<
endl;
cout << "But this message is shown" << endl;
wmsg << "Warning message" << endl;
emsg << "Oops, this this is an error (not really)" << endl;
emsg << "Oops, this goes wrong, too" << noid;
imsg.on();
imsg << "And another informational msg: " << emsg.count() <<
" error messages\n" << flush;
emsg << "Third error" << endl;
emsg.setMaxCount(3);
imsg << "Msg in between" << endl;
imsg.setTag("tag");
imsg << "tagged message" << endl;
imsg.setTag("label");
imsg << "labeled message" << endl;
cerr << "(cerr) LineExcess: " << emsg.lineExcess() << ", count = " <<
emsg.count() << endl;
emsg << "Fourth error\n" << noid; // no id is shown
emsg << "Fourth error\n" << flush; // shows id (remove the previous
// statement)
cerr << "(cerr) LineExcess: " << emsg.lineExcess() << ", count = " <<
emsg.count() << endl;
cerr << "Beyond\n";
}
catch(exception const &e)
{
std::cerr << "Got a std::exception: " << e.what() << '\n';
}
catch(...)
{
std::cerr << "Got an exception\n";
}
|