MCPcopy Create free account
hub / github.com/MITK/MITK / argumentDescription

Method argumentDescription

Modules/CommandLine/src/mitkCommandLineParser.cpp:348–378  ·  view source on GitHub ↗

--------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

346
347// --------------------------------------------------------------------------
348CommandLineParserArgumentDescription *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

Callers 1

parseArgumentsMethod · 0.80

Calls 3

countMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected