MCPcopy Create free account
hub / github.com/LunarG/VulkanTools / CommandLine

Method CommandLine

vkconfig_core/command_line.cpp:230–575  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228}
229
230CommandLine::CommandLine(int argc, char* argv[])
231 : command(_command),
232 command_reset_arg(_command_reset_arg),
233 command_layers_arg(_command_layers_arg),
234 command_loader_arg(_command_loader_arg),
235 command_doc_arg(_command_doc_arg),
236 generate_settings_mode(_generate_settings_mode),
237 selected_layers_name(_selected_layers_name),
238 selected_configuration_name(_selected_configuration_name),
239 dry_run(_dry_run),
240 help(_help),
241 error(_error),
242 error_args(_error_args) {
243 assert(argc >= 1);
244
245 if (argc <= 1) {
246 return;
247 }
248
249 int arg_offset = 1;
250
251 std::string command_mode_name = argv[arg_offset];
252
253 switch (_command = GetModeId(command_mode_name.c_str())) {
254 default:
255 case COMMAND_NONE: {
256 this->_error = ERROR_INVALID_COMMAND;
257 this->_error_args.push_back(argv[arg_offset + 0]);
258 break;
259 }
260 case COMMAND_LOADER: {
261 if (argc <= arg_offset + 1) {
262 this->_error = ERROR_MISSING_COMMAND_ARGUMENT;
263 this->_error_args.push_back(command_mode_name);
264 break;
265 }
266
267 arg_offset += 1;
268
269 while (arg_offset < argc) {
270 std::string command_argument = argv[arg_offset];
271 CommandLoaderArg command_loader = ::GetCommandLoaderId(command_argument.c_str());
272
273 switch (command_loader) {
274 default:
275 case COMMAND_LOADER_NONE: {
276 this->_error = ERROR_INVALID_COMMAND_ARGUMENT;
277 } break;
278 case COMMAND_LOADER_OVERRIDE: {
279 if (argc <= arg_offset + 1) {
280 this->_error = ERROR_MISSING_COMMAND_ARGUMENT;
281 } else {
282 const std::string configuration_name = argv[arg_offset + 1];
283
284 QFile file(Path(configuration_name).AbsolutePath().c_str());
285 const bool result = file.open(QFile::ReadOnly);
286 if (!result) {
287 this->_selected_configuration_name = configuration_name;

Callers

nothing calls this directly

Calls 14

GetModeIdFunction · 0.85
GetCommandLoaderIdFunction · 0.85
PathClass · 0.85
GetCommandLayersIdFunction · 0.85
GetCommandDocIdFunction · 0.85
SplitFunction · 0.85
GetCommandSettingsArgsIdFunction · 0.85
GetGenerateSettingsModeFunction · 0.85
GetCommandResetIdFunction · 0.85
GetCommandHelpIdFunction · 0.85
AbsolutePathMethod · 0.80
AbsoluteDirMethod · 0.80

Tested by

no test coverage detected