Jpp
16.0.2
the software that should make you happy
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JSystem
JShell.cc
Go to the documentation of this file.
1
2
#include <string>
3
#include <iostream>
4
#include <iomanip>
5
6
#include "
JSystem/JShell.hh
"
7
#include "
JSystem/JSystemToolkit.hh
"
8
9
#include "
Jeep/JParser.hh
"
10
#include "
Jeep/JMessage.hh
"
11
12
13
/**
14
* \file
15
*
16
* Example program to test shell I/O (class JSYSTEM::JShell).
17
* \author mdejong
18
*/
19
int
main
(
int
argc,
char
**argv)
20
{
21
using namespace
std;
22
23
int
debug
;
24
25
try
{
26
27
JParser<>
zap(
"Example program to test shell I/O."
);
28
29
zap[
'd'
] =
make_field
(
debug
) = 3;
30
31
zap(argc, argv);
32
}
33
catch
(
const
exception &error) {
34
FATAL
(error.what() << endl);
35
}
36
37
38
using namespace
JPP;
39
40
JShell shell;
41
42
for
(
string
buffer; shell; ) {
43
44
cout <<
"> "
<< flush;
45
46
getline
(cin, buffer);
47
48
if
(buffer !=
""
&& buffer !=
"exit"
) {
49
50
shell << buffer << endl;
51
52
while
(shell.getline(buffer)) {
53
cout << buffer << endl;
54
}
55
56
}
else
{
57
break
;
58
}
59
}
60
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1500
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1961
JLANG::getline
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
Definition:
JString.hh:478
debug
int debug
debug level
Definition:
JSirene.cc:63
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JParser.hh
Utility class to parse command line options.
JShell.hh
Shell interaction via I/O streams.
JSystemToolkit.hh
System auxiliaries.
Generated by
1.8.5