--------------------------------------------------------------------------
| 346 | |
| 347 | // -------------------------------------------------------------------------- |
| 348 | CommandLineParserArgumentDescription *mitkCommandLineParser::ctkInternal::argumentDescription(const string &argument) |
| 349 | { |
| 350 | string unprefixedArg = argument; |
| 351 | |
| 352 | if (!LongPrefix.empty() && argument.compare(0, LongPrefix.size(), LongPrefix) == 0) |
| 353 | { |
| 354 | // Case when (ShortPrefix + UnPrefixedArgument) matches LongPrefix |
| 355 | if (argument == LongPrefix && !ShortPrefix.empty() && argument.compare(0, ShortPrefix.size(), ShortPrefix) == 0) |
| 356 | { |
| 357 | unprefixedArg = argument.substr(ShortPrefix.size(), argument.size()); |
| 358 | } |
| 359 | else |
| 360 | { |
| 361 | unprefixedArg = argument.substr(LongPrefix.size(), argument.size()); |
| 362 | } |
| 363 | } |
| 364 | else if (!ShortPrefix.empty() && argument.compare(0, ShortPrefix.size(), ShortPrefix) == 0) |
| 365 | { |
| 366 | unprefixedArg = argument.substr(ShortPrefix.size(), argument.size()); |
| 367 | } |
| 368 | else if (!LongPrefix.empty() && !ShortPrefix.empty()) |
| 369 | { |
| 370 | return nullptr; |
| 371 | } |
| 372 | |
| 373 | if (ArgNameToArgumentDescriptionMap.count(unprefixedArg)) |
| 374 | { |
| 375 | return this->ArgNameToArgumentDescriptionMap[unprefixedArg]; |
| 376 | } |
| 377 | return nullptr; |
| 378 | } |
| 379 | |
| 380 | // -------------------------------------------------------------------------- |
| 381 | // ctkCommandLineParser methods |
no test coverage detected