#include #include #include "JLang/JCRC.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * User function. * * \param value value */ inline void fun(const std::string& value) { using namespace std; using namespace JPP; switch (crc(value)) { case crc("aap"): cout << "aap"; break; case crc("noot"): cout << "noot"; break; case crc("mies"): cout << "mies"; break; default: cout << "default"; break; } } /** * \file * * Example program to test CRC evaluation (see JCRC.hh). * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; int debug; try { JParser<> zap("Example program to test CRC evaluation."); zap['d'] = make_field(debug) = 0; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } for (string str : { "aap", "noot", "mies", "hello" }) { cout << "test \"" << str << "\" -> "; fun(str); cout << endl; } }