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