src/CLIParser.h
branchv_0
changeset 9 14cf28d7681c
parent 2 01553c2ffa1d
child 15 b3239e4ad328
equal deleted inserted replaced
8:27579c5cdc51 9:14cf28d7681c
    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_REQUIRED_JACK_CONNECTIONS;
    52 
    53 
    53 	Configuration parse(const std::vector<relpipe::common::type::StringX>& arguments) {
    54 	Configuration parse(const std::vector<relpipe::common::type::StringX>& arguments) {
    54 		Configuration c;
    55 		Configuration c;
    55 
    56 
    56 		for (int i = 0; i < arguments.size();) {
    57 		for (int i = 0; i < arguments.size();) {
    57 			relpipe::common::type::StringX option = readNext(arguments, i);
    58 			relpipe::common::type::StringX option = readNext(arguments, i);
    58 
    59 
    59 			if (option == OPTION_JACK_CLIENT_NAME) {
    60 			if (option == OPTION_JACK_CLIENT_NAME) {
    60 				c.jackClientName = readNext(arguments, i);
    61 				c.jackClientName = readNext(arguments, i);
       
    62 			} else if (option == OPTION_REQUIRED_JACK_CONNECTIONS) {
       
    63 				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);
    64 			} else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    62 		}
    65 		}
    63 
    66 
    64 		return c;
    67 		return c;
    65 	}
    68 	}
    67 	virtual ~CLIParser() {
    70 	virtual ~CLIParser() {
    68 	}
    71 	}
    69 };
    72 };
    70 
    73 
    71 const relpipe::common::type::StringX CLIParser::OPTION_JACK_CLIENT_NAME = L"--jack-client-name";
    74 const relpipe::common::type::StringX CLIParser::OPTION_JACK_CLIENT_NAME = L"--jack-client-name";
       
    75 const relpipe::common::type::StringX CLIParser::OPTION_REQUIRED_JACK_CONNECTIONS = L"--required-jack-connections";
    72 
    76 
    73 }
    77 }
    74 }
    78 }
    75 }
    79 }