| 335 | } |
| 336 | |
| 337 | void ParseParameters(int argc, const char* const argv[]) |
| 338 | { |
| 339 | mapArgs.clear(); |
| 340 | mapMultiArgs.clear(); |
| 341 | |
| 342 | for (int i = 1; i < argc; i++) |
| 343 | { |
| 344 | std::string str(argv[i]); |
| 345 | std::string strValue; |
| 346 | size_t is_index = str.find('='); |
| 347 | if (is_index != std::string::npos) |
| 348 | { |
| 349 | strValue = str.substr(is_index+1); |
| 350 | str = str.substr(0, is_index); |
| 351 | } |
| 352 | #ifdef WIN32 |
| 353 | boost::to_lower(str); |
| 354 | if (boost::algorithm::starts_with(str, "/")) |
| 355 | str = "-" + str.substr(1); |
| 356 | #endif |
| 357 | |
| 358 | if (str[0] != '-') |
| 359 | break; |
| 360 | |
| 361 | // Interpret --foo as -foo. |
| 362 | // If both --foo and -foo are set, the last takes effect. |
| 363 | if (str.length() > 1 && str[1] == '-') |
| 364 | str = str.substr(1); |
| 365 | InterpretNegativeSetting(str, strValue); |
| 366 | |
| 367 | mapArgs[str] = strValue; |
| 368 | mapMultiArgs[str].push_back(strValue); |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | std::string GetArg(const std::string& strArg, const std::string& strDefault) |
| 373 | { |