src/CLIParser.h
branchv_0
changeset 13 326935d1bfab
parent 12 e8aae4d42c01
child 14 cde9bb07ea0a
equal deleted inserted replaced
12:e8aae4d42c01 13:326935d1bfab
    51 	static const relpipe::common::type::StringX OPTION_CLIENT;
    51 	static const relpipe::common::type::StringX OPTION_CLIENT;
    52 	static const relpipe::common::type::StringX OPTION_PORT;
    52 	static const relpipe::common::type::StringX OPTION_PORT;
    53 	static const relpipe::common::type::StringX OPTION_CONNECT_TO;
    53 	static const relpipe::common::type::StringX OPTION_CONNECT_TO;
    54 	static const relpipe::common::type::StringX OPTION_REQUIRED_CONNECTIONS;
    54 	static const relpipe::common::type::StringX OPTION_REQUIRED_CONNECTIONS;
    55 	static const relpipe::common::type::StringX OPTION_LIST_PORTS;
    55 	static const relpipe::common::type::StringX OPTION_LIST_PORTS;
       
    56 	static const relpipe::common::type::StringX OPTION_LIST_CONNECTIONS;
    56 	static const relpipe::common::type::StringX OPTION_LIST_MIDI_MESSAGES;
    57 	static const relpipe::common::type::StringX OPTION_LIST_MIDI_MESSAGES;
    57 
    58 
    58 	Configuration parse(const std::vector<relpipe::common::type::StringX>& arguments) {
    59 	Configuration parse(const std::vector<relpipe::common::type::StringX>& arguments) {
    59 		Configuration c;
    60 		Configuration c;
    60 
    61 
    69 				c.connectTo.push_back(readNext(arguments, i));
    70 				c.connectTo.push_back(readNext(arguments, i));
    70 			} else if (option == OPTION_REQUIRED_CONNECTIONS) {
    71 			} else if (option == OPTION_REQUIRED_CONNECTIONS) {
    71 				c.requiredConnections = std::stoi(readNext(arguments, i));
    72 				c.requiredConnections = std::stoi(readNext(arguments, i));
    72 			} else if (option == OPTION_LIST_PORTS) {
    73 			} else if (option == OPTION_LIST_PORTS) {
    73 				c.listPorts = parseBoolean(readNext(arguments, i));
    74 				c.listPorts = parseBoolean(readNext(arguments, i));
       
    75 			} else if (option == OPTION_LIST_CONNECTIONS) {
       
    76 				c.listConnections = parseBoolean(readNext(arguments, i));
    74 			} else if (option == OPTION_LIST_MIDI_MESSAGES) {
    77 			} else if (option == OPTION_LIST_MIDI_MESSAGES) {
    75 				c.listMidiMessages = parseBoolean(readNext(arguments, i));
    78 				c.listMidiMessages = parseBoolean(readNext(arguments, i));
    76 			} else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    79 			} else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    77 		}
    80 		}
    78 
    81 
    86 const relpipe::common::type::StringX CLIParser::OPTION_CLIENT = L"--client";
    89 const relpipe::common::type::StringX CLIParser::OPTION_CLIENT = L"--client";
    87 const relpipe::common::type::StringX CLIParser::OPTION_PORT = L"--port";
    90 const relpipe::common::type::StringX CLIParser::OPTION_PORT = L"--port";
    88 const relpipe::common::type::StringX CLIParser::OPTION_CONNECT_TO = L"--connect-to";
    91 const relpipe::common::type::StringX CLIParser::OPTION_CONNECT_TO = L"--connect-to";
    89 const relpipe::common::type::StringX CLIParser::OPTION_REQUIRED_CONNECTIONS = L"--required-connections";
    92 const relpipe::common::type::StringX CLIParser::OPTION_REQUIRED_CONNECTIONS = L"--required-connections";
    90 const relpipe::common::type::StringX CLIParser::OPTION_LIST_PORTS = L"--list-ports";
    93 const relpipe::common::type::StringX CLIParser::OPTION_LIST_PORTS = L"--list-ports";
       
    94 const relpipe::common::type::StringX CLIParser::OPTION_LIST_CONNECTIONS = L"--list-connections";
    91 const relpipe::common::type::StringX CLIParser::OPTION_LIST_MIDI_MESSAGES = L"--list-midi-messages";
    95 const relpipe::common::type::StringX CLIParser::OPTION_LIST_MIDI_MESSAGES = L"--list-midi-messages";
    92 
    96 
    93 }
    97 }
    94 }
    98 }
    95 }
    99 }