options.h
author insilmaril
Mon Feb 12 09:28:47 2007 +0000 (2007-02-12)
changeset 427 fb74fa7bfb4c
parent 2 608f976aa7bb
child 475 0f8879937035
permissions -rw-r--r--
1.8.66 Various fixes
     1 #ifndef OPTIONS_H
     2 #define OPTIONS_H
     3 
     4 #include <QStringList>
     5 
     6 enum OptionType  {SwitchOption,StringOption};
     7 
     8 class Option
     9 {
    10 public:
    11 	Option();
    12 	Option(const QString &, const OptionType &, const QString &, const QString &);
    13 	void set (const QString &, const OptionType &, const QString &, const QString &);
    14 	QString getName();
    15 	QString getShort();
    16 	QString getLong();
    17 	OptionType getType();
    18 	void setArg(const QString &);
    19 	QString getArg();
    20 	void setActive();
    21 	bool isActive();
    22 private:
    23 	QString name;
    24 	OptionType type;
    25 	QString sName;
    26 	QString lName;
    27 	QString sarg;
    28 	bool active;
    29 };
    30 
    31 
    32 class Options
    33 {
    34 public:
    35 	Options();
    36 	int parse();
    37 	void add (Option );
    38 	void add (const QString &,const OptionType &, const QString &, const QString&);
    39 	void setHelpText(const QString&);
    40 	QString getHelpText();
    41 	QString getProgramName();
    42 	QStringList getFileList();
    43 	bool isOn (const QString &);
    44 	QString getArg (const QString &);
    45 
    46 private:
    47 	QString progname;
    48 	QString helptext;
    49 	QStringList filelist;
    50     QList <Option> optlist;
    51 };
    52 
    53 #endif