#include <CmdLine.h>
|
typedef std::list< Pair > | Optlist |
|
typedef std::pair< std::string, int > | Pair |
|
|
| CmdLine ()=delete |
|
Optlist::iterator | find (const char *shortOpt, const char *longOpt) |
|
Definition at line 204 of file CmdLine.h.
◆ Optlist
◆ Pair
◆ CmdLine() [1/2]
cmdline::CmdLine::CmdLine |
( |
const unsigned |
argc, |
|
|
const char *const |
argv[] |
|
) |
| |
|
inline |
Definition at line 225 of file CmdLine.h.
234 if (strncmp(
progname,
"lt-", 3) == 0)
240 bool previousIsOpt =
false;
241 bool nextIsArg =
false;
242 for (
unsigned i = 1;
i <
argc; ++
i) {
245 previousIsOpt =
false;
248 }
else if (strcmp(
argv[
i],
"-") == 0)
250 else if (strcmp(
argv[
i],
"--") == 0) {
252 for (
unsigned k =
i + 1;
k <
argc; ++
k) {
257 }
else if (strncmp(
argv[
i],
"--", 2) == 0) {
259 previousIsOpt =
true;
260 }
else if (
argv[
i][0] ==
'-') {
261 const unsigned len = strlen(
argv[
i]);
262 for (
unsigned k = 1;
k < len; ++
k) {
266 previousIsOpt =
true;
270 previousIsOpt =
false;
References argc(), args_, cmsBatch::argv, mps_fire::i, dqmdumpme::k, nprogargs_, progname(), progname_, and AlCaHLTBitMon_QueryRunRegistry::string.
◆ CmdLine() [2/2]
cmdline::CmdLine::CmdLine |
( |
| ) |
|
|
privatedelete |
◆ argc()
unsigned cmdline::CmdLine::argc |
( |
| ) |
const |
|
inline |
◆ find()
Optlist::iterator cmdline::CmdLine::find |
( |
const char * |
shortOpt, |
|
|
const char * |
longOpt |
|
) |
| |
|
inlineprivate |
◆ has()
bool cmdline::CmdLine::has |
( |
const char * |
shortOpt, |
|
|
const char * |
longOpt = nullptr |
|
) |
| |
|
inline |
◆ operator void *()
cmdline::CmdLine::operator void * |
( |
| ) |
const |
|
inline |
◆ operator>>()
template<typename T >
CmdLine& cmdline::CmdLine::operator>> |
( |
T & |
obj | ) |
|
|
inline |
Definition at line 328 of file CmdLine.h.
330 throw CmdLineError(
"no more input available on the command line");
331 Optlist::iterator it =
args_.begin();
332 for (; it !=
args_.end(); ++it)
333 if (it->second == 0 || it->second == 3)
335 OneShotIStream is(it->first);
References args_, nprogargs_, and getGTfromDQMFile::obj.
◆ optend()
void cmdline::CmdLine::optend |
( |
| ) |
const |
|
inline |
Definition at line 317 of file CmdLine.h.
318 for (Optlist::const_iterator it =
args_.begin(); it !=
args_.end(); ++it)
319 if (it->second == 1 || it->second == 2)
320 throw CmdLineError(
"invalid command line option \"") << it->first <<
'"';
References args_.
◆ option()
OneShotIStream cmdline::CmdLine::option |
( |
const char * |
shortOpt, |
|
|
const char * |
longOpt = nullptr |
|
) |
| |
|
inline |
Definition at line 291 of file CmdLine.h.
293 for (Optlist::iterator it =
find(shortOpt, longOpt); it !=
args_.end(); it =
find(shortOpt, longOpt)) {
294 Optlist::iterator it0(it);
295 if (++it !=
args_.end())
296 if (it->second == 0) {
297 result = OneShotIStream(it->first);
298 args_.erase(it0, ++it);
302 throw CmdLineError() <<
"missing command line argument for option \"" << it0->first <<
'"';
References args_, find(), nprogargs_, and mps_fire::result.
Referenced by require().
◆ progname()
const char* cmdline::CmdLine::progname |
( |
| ) |
const |
|
inline |
◆ require()
OneShotIStream cmdline::CmdLine::require |
( |
const char * |
shortOpt, |
|
|
const char * |
longOpt = nullptr |
|
) |
| |
|
inline |
◆ args_
◆ nprogargs_
unsigned cmdline::CmdLine::nprogargs_ |
|
private |
◆ progname_
std::string cmdline::CmdLine::progname_ |
|
private |