--------------------------------------------------------------------------
| 400 | |
| 401 | // -------------------------------------------------------------------------- |
| 402 | map<string, us::Any> mitkCommandLineParser::parseArguments(const StringContainerType &arguments, bool *ok) |
| 403 | { |
| 404 | // Reset |
| 405 | this->Internal->UnparsedArguments.clear(); |
| 406 | this->Internal->ProcessedArguments.clear(); |
| 407 | this->Internal->ErrorString.clear(); |
| 408 | // foreach (CommandLineParserArgumentDescription* desc, this->Internal->ArgumentDescriptionList) |
| 409 | for (unsigned int i = 0; i < Internal->ArgumentDescriptionList.size(); i++) |
| 410 | { |
| 411 | CommandLineParserArgumentDescription *desc = Internal->ArgumentDescriptionList.at(i); |
| 412 | desc->Value = us::Any(desc->ValueType); |
| 413 | if (!desc->DefaultValue.Empty()) |
| 414 | { |
| 415 | desc->Value = desc->DefaultValue; |
| 416 | } |
| 417 | } |
| 418 | bool error = false; |
| 419 | bool ignoreRest = false; |
| 420 | CommandLineParserArgumentDescription *currentArgDesc = nullptr; |
| 421 | vector<CommandLineParserArgumentDescription *> parsedArgDescriptions; |
| 422 | for (unsigned int i = 1; i < arguments.size(); ++i) |
| 423 | { |
| 424 | string argument = arguments.at(i); |
| 425 | |
| 426 | if (this->Internal->Debug) |
| 427 | { |
| 428 | std::cout << "Processing" << argument; |
| 429 | } |
| 430 | if (!argument.compare("--version")) |
| 431 | { |
| 432 | std::cout << "Git commit hash: " << MITK_REVISION << std::endl; |
| 433 | std::cout << "Git branch name: " << MITK_REVISION_NAME << "\n" << std::endl; |
| 434 | } |
| 435 | |
| 436 | if (!argument.compare("--xml") || !argument.compare("-xml") || !argument.compare("--XML") || |
| 437 | !argument.compare("-XML")) |
| 438 | { |
| 439 | this->generateXmlOutput(); |
| 440 | return map<string, us::Any>(); |
| 441 | } |
| 442 | |
| 443 | // should argument be ignored ? |
| 444 | if (ignoreRest) |
| 445 | { |
| 446 | if (this->Internal->Debug) |
| 447 | { |
| 448 | std::cout << " Skipping: IgnoreRest flag was been set"; |
| 449 | } |
| 450 | this->Internal->UnparsedArguments.push_back(argument); |
| 451 | continue; |
| 452 | } |
| 453 | |
| 454 | // Skip if the argument does not start with the defined prefix |
| 455 | if (!(argument.compare(0, Internal->LongPrefix.size(), Internal->LongPrefix) == 0 || |
| 456 | argument.compare(0, Internal->ShortPrefix.size(), Internal->ShortPrefix) == 0)) |
| 457 | { |
| 458 | if (this->Internal->StrictMode) |
| 459 | { |
no test coverage detected