CommandLineParser.cpp
/**
  * arg is one of the command-line-args /X:nnn or /Y:nnn. The number nnn is parsed and returned
  */
arg is one of the command-line-args /X:nnn or /Y:nnn. The number nnn is parsed and returned
arg is one of the command - line - args / X : nnn or / Y : nnn . The number nnn is parsed and returned
int CommandLineParser::parseXorY(char* arg)
{
  if (strlen(arg) < 4)
  {
    printHelpAndExit(EXIT_FAILURE);
  }
  if (arg[2] != ':' && arg[2] != '=')
  {
    printHelpAndExit(EXIT_FAILURE);
  }
  int val = 0;
  try
  {
    string valAsString(&(arg[3]));
    val = stoi(valAsString);
  }
  catch (...)
  {
    printHelpAndExit(EXIT_FAILURE);
  }
  return val;
}
int CommandLineParser :: parseXorY ( char * arg ) { if ( strlen ( arg ) < 4 ) { printHelpAndExit ( EXIT_FAILURE ) ; } if ( arg [ 2 ] != ' ' && arg [ 2 ] != ' ' ) { printHelpAndExit ( EXIT_FAILURE ) ; } int val = 0 ; try { string valAsString ( & ( arg [ 3 ] ) ) ; val = stoi ( valAsString ) ; } catch ( ... ) { printHelpAndExit ( EXIT_FAILURE ) ; } return val ; }
arg is one of the command-line-args /X:nnn or /Y:nnn.
arg is one of the command - line - args / X : nnn or / Y : nnn .