26{
29
31
32 string inputFile;
37 int width;
38 bool squash;
40
41 try {
42
44
53
54 JParser<> zap(
"General purpose program to edit or create properties file.");
55
64
66 }
67 catch(const exception &error) {
69 }
70
71
74
76
77
78
79 if (inputFile != "") {
80
81 ifstream in(inputFile.c_str());
82
83 in >> comment;
84
85 in.imbue(locale(in.getloc(), facet.clone()));
86
87 for (
JEquation equation; in >> equation; ) {
88 data[equation.getKey()] = equation.getValue();
89 }
90
91 in.close();
92 }
93
94 if (squash) {
95 comment.clear();
96 }
97
99
100
101
103
105
106 is.imbue(locale(is.getloc(), facet.
clone()));
107
109
110 is.clear();
112
114
115 if (is >> equation && facet.isSeparator(equation.
getSeparator()))
117 else
119 }
120 }
121
123
124 for (
const string& key :
rm) {
125
127
128 if (i !=
data.end()) {
130 }
131 }
132 }
133
134
135
137
140 }
141
142 ostream os(buffer.is_open() ? &buffer :
cout.rdbuf());
143
144 os << comment;
145
146 os.imbue(locale(
cout.getloc(), facet.
clone()));
147
149 os <<
setw(width) << left <<
item.first << right << facet.getDefaultWhiteSpace()
150 << facet.getSeparator() << facet.getDefaultWhiteSpace()
151 <<
item.second << facet.getEndOfLine();
152 }
153
154 buffer.close();
155}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Utility class to parse parameter values.
Facet class to specify parsing of equations in currect locale (see class JLANG::JEquation).
Simple data structure to support I/O of equations (see class JLANG::JEquation).
const std::string & getSkipLine() const
Get skip line characters.
const std::string & getComment() const
Get comment string.
const std::string & getEndOfLine() const
Get end of line characters.
const std::string & getSeparator() const
Get separator characters.
char getLeftBracket() const
Get left bracket.
char getRightBracket() const
Get right bracket.
const std::string & getDivision() const
Get division characters.
const std::string & getWhiteSpace() const
Get white space characters.
General purpose equation class.
const std::string & getKey() const
Get key.
const std::string & getValue() const
Get value.
const char getSeparator() const
Get separator.
Wrapper class around string.
Template definition of a multi-dimensional oscillation probability interpolation table.
Utility class to parse command line options.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
virtual clone_type clone() const override
Get clone of this object.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...