options.h
author insilmaril
Tue, 06 Sep 2005 15:04:50 +0000
changeset 162 2cf3413b6ac9
parent 0 7a96bd401351
child 2 608f976aa7bb
permissions -rw-r--r--
fixed color of pasted branch
     1 #ifndef OPTIONS_H
     2 #define OPTIONS_H
     3 
     4 #include <qstring.h>
     5 #include <qstringlist.h>
     6 
     7 enum OptionType  {SwitchOption,StringOption};
     8 
     9 class Option
    10 {
    11 public:
    12 	Option();
    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 
    33 typedef QValueList <Option> OptionList;
    34 
    35 class Options
    36 {
    37 public:
    38 	Options();
    39 	int parse();
    40 	void add (const QString &,const OptionType &, const QString &, const QString&);
    41 	void setHelpText(const QString&);
    42 	QString getHelpText();
    43 	QString getProgramName();
    44 	QStringList getFileList();
    45 	bool isOn (const QString &);
    46 	QString getArg (const QString &);
    47 
    48 private:
    49 	QString progname;
    50 	QString helptext;
    51 	QStringList filelist;
    52     OptionList optlist;
    53 };
    54 
    55 #endif