src/CLIParser.h
branchv_0
changeset 15 b3239e4ad328
parent 9 14cf28d7681c
child 23 d2ad84dcf249
equal deleted inserted replaced
14:9ad606c80d3b 15:b3239e4ad328
    47 	}
    47 	}
    48 
    48 
    49 public:
    49 public:
    50 
    50 
    51 	static const relpipe::common::type::StringX OPTION_JACK_CLIENT_NAME;
    51 	static const relpipe::common::type::StringX OPTION_JACK_CLIENT_NAME;
       
    52 	static const relpipe::common::type::StringX OPTION_JACK_CONNECT_TO_PORT;
    52 	static const relpipe::common::type::StringX OPTION_REQUIRED_JACK_CONNECTIONS;
    53 	static const relpipe::common::type::StringX OPTION_REQUIRED_JACK_CONNECTIONS;
    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 		for (int i = 0; i < arguments.size();) {
    58 		for (int i = 0; i < arguments.size();) {
    58 			relpipe::common::type::StringX option = readNext(arguments, i);
    59 			relpipe::common::type::StringX option = readNext(arguments, i);
    59 
    60 
    60 			if (option == OPTION_JACK_CLIENT_NAME) {
    61 			if (option == OPTION_JACK_CLIENT_NAME) {
    61 				c.jackClientName = readNext(arguments, i);
    62 				c.jackClientName = readNext(arguments, i);
       
    63 			} else if (option == OPTION_JACK_CONNECT_TO_PORT) {
       
    64 				c.portsToConnect.push_back(readNext(arguments, i));
    62 			} else if (option == OPTION_REQUIRED_JACK_CONNECTIONS) {
    65 			} else if (option == OPTION_REQUIRED_JACK_CONNECTIONS) {
    63 				c.requiredJackConnections = std::stoi(readNext(arguments, i));
    66 				c.requiredJackConnections = std::stoi(readNext(arguments, i));
    64 			} else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    67 			} else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    65 		}
    68 		}
    66 
    69 
    70 	virtual ~CLIParser() {
    73 	virtual ~CLIParser() {
    71 	}
    74 	}
    72 };
    75 };
    73 
    76 
    74 const relpipe::common::type::StringX CLIParser::OPTION_JACK_CLIENT_NAME = L"--jack-client-name";
    77 const relpipe::common::type::StringX CLIParser::OPTION_JACK_CLIENT_NAME = L"--jack-client-name";
       
    78 const relpipe::common::type::StringX CLIParser::OPTION_JACK_CONNECT_TO_PORT = L"--jack-connect-to-port";
    75 const relpipe::common::type::StringX CLIParser::OPTION_REQUIRED_JACK_CONNECTIONS = L"--required-jack-connections";
    79 const relpipe::common::type::StringX CLIParser::OPTION_REQUIRED_JACK_CONNECTIONS = L"--required-jack-connections";
    76 
    80 
    77 }
    81 }
    78 }
    82 }
    79 }
    83 }