added supporto for non variant arguments
This commit is contained in:
parent
57880ef231
commit
d45132e06b
|
@ -69,12 +69,40 @@ void GetOpt::addOption(char s, const QString &name, const QString &description,
|
|||
//add an argument
|
||||
void GetOpt::addArgument(const QString &name, const QString &description, QVariant *v) {
|
||||
Option option;
|
||||
assert(!findArg(name, option));
|
||||
option.type = Option::ARGUMENT;
|
||||
option.name = name;
|
||||
option.description = description;
|
||||
option.value = v;
|
||||
options.push_back(option);
|
||||
addArgument(name, description, option);
|
||||
}
|
||||
|
||||
void GetOpt::addArgument(const QString &name, const QString &description, QString *v) {
|
||||
Option option;
|
||||
option.string_value = v;
|
||||
addArgument(name, description, option);
|
||||
}
|
||||
|
||||
void GetOpt::addArgument(const QString &name, const QString &description, double *v) {
|
||||
Option option;
|
||||
option.double_value = v;
|
||||
addArgument(name, description, option);
|
||||
}
|
||||
|
||||
void GetOpt::addArgument(const QString &name, const QString &description, int *v) {
|
||||
Option option;
|
||||
option.int_value = v;
|
||||
addArgument(name, description, option);
|
||||
}
|
||||
|
||||
void GetOpt::addArgument(const QString &name, const QString &description, bool *v) {
|
||||
Option option;
|
||||
option.boolean_value = v;
|
||||
addArgument(name, description, option);
|
||||
}
|
||||
|
||||
void GetOpt::addArgument(const QString &name, const QString &description, Option option) {
|
||||
assert(!findArg(name, option));
|
||||
option.type = Option::ARGUMENT;
|
||||
option.name = name;
|
||||
option.description = description;
|
||||
options.push_back(option);
|
||||
}
|
||||
|
||||
void GetOpt::addOption(char s, const QString &longname, const QString &description, QString *v) {
|
||||
|
|
|
@ -89,6 +89,11 @@ class GetOpt {
|
|||
|
||||
//add an argument
|
||||
void addArgument(const QString &name, const QString &description, QVariant *v);
|
||||
void addArgument(const QString &name, const QString &description, QString *v);
|
||||
void addArgument(const QString &name, const QString &description, double *v);
|
||||
void addArgument(const QString &name, const QString &description, int *v);
|
||||
void addArgument(const QString &name, const QString &description, bool *v);
|
||||
void addArgument(const QString &name, const QString &description, Option option);
|
||||
|
||||
//add an optional agrument
|
||||
void addOptionalArgument(const QString &name, const QString &description, QVariant *v);
|
||||
|
@ -120,3 +125,4 @@ class GetOpt {
|
|||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue