#include <string>
#include <iostream>
#include <sstream>
#include <iomanip>
#include "JLang/JRedirectStream.hh"
#include "JLang/JNullStream.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
Go to the source code of this file.
|
int | main (int argc, char **argv) |
|
Example program to test JLANG::JRedirectStream class.
- Author
- mdejong
Definition in file JRedirectStream.cc.
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 20 of file JRedirectStream.cc.
28 JParser<> zap(
"Example program to test redirection of I/O streams.");
34 catch(
const exception &error) {
35 FATAL(error.what() << endl);
41 string message =
"hello world";
48 NOTICE(
"The message <" << message <<
"> is re-directed to <null> if debug < " <<
JEEP::debug_t << endl);
50 JRedirectStream redirect(cout, (
debug >=
JEEP::debug_t) ? static_cast<ostream&>(os) :
null);
52 cout << message << flush;
55 NOTICE(
"result <" << os.str() <<
">" << endl);
62 NOTICE(
"The following input message is re-directed to <null> if debug < " <<
JEEP::debug_t << endl);
64 JRedirectStream redirect(cin, (
debug >=
JEEP::debug_t) ? static_cast<istream&>(is) :
null);
68 DEBUG(
"message <" << message <<
">" << endl);
71 NOTICE(
"result <" << is.str() <<
">" << endl);