37 void addBool(QString flag, QString dest, QString
help);
52 void add(QString flag, QString dest, QString help);
59 template <
typename T> T
get(
const QString& dest, T default_value);
65 void parse(QStringList &args);
104 template <
typename T> T
convert(
const QString& value);
110 qDebug() <<
"langmuir: invalid parser key..." << qPrintable(dest);
114 return default_value;
A class to parse command line arguments.
Definition: clparser.h:15
void setDescription(const QString &desc)
set the program description
QString help()
get the help string
void addBool(QString flag, QString dest, QString help)
add a flag that has no argument
T convert(const QString &value)
convert value to type
QMap< QString, QString > m_flags
map dest->flag
Definition: clparser.h:80
QMap< QString, QString > m_helps
map dest->help
Definition: clparser.h:83
CommandLineParser(QObject *parent=0)
create the CommandLineParser
QStringList m_args
list of remaining command line arguments
Definition: clparser.h:92
unsigned int m_numArguments
total number of arguments
Definition: clparser.h:98
QMap< QString, QString > m_values
map dest->value
Definition: clparser.h:86
QMap< QString, int > m_isPositional
map dest->boolean
Definition: clparser.h:77
T get(const QString &dest, T default_value)
get value by key and convert to type
Definition: clparser.h:107
void parse(QStringList &args)
parse the command line arguments
QMap< QString, bool > m_isBool
map dest->boolean
Definition: clparser.h:74
unsigned int m_numPositional
total number of positional arguments
Definition: clparser.h:95
void addPositional(QString dest, QString help)
add an argument that has no flag
QString m_description
description string
Definition: clparser.h:89
void add(QString flag, QString dest, QString help)
add a flag that has an argument