File: options.h

package info (click to toggle)
vym 1.10.0-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 5,376 kB
  • ctags: 1,926
  • sloc: cpp: 18,468; xml: 277; sh: 211; perl: 89; makefile: 26
file content (60 lines) | stat: -rw-r--r-- 1,183 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef OPTIONS_H
#define OPTIONS_H

#include <QStringList>

/*! \brief A single option which is listed in Options */
class Option
{
public:
	/*! Types of options */
	enum Type  {
		Switch,	//!< No paramater
		String	//!< Parameter is a string
	};

	Option();
	Option(const QString &, const Type &, const QString &, const QString &);
	void set (const QString &, const Type &, const QString &, const QString &);
	QString getName();
	QString getShort();
	QString getLong();
	Type getType();
	void setArg(const QString &);
	QString getArg();
	void setActive();
	bool isActive();
private:
	QString name;
	Type type;
	QString sName;
	QString lName;
	QString sarg;
	bool active;
};


/*! \brief Simple class to deal with command line options */

class Options
{
public:
	Options();
	int parse();
	void add (Option );
	void add (const QString &,const Option::Type &, const QString &, const QString&);
	void setHelpText(const QString&);
	QString getHelpText();
	QString getProgramName();
	QStringList getFileList();
	bool isOn (const QString &);
	QString getArg (const QString &);

private:
	QString progname;
	QString helptext;
	QStringList filelist;
    QList <Option> optlist;
};

#endif