Jpp
18.0.0-rc.1
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
JLang
JRedirectString.cc
Go to the documentation of this file.
1
2
#include <string>
3
#include <iostream>
4
#include <iomanip>
5
6
#include "
JLang/JRedirectString.hh
"
7
8
#include "
Jeep/JParser.hh
"
9
#include "
Jeep/JMessage.hh
"
10
11
12
/**
13
* \file
14
*
15
* Example program to test JLANG::JRedirectString class.
16
* \author mdejong
17
*/
18
int
main
(
int
argc,
char
**argv)
19
{
20
using namespace
std;
21
22
string
message;
23
int
debug
;
24
25
try
{
26
27
JParser<>
zap(
"Example program to test redirection of I/O streams."
);
28
29
zap[
'm'
] =
make_field
(message);
30
zap[
'd'
] =
make_field
(
debug
) = 3;
31
32
zap(argc, argv);
33
}
34
catch
(
const
exception &error) {
35
FATAL
(error.what() << endl);
36
}
37
38
39
using namespace
JPP;
40
41
string
buffer;
42
43
{
44
JRedirectString redirect(cin, message);
45
46
getline
(cin, buffer);
47
}
48
49
DEBUG
(
"Message "
<< message << endl);
50
DEBUG
(
"Redirect "
<< buffer << endl);
51
52
ASSERT
(message == buffer);
53
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1514
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
ASSERT
#define ASSERT(A,...)
Assert macro.
Definition:
JMessage.hh:90
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1989
JLANG::getline
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
Definition:
JString.hh:478
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JParser.hh
Utility class to parse command line options.
JRedirectString.hh
debug
int debug
debug level
Definition:
archive-put-wiki-detectors.sh:92
DEBUG
#define DEBUG(A)
Message macros.
Definition:
JMessage.hh:62
Generated by
1.8.5