options.h
branchrelease-1-12-maintained
changeset 49 d5edb0ae8f2a
child 2 608f976aa7bb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/options.h	Sun Oct 05 09:15:00 2008 +0000
     1.3 @@ -0,0 +1,55 @@
     1.4 +#ifndef OPTIONS_H
     1.5 +#define OPTIONS_H
     1.6 +
     1.7 +#include <qstring.h>
     1.8 +#include <qstringlist.h>
     1.9 +
    1.10 +enum OptionType  {SwitchOption,StringOption};
    1.11 +
    1.12 +class Option
    1.13 +{
    1.14 +public:
    1.15 +	Option();
    1.16 +	void set (const QString &, const OptionType &, const QString &, const QString &);
    1.17 +	QString getName();
    1.18 +	QString getShort();
    1.19 +	QString getLong();
    1.20 +	OptionType getType();
    1.21 +	void setArg(const QString &);
    1.22 +	QString getArg();
    1.23 +	void setActive();
    1.24 +	bool isActive();
    1.25 +private:
    1.26 +	QString name;
    1.27 +	OptionType type;
    1.28 +	QString sName;
    1.29 +	QString lName;
    1.30 +	QString sarg;
    1.31 +	bool active;
    1.32 +};
    1.33 +
    1.34 +
    1.35 +
    1.36 +typedef QValueList <Option> OptionList;
    1.37 +
    1.38 +class Options
    1.39 +{
    1.40 +public:
    1.41 +	Options();
    1.42 +	int parse();
    1.43 +	void add (const QString &,const OptionType &, const QString &, const QString&);
    1.44 +	void setHelpText(const QString&);
    1.45 +	QString getHelpText();
    1.46 +	QString getProgramName();
    1.47 +	QStringList getFileList();
    1.48 +	bool isOn (const QString &);
    1.49 +	QString getArg (const QString &);
    1.50 +
    1.51 +private:
    1.52 +	QString progname;
    1.53 +	QString helptext;
    1.54 +	QStringList filelist;
    1.55 +    OptionList optlist;
    1.56 +};
    1.57 +
    1.58 +#endif