| 8 | } |
| 9 | |
| 10 | bool Parser::parse(const QStringList& arguments) |
| 11 | { |
| 12 | if (!_parser.parse(arguments)) |
| 13 | { |
| 14 | return false; |
| 15 | } |
| 16 | |
| 17 | for (Option* option : _options) |
| 18 | { |
| 19 | QString value = this->value(*option); |
| 20 | if (!option->validate(*this, value)) |
| 21 | { |
| 22 | const QString error = option->getError(); |
| 23 | if (!error.isEmpty()) |
| 24 | { |
| 25 | _errorText = tr("%1 is not a valid option for %2\n%3").arg(value, option->name(), error); |
| 26 | } |
| 27 | else |
| 28 | { |
| 29 | _errorText = tr("%1 is not a valid option for %2").arg(value, option->name()); |
| 30 | } |
| 31 | return false; |
| 32 | } |
| 33 | } |
| 34 | return true; |
| 35 | } |
| 36 | |
| 37 | void Parser::process(const QStringList& arguments) |
| 38 | { |
no test coverage detected