src/CLIParser.h
branchv_0
changeset 11 07247893054e
parent 10 ded44e94147c
child 12 e8aae4d42c01
equal deleted inserted replaced
10:ded44e94147c 11:07247893054e
    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_JACK_CONNECT_TO_PORT;
    53 	static const relpipe::common::type::StringX OPTION_REQUIRED_JACK_CONNECTIONS;
    53 	static const relpipe::common::type::StringX OPTION_REQUIRED_JACK_CONNECTIONS;
       
    54 	static const relpipe::common::type::StringX OPTION_LIST_JACK_PORTS;
       
    55 	static const relpipe::common::type::StringX OPTION_LIST_MIDI_MESSAGES;
    54 
    56 
    55 	Configuration parse(const std::vector<relpipe::common::type::StringX>& arguments) {
    57 	Configuration parse(const std::vector<relpipe::common::type::StringX>& arguments) {
    56 		Configuration c;
    58 		Configuration c;
    57 
    59 
    58 		for (int i = 0; i < arguments.size();) {
    60 		for (int i = 0; i < arguments.size();) {
    62 				c.jackClientName = readNext(arguments, i);
    64 				c.jackClientName = readNext(arguments, i);
    63 			} else if (option == OPTION_JACK_CONNECT_TO_PORT) {
    65 			} else if (option == OPTION_JACK_CONNECT_TO_PORT) {
    64 				c.portsToConnect.push_back(readNext(arguments, i));
    66 				c.portsToConnect.push_back(readNext(arguments, i));
    65 			} else if (option == OPTION_REQUIRED_JACK_CONNECTIONS) {
    67 			} else if (option == OPTION_REQUIRED_JACK_CONNECTIONS) {
    66 				c.requiredJackConnections = std::stoi(readNext(arguments, i));
    68 				c.requiredJackConnections = std::stoi(readNext(arguments, i));
       
    69 			} else if (option == OPTION_LIST_JACK_PORTS) {
       
    70 				c.listJackPorts = parseBoolean(readNext(arguments, i));
       
    71 			} else if (option == OPTION_LIST_MIDI_MESSAGES) {
       
    72 				c.listMidiMessages = parseBoolean(readNext(arguments, i));
    67 			} else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    73 			} else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    68 		}
    74 		}
    69 
    75 
    70 		return c;
    76 		return c;
    71 	}
    77 	}
    75 };
    81 };
    76 
    82 
    77 const relpipe::common::type::StringX CLIParser::OPTION_JACK_CLIENT_NAME = L"--jack-client-name";
    83 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";
    84 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";
    85 const relpipe::common::type::StringX CLIParser::OPTION_REQUIRED_JACK_CONNECTIONS = L"--required-jack-connections";
       
    86 const relpipe::common::type::StringX CLIParser::OPTION_LIST_JACK_PORTS = L"--list-jack-ports";
       
    87 const relpipe::common::type::StringX CLIParser::OPTION_LIST_MIDI_MESSAGES = L"--list-midi-messages";
    80 
    88 
    81 }
    89 }
    82 }
    90 }
    83 }
    91 }