Jpp  15.0.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JEcho.cc
Go to the documentation of this file.
1 #include <string>
2 #include <iostream>
3 #include <iomanip>
4 #include <algorithm>
5 
6 #include "Jeep/JParser.hh"
7 #include "Jeep/JMessage.hh"
8 
9 
10 /**
11  * \file
12  *
13  * Auxiliary program to echo (reverted) string.
14  * \author mdejong
15  */
16 int main(int argc, char* argv[])
17 {
18  using namespace std;
19 
20  bool revert;
21 
22  try {
23 
24  JParser<> zap("Auxiliary program to echo (reverted) string.");
25 
26  zap['r'] = make_field(revert);
27 
28  zap(argc, argv);
29  }
30  catch(const exception &error) {
31  FATAL(error.what() << endl);
32  }
33 
34 
35  string buffer;
36 
37  while (getline(cin,buffer) && buffer != "") {
38 
39  if (revert)
40  reverse(buffer.begin(), buffer.end());
41 
42  cout << buffer << endl;
43  }
44 }
Utility class to parse command line options.
Definition: JParser.hh:1500
int main(int argc, char *argv[])
Definition: Main.cc:15
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
Definition: JString.hh:478
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Utility class to parse command line options.