MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / parseOptions

Method parseOptions

other_src/astyle/src/astyle_main.cpp:2417–2459  ·  view source on GitHub ↗

* parse the options vector * optionsVector can be either a fileOptionsVector (options file) or an optionsVector (command line) * * @return true if no errors, false if errors */

Source from the content-addressed store, hash-verified

2415 * @return true if no errors, false if errors
2416 */
2417bool ASOptions::parseOptions(vector<string> &optionsVector, const string& errorInfo)
2418{
2419 vector<string>::iterator option;
2420 string arg, subArg;
2421 optionErrors.clear();
2422
2423 for (option = optionsVector.begin(); option != optionsVector.end(); ++option)
2424 {
2425 arg = *option;
2426
2427 if (arg.compare(0, 2, "--") == 0)
2428 parseOption(arg.substr(2), errorInfo);
2429 else if (arg[0] == '-')
2430 {
2431 size_t i;
2432
2433 for (i = 1; i < arg.length(); ++i)
2434 {
2435 if (i > 1
2436 && isalpha(arg[i])
2437 && arg[i-1] != 'x')
2438 {
2439 // parse the previous option in subArg
2440 parseOption(subArg, errorInfo);
2441 subArg = "";
2442 }
2443 // append the current option to subArg
2444 subArg.append(1, arg[i]);
2445 }
2446 // parse the last option
2447 parseOption(subArg, errorInfo);
2448 subArg = "";
2449 }
2450 else
2451 {
2452 parseOption(arg, errorInfo);
2453 subArg = "";
2454 }
2455 }
2456 if (optionErrors.str().length() > 0)
2457 return false;
2458 return true;
2459}
2460
2461void ASOptions::parseOption(const string& arg, const string& errorInfo)
2462{

Callers 2

processOptionsMethod · 0.80
AStyleMainFunction · 0.80

Calls 6

strMethod · 0.80
clearMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
lengthMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected