X-Git-Url: https://git.sven.stormbind.net/?a=blobdiff_plain;f=src%2Foptions.h;fp=src%2Foptions.h;h=bc4f4cba8c068f45f1e2aae95a4a4a53503039e9;hb=d483bd8e6523c23c6f1d8908a2e0611c2bc9ff4f;hp=0000000000000000000000000000000000000000;hpb=7dfa3fe589d1722d49681f42cdb0bf1e6efb5223;p=sven%2Fvym.git diff --git a/src/options.h b/src/options.h new file mode 100644 index 0000000..bc4f4cb --- /dev/null +++ b/src/options.h @@ -0,0 +1,59 @@ +#ifndef OPTIONS_H +#define OPTIONS_H + +#include + +/*! \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