]> git.sven.stormbind.net Git - sven/vym.git/blob - options.h
03d06acf2b230fefb141fcd33a46baa95709eeaa
[sven/vym.git] / options.h
1 #ifndef OPTIONS_H
2 #define OPTIONS_H
3
4 #include <QStringList>
5
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     };
15
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 };
35
36
37 /*! \brief Simple class to deal with command line options */
38
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 &);
52
53 private:
54     QString progname;
55     QString helptext;
56     QStringList filelist;
57     QList <Option> optlist;
58 };
59
60 #endif