#include #include #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" #include "JLang/JPrintHelper.hh" #include "JLang/JStreamAvailable.hh" namespace { struct __A__ { const char* __str__() const { return "__A__::__str__()"; } }; struct __B__ { friend std::ostream& operator<<(std::ostream& out, const __B__& object) { return out << "__B__::operator<<()"; } }; struct __C__ { const char* __str__() const { return "__C__::__str__()"; } friend std::ostream& operator<<(std::ostream& out, const __C__& object) { return out << "__C__::operator<<()"; } }; struct __D__ {}; } /** * \file * * Example program to test JLANG::JPrintHelper class. * \author mdejong */ int main(int argc, char **argv) { using namespace std; int debug; try { JParser<> zap("Example program to test print helper."); zap['d'] = make_field(debug) = 0; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } __A__ a; __B__ b; __C__ c; //__D__ d; cout << JStreamAvailable<__A__>::has_ostream << endl; cout << JStreamAvailable<__B__>::has_ostream << endl; cout << JStreamAvailable<__C__>::has_ostream << endl; cout << JStreamAvailable<__D__>::has_ostream << endl; cout << a << endl; cout << b << endl; cout << c << endl; //cout << d << endl; // compiler error }