25 int main(
int argc,
char **argv)
30 typedef JToken<';'> token_type;
54 JParser<> zap(
"General purpose program to edit or create properties file.");
61 zap[
'w'] =
make_field(width,
"format width of key") = 12;
62 zap[
'q'] =
make_field(squash,
"squash meta data");
67 catch(
const exception &error) {
68 FATAL(error.what() << endl);
75 const JEquationFacet facet(parameters);
79 if (inputFile !=
"") {
81 ifstream
in(inputFile.c_str());
85 in.imbue(locale(
in.getloc(), facet.clone()));
87 for (JEquation equation;
in >> equation; ) {
88 data[equation.getKey()] = equation.getValue();
98 comment.add(JMeta(argc, argv));
102 if (!modifier.empty()) {
106 is.imbue(locale(is.getloc(), facet.clone()));
108 for (
const token_type& token : modifier) {
115 if (is >> equation && facet.isSeparator(equation.getSeparator()))
116 data[equation.getKey()] = equation.getValue();
118 ERROR(
"Invalid modifier: " << token << endl);
124 for (
const string& key :
rm) {
128 if (i !=
data.end()) {
142 ostream os(buffer.is_open() ? &buffer : cout.rdbuf());
146 os.imbue(locale(cout.getloc(), facet.clone()));
148 for (
const auto& item :
data) {
149 os << setw(width) << left << item.first << right << facet.getDefaultWhiteSpace()
150 << facet.getSeparator() << facet.getDefaultWhiteSpace()
151 << item.second << facet.getEndOfLine();
Utility class to parse command line options.
const std::string & getEndOfLine() const
Get end of line characters.
int main(int argc, char *argv[])
Utility class to parse parameter values.
const std::string & getSeparator() const
Get separator characters.
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Simple data structure to support I/O of equations (see class JLANG::JEquation).
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Utility class to parse parameter values.
char getRightBracket() const
Get right bracket.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
char getLeftBracket() const
Get left bracket.
const std::string & getDivision() const
Get division characters.
const std::string & getComment() const
Get comment string.
General purpose messaging.
const std::string & getSkipLine() const
Get skip line characters.
then fatal The output file must have the wildcard in the e g root fi eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Utility class to parse command line options.
const std::string & getWhiteSpace() const
Get white space characters.