-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathOptionParser.h
33 lines (29 loc) · 985 Bytes
/
OptionParser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef OPTIONPARSER_H
#define OPTIONPARSER_H OPTIONPARSER_H
#include <QtCore/QCoreApplication>
#include <QtCore/QMap>
#include <QtCore/QStringList>
#include <QtCore/QString>
class OptionParser {
Q_DECLARE_TR_FUNCTIONS(OptionParser)
protected:
QStringList arguments;
QStringList possibleFlags;
QStringList possibleOptions;
QStringList flags;
QStringList flagDescriptions;
QStringList optionDescriptions;
QMap<QString, QString> options;
QMap<QString, QString> optionAliases;
public:
OptionParser(bool withQt = true);
void addOption(const QString& longName, const QString& shortName, const QString& description);
void addFlag(const QString& longName, const QString& shortName, const QString& description);
bool parseArgs(int argc, char* argv[]);
QString get(const QString& argument, const QString& elsevalue = "") const;
bool checkFlag(const QString& argument) const;
QString getArgument(int j) const;
int argumentCount() const;
QString helpText() const;
};
#endif