23 int main(
int argc,
char **argv)
28 typedef JToken<';'> token_type;
38 JParser<> zap(
"General purpose program to edit or create properties file.");
43 zap[
'w'] =
make_field(width,
"format width of key") = 12;
48 catch(
const exception &error) {
49 FATAL(error.what() << endl);
56 const JEquationFacet facet(JEquationParameters(
"=",
";\n",
"",
"#"));
60 if (inputFile !=
"") {
62 ifstream
in(inputFile.c_str());
66 in.imbue(locale(
in.getloc(), facet.clone()));
68 for (JEquation equation;
in >> equation; ) {
69 data[equation.getKey()] = equation.getValue();
75 comment.add(JMeta(argc, argv));
79 if (!modifier.empty()) {
83 is.imbue(locale(is.getloc(), facet.clone()));
85 for (
const token_type& token : modifier) {
92 if (is >> equation && facet.isSeparator(equation.getSeparator()))
93 data[equation.getKey()] = equation.getValue();
95 ERROR(
"Invalid modifier: " << token << endl);
107 ostream os(buffer.is_open() ? &buffer : cout.rdbuf());
111 os.imbue(locale(cout.getloc(), facet.clone()));
113 for (
const auto& item : data) {
114 os << setw(width) << left << item.first << right << facet.getDefaultWhiteSpace()
115 << facet.getSeparator() << facet.getDefaultWhiteSpace()
116 << item.second << facet.getEndOfLine();
Utility class to parse command line options.
int main(int argc, char *argv[])
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
General purpose messaging.
Utility class to parse command line options.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in