#include #include #include #include #include #include #include #include "JLang/JEquationParameters.hh" #include "JLang/JEquation.hh" #include "Jeep/JProperties.hh" #include "Jeep/JComment.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * General purpose program to print properties file. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; string inputFile; JEquationParameters parameters("=", ";\n", "", "#"); set key; int debug; try { JProperties properties; properties["sep"] = parameters.getSeparator(); properties["eol"] = parameters.getEndOfLine(); properties["div"] = parameters.getDivision(); properties["skip"] = parameters.getSkipLine(); properties["left"] = parameters.getLeftBracket(); properties["right"] = parameters.getRightBracket(); properties["ws"] = parameters.getWhiteSpace(); properties["cc"] = parameters.getComment(); JParser<> zap("General purpose program to print properties file."); zap['f'] = make_field(inputFile); zap['@'] = make_field(properties) = JPARSER::initialised(); zap['k'] = make_field(key, "key"); zap['d'] = make_field(debug, "debug level") = 2; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } JComment comment; const JEquationFacet facet(parameters); // input ifstream in(inputFile.c_str()); in >> comment; in.imbue(locale(in.getloc(), facet.clone())); for (JEquation equation; in >> equation; ) { DEBUG(equation << endl); for (const auto& i : key) { if (equation.getKey().find(i) == 0) { cout << ' ' << equation.getValue(); } } } in.close(); }