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

Method processOptions

other_src/astyle/src/astyle_main.cpp:1676–1789  ·  view source on GitHub ↗

process options from the command line and options file build the vectors fileNameVector, excludeVector, optionsVector, and fileOptionsVector

Source from the content-addressed store, hash-verified

1674// process options from the command line and options file
1675// build the vectors fileNameVector, excludeVector, optionsVector, and fileOptionsVector
1676void ASConsole::processOptions(vector<string>& argvOptions)
1677{
1678 string arg;
1679 bool ok = true;
1680 bool shouldParseOptionsFile = true;
1681
1682 // get command line options
1683 for (size_t i = 0; i < argvOptions.size(); i++)
1684 {
1685 arg = argvOptions[i];
1686
1687 if ( isOption(arg, "-I" )
1688 || isOption(arg, "--ascii") )
1689 {
1690 useAscii = true;
1691 setlocale(LC_ALL, "C"); // use English decimal indicator
1692 localizer.setLanguageFromName("en");
1693 }
1694 else if ( isOption(arg, "--options=none") )
1695 {
1696 shouldParseOptionsFile = false;
1697 }
1698 else if ( isParamOption(arg, "--options=") )
1699 {
1700 optionsFileName = getParam(arg, "--options=");
1701 optionsFileRequired = true;
1702 if (optionsFileName.compare("") == 0)
1703 setOptionsFileName(" ");
1704 }
1705 else if ( isOption(arg, "-h")
1706 || isOption(arg, "--help")
1707 || isOption(arg, "-?") )
1708 {
1709 printHelp();
1710 exit(EXIT_SUCCESS);
1711 }
1712 else if ( isOption(arg, "-V" )
1713 || isOption(arg, "--version") )
1714 {
1715 (*_err) << "Artistic Style Version " << g_version << endl;
1716 exit(EXIT_SUCCESS);
1717 }
1718 else if (arg[0] == '-')
1719 {
1720 optionsVector.push_back(arg);
1721 }
1722 else // file-name
1723 {
1724 standardizePath(arg);
1725 fileNameVector.push_back(arg);
1726 }
1727 }
1728
1729 // get options file path and name
1730 if (shouldParseOptionsFile)
1731 {
1732 if (optionsFileName.compare("") == 0)
1733 {

Callers 1

mainFunction · 0.80

Calls 10

setLanguageFromNameMethod · 0.80
c_strMethod · 0.80
importOptionsMethod · 0.80
parseOptionsMethod · 0.80
getOptionErrorsMethod · 0.80
errorFunction · 0.50
sizeMethod · 0.45
push_backMethod · 0.45
clearMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected