General purpose program to edit or create properties file.  
More...
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include "JLang/JEquationParameters.hh"
#include "JLang/JEquation.hh"
#include "JLang/JToken.hh"
#include "JSupport/JMeta.hh"
#include "Jeep/JComment.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
 
Go to the source code of this file.
 | 
| int  | main (int argc, char **argv) | 
|   | 
General purpose program to edit or create properties file. 
- Author
 - mdejong 
 
Definition in file JEditProperties.cc.
 
      
        
          | int main  | 
          ( | 
          int  | 
          argc,  | 
        
        
           | 
           | 
          char **  | 
          argv  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 24 of file JEditProperties.cc.
   29   typedef JToken<';'>  token_type;
 
   41     JParser<> zap(
"General purpose program to edit or create properties file.");
 
   47     zap[
'w'] = 
make_field(width,       
"format width of key")                                                      =  12;
 
   48     zap[
'q'] = 
make_field(squash,      
"squash meta data");
 
   53   catch(
const exception &error) {
 
   54     FATAL(error.what() << endl);
 
   61   const JEquationFacet facet(JEquationParameters(
"=", 
";\n", 
"", 
"#"));
 
   65   if (inputFile != 
"") {
 
   67     ifstream 
in(inputFile.c_str());
 
   71     in.imbue(locale(
in.getloc(), facet.clone()));
 
   73     for (JEquation equation; 
in >> equation; ) {
 
   74       data[equation.getKey()] = equation.getValue();
 
   84   comment.add(JMeta(argc, argv));
 
   88   if (!modifier.empty()) {
 
   92     is.imbue(locale(is.getloc(), facet.clone()));
 
   94     for (
const token_type& token : modifier) {
 
  101       if (is >> equation && facet.isSeparator(equation.getSeparator()))
 
  102         data[equation.getKey()] = equation.getValue();
 
  104         ERROR(
"Invalid modifier: " << token << endl);
 
  110     for (
const string& key : 
rm) {
 
  114       if (i != 
data.end()) {
 
  128   ostream os(buffer.is_open() ? &buffer : cout.rdbuf());
 
  132   os.imbue(locale(cout.getloc(), facet.clone()));
 
  134   for (
const auto& item : 
data) {
 
  135     os << setw(width) << left << item.first << right << facet.getDefaultWhiteSpace() 
 
  136        << facet.getSeparator()                       << facet.getDefaultWhiteSpace() 
 
  137        << item.second                                << facet.getEndOfLine();
 
Utility class to parse command line options. 
 
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 
 
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 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