src/CLIParser.h
branchv_0
changeset 7 039b3f8a3442
parent 6 1b17b8cdbfc3
child 8 b498160cc2ab
equal deleted inserted replaced
6:1b17b8cdbfc3 7:039b3f8a3442
    48 
    48 
    49 public:
    49 public:
    50 
    50 
    51 	static const relpipe::common::type::StringX OPTION_LIST_INPUT_DEVICES;
    51 	static const relpipe::common::type::StringX OPTION_LIST_INPUT_DEVICES;
    52 	static const relpipe::common::type::StringX OPTION_LIST_INPUT_EVENTS;
    52 	static const relpipe::common::type::StringX OPTION_LIST_INPUT_EVENTS;
       
    53 	static const relpipe::common::type::StringX OPTION_LIST_WINDOWS;
    53 
    54 
    54 	Configuration parse(const std::vector<relpipe::common::type::StringX>& arguments) {
    55 	Configuration parse(const std::vector<relpipe::common::type::StringX>& arguments) {
    55 		Configuration c;
    56 		Configuration c;
    56 
    57 
    57 		if (arguments.size() == 0) c.listInputDevices = true;
    58 		if (arguments.size() == 0) c.listInputDevices = true;
    61 
    62 
    62 			if (option == OPTION_LIST_INPUT_DEVICES) {
    63 			if (option == OPTION_LIST_INPUT_DEVICES) {
    63 				c.listInputDevices = parseBoolean(readNext(arguments, i));
    64 				c.listInputDevices = parseBoolean(readNext(arguments, i));
    64 			} else if (option == OPTION_LIST_INPUT_EVENTS) {
    65 			} else if (option == OPTION_LIST_INPUT_EVENTS) {
    65 				c.listInputEvents = parseBoolean(readNext(arguments, i));
    66 				c.listInputEvents = parseBoolean(readNext(arguments, i));
       
    67 			} else if (option == OPTION_LIST_WINDOWS) {
       
    68 				c.listWindows = parseBoolean(readNext(arguments, i));
    66 			} else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    69 			} else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    67 		}
    70 		}
    68 
    71 
    69 		return c;
    72 		return c;
    70 	}
    73 	}
    73 	}
    76 	}
    74 };
    77 };
    75 
    78 
    76 const relpipe::common::type::StringX CLIParser::OPTION_LIST_INPUT_DEVICES = L"--list-input-devices";
    79 const relpipe::common::type::StringX CLIParser::OPTION_LIST_INPUT_DEVICES = L"--list-input-devices";
    77 const relpipe::common::type::StringX CLIParser::OPTION_LIST_INPUT_EVENTS = L"--list-input-events";
    80 const relpipe::common::type::StringX CLIParser::OPTION_LIST_INPUT_EVENTS = L"--list-input-events";
       
    81 const relpipe::common::type::StringX CLIParser::OPTION_LIST_WINDOWS = L"--list-windows";
    78 
    82 
    79 }
    83 }
    80 }
    84 }
    81 }
    85 }