Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JEcho.cc File Reference

Auxiliary program to echo (reverted) string. More...

#include <string>
#include <iostream>
#include <iomanip>
#include <algorithm>
#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

Auxiliary program to echo (reverted) string.

Author
mdejong

Definition in file JEcho.cc.

Function Documentation

◆ main()

int main ( int argc,
char * argv[] )

Definition at line 16 of file JEcho.cc.

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}
#define FATAL(A)
Definition JMessage.hh:67
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Utility class to parse command line options.
Definition JParser.hh:1698
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
Definition JString.hh:478