author | insilmaril |
Fri Feb 01 15:28:36 2008 +0000 (2008-02-01) | |
changeset 667 | 1eb1c030c3ae |
parent 408 | c2a05fa925a1 |
permissions | -rw-r--r-- |
1 #ifndef OPTIONS_H
2 #define OPTIONS_H
4 #include <QStringList>
6 /*! \brief A single option which is listed in Options */
7 class Option
8 {
9 public:
10 /*! Types of options */
11 enum Type {
12 Switch, //!< No paramater
13 String //!< Parameter is a string
14 };
16 Option();
17 Option(const QString &, const Type &, const QString &, const QString &);
18 void set (const QString &, const Type &, const QString &, const QString &);
19 QString getName();
20 QString getShort();
21 QString getLong();
22 Type getType();
23 void setArg(const QString &);
24 QString getArg();
25 void setActive();
26 bool isActive();
27 private:
28 QString name;
29 Type type;
30 QString sName;
31 QString lName;
32 QString sarg;
33 bool active;
34 };
37 /*! \brief Simple class to deal with command line options */
39 class Options
40 {
41 public:
42 Options();
43 int parse();
44 void add (Option );
45 void add (const QString &,const Option::Type &, const QString &, const QString&);
46 void setHelpText(const QString&);
47 QString getHelpText();
48 QString getProgramName();
49 QStringList getFileList();
50 bool isOn (const QString &);
51 QString getArg (const QString &);
53 private:
54 QString progname;
55 QString helptext;
56 QStringList filelist;
57 QList <Option> optlist;
58 };
60 #endif