src/CLIParser.h
branchv_0
changeset 10 ded44e94147c
parent 8 8ef1980db907
child 11 07247893054e
equal deleted inserted replaced
9:0d362165241e 10:ded44e94147c
    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;
       
    53 	static const relpipe::common::type::StringX OPTION_REQUIRED_JACK_CONNECTIONS;
    52 
    54 
    53 	Configuration parse(const std::vector<relpipe::common::type::StringX>& arguments) {
    55 	Configuration parse(const std::vector<relpipe::common::type::StringX>& arguments) {
    54 		Configuration c;
    56 		Configuration c;
    55 
    57 
    56 		for (int i = 0; i < arguments.size();) {
    58 		for (int i = 0; i < arguments.size();) {
    57 			relpipe::common::type::StringX option = readNext(arguments, i);
    59 			relpipe::common::type::StringX option = readNext(arguments, i);
    58 
    60 
    59 			if (option == OPTION_JACK_CLIENT_NAME) {
    61 			if (option == OPTION_JACK_CLIENT_NAME) {
    60 				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));
       
    65 			} else if (option == OPTION_REQUIRED_JACK_CONNECTIONS) {
       
    66 				c.requiredJackConnections = std::stoi(readNext(arguments, i));
    61 			} 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);
    62 		}
    68 		}
    63 
    69 
    64 		return c;
    70 		return c;
    65 	}
    71 	}
    67 	virtual ~CLIParser() {
    73 	virtual ~CLIParser() {
    68 	}
    74 	}
    69 };
    75 };
    70 
    76 
    71 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";
       
    79 const relpipe::common::type::StringX CLIParser::OPTION_REQUIRED_JACK_CONNECTIONS = L"--required-jack-connections";
    72 
    80 
    73 }
    81 }
    74 }
    82 }
    75 }
    83 }