Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JProperties-sed.cc File Reference

Example program to test JPROPERTIES::JProperties class. More...

#include <iostream>
#include <iomanip>
#include "JLang/JCategory.hh"
#include "Jeep/JProperties.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to test JPROPERTIES::JProperties class.

Author
mdejong

Definition in file JProperties-sed.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 125 of file JProperties-sed.cc.

126{
127 using namespace std;
128
129 string buffer;
130 string format;
131 int debug;
132
133 try {
134
135 JParser<> zap;
136
137 zap['f'] = make_field(buffer);
138 zap['F'] = make_field(format);
139 zap['d'] = make_field(debug) = 3;
140
141 zap(argc, argv);
142 }
143 catch(const exception &error) {
144 FATAL(error.what() << endl);
145 }
146
147
148 JABC test(10, 20, 30, 40, 50);
149
150 ASSERT(buffer != "");
151 ASSERT(format != "");
152
153 DEBUG("test: " << endl);
154 DEBUG(getProperties(test));
155
156 DEBUG("processing " << buffer << endl);
157
158 istringstream is(buffer);
159
160 is >> getProperties(test);
161
162 DEBUG("test: " << endl);
163 DEBUG(getProperties(test));
164
165 DEBUG("format " << format << endl);
166
167 JProperties properties = getProperties(test);
168
169 DEBUG("--> " << properties.sed(format, "%") << endl);
170
171 // output for test
172
173 cout << properties.sed(format, "%") << flush;
174
175 return 0;
176}
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define ASSERT(A,...)
Assert macro.
Definition JMessage.hh:90
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Utility class to parse parameter values.
std::string sed(const std::string &format, const std::string &prefix="", const std::string &postfix="")
Stream editing of input format.
Utility class to parse command line options.
Definition JParser.hh:1698
JProperties & getProperties(T &object, const JEquationParameters &parameters=JEquationParameters(), const int debug=1)
Get properties of a given object.