#include #include #include #include "Jeep/JeepToolkit.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Example program to test file name handling using Jeep/JeepToolkit.hh. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; string file_name; int debug; JArgs args; try { JParser<> zap("Example program to test file name handling."); zap['f'] = make_field(file_name, "input file name") = ""; zap['d'] = make_field(debug, "debug level") = 1, 0, 2, 3; // default value, and possible values args = zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } cout << "file name " << getFilename(argv[0]) << endl; cout << "path " << getPath(argv[0]) << endl; cout << "file name " << getFilename(getPath(argv[0]), getFilename(argv[0])) << endl; if (file_name != "") { cout << "file name " << file_name << endl; cout << "path " << getPath(file_name) << endl; cout << "extension " << getFilenameExtension(file_name) << endl; cout << "protocol " << getProtocol(file_name) << endl; } if (!args.empty()) { cout << "Pending arguments" << endl; cout << args << endl; } }