! * @brief Reads the command line options passed into the constructor. * * This method can return a return code to its caller, which will cause the * tool to exit immediately with that return code value. Normally, though, it * will return -1 to signal that the tool should continue to execute and * all options were processed successfully. * * The Options clas
| 159 | * returned from the tool as it exits immediately. |
| 160 | */ |
| 161 | int processOptions() |
| 162 | { |
| 163 | Options options(*m_argv, k_optionsDefinition); |
| 164 | OptArgvIter iter(--m_argc, ++m_argv); |
| 165 | |
| 166 | // process command line options |
| 167 | int optchar; |
| 168 | const char *optarg; |
| 169 | while ((optchar = options(iter, optarg))) |
| 170 | { |
| 171 | switch (optchar) |
| 172 | { |
| 173 | case '?': |
| 174 | { |
| 175 | printUsage(options); |
| 176 | return 0; |
| 177 | } |
| 178 | |
| 179 | case 'V': |
| 180 | { |
| 181 | printf("%s %s\n%s\n", k_toolName, k_version, k_copyright); |
| 182 | return 0; |
| 183 | } |
| 184 | |
| 185 | case 'o': |
| 186 | { |
| 187 | m_outputFilePath = optarg; |
| 188 | break; |
| 189 | } |
| 190 | |
| 191 | case 'v': |
| 192 | { |
| 193 | if (m_verboseType != verbose_type_t::kExtraDebug) |
| 194 | { |
| 195 | m_verboseType = (verbose_type_t)(((int)m_verboseType) + 1); |
| 196 | } |
| 197 | break; |
| 198 | } |
| 199 | |
| 200 | case 'I': |
| 201 | { |
| 202 | PathSearcher::getGlobalSearcher().addSearchPath(optarg); |
| 203 | break; |
| 204 | } |
| 205 | |
| 206 | case 'g': |
| 207 | { |
| 208 | string lang = optarg; |
| 209 | if (lang == "c") |
| 210 | { |
| 211 | m_outputLanguage = languages_t::kCLanguage; |
| 212 | } |
| 213 | else if (lang == "py") |
| 214 | { |
| 215 | m_outputLanguage = languages_t::kPythonLanguage; |
| 216 | } |
| 217 | else if (lang == "java") |
| 218 | { |
nothing calls this directly
no test coverage detected