Jpp
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
Jeep
Jeep.cc
Go to the documentation of this file.
1
#include <iostream>
2
#include <iomanip>
3
#include <string>
4
5
#include "
Jeep/JeepToolkit.hh
"
6
#include "
Jeep/JParser.hh
"
7
#include "
Jeep/JMessage.hh
"
8
9
10
/**
11
* \file
12
*
13
* Example program to test file name handling using Jeep/JeepToolkit.hh.
14
* \author mdejong
15
*/
16
int
main
(
int
argc,
char
**argv)
17
{
18
using namespace
std;
19
using namespace
JPP;
20
21
string
file_name;
22
int
debug
;
23
JArgs args;
24
25
try
{
26
27
JParser<>
zap(
"Example program to test file name handling."
);
28
29
zap[
'f'
] =
make_field
(file_name,
"input file name"
) =
""
;
30
zap[
'd'
] =
make_field
(
debug
,
"debug level"
) = 1, 0, 2, 3;
// default value, and possible values
31
32
args = zap(argc, argv);
33
}
34
catch
(
const
exception &error) {
35
FATAL
(error.what() << endl);
36
}
37
38
cout <<
"file name "
<<
getFilename
(argv[0]) << endl;
39
cout <<
"path "
<<
getPath
(argv[0]) << endl;
40
cout <<
"file name "
<<
getFilename
(
getPath
(argv[0]),
getFilename
(argv[0])) << endl;
41
42
if
(file_name !=
""
) {
43
44
cout <<
"extension "
<<
getFilenameExtension
(file_name) << endl;
45
cout <<
"protocol "
<<
getProtocol
(file_name) << endl;
46
}
47
48
if
(!args.empty()) {
49
cout <<
"Pending arguments"
<< endl;
50
cout << args << endl;
51
}
52
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1410
JEEP::getPath
std::string getPath(const std::string &file_name)
Get path, i.e.
Definition:
JeepToolkit.hh:105
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1836
JeepToolkit.hh
Auxiliary methods for handling file names, type names and environment.
debug
int debug
debug level
Definition:
JSirene.cc:59
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:65
JEEP::getProtocol
std::string getProtocol(const std::string &file_name)
Get protocol, i.e.
Definition:
JeepToolkit.hh:245
JParser.hh
Utility class to parse command line options.
JEEP::getFilenameExtension
std::string getFilenameExtension(const std::string &file_name)
Get file name extension, i.e.
Definition:
JeepToolkit.hh:66
JEEP::getFilename
std::string getFilename(const std::string &file_name)
Get file name part, i.e.
Definition:
JeepToolkit.hh:85
main
int main(int argc, char *argv[])
Definition:
Main.cpp:15
Generated by
1.8.5