src/CLIParser.h
branchv_0
changeset 2 01553c2ffa1d
parent 0 3bc3b33ccb02
child 9 14cf28d7681c
equal deleted inserted replaced
1:7f3ab657dc50 2:01553c2ffa1d
    46 		else throw relpipe::cli::RelpipeCLIException(L"Unable to parse boolean value: " + value + L" (expecting true or false)", relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    46 		else throw relpipe::cli::RelpipeCLIException(L"Unable to parse boolean value: " + value + L" (expecting true or false)", relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    47 	}
    47 	}
    48 
    48 
    49 public:
    49 public:
    50 
    50 
    51 	static const relpipe::common::type::StringX OPTION_TODO;
    51 	static const relpipe::common::type::StringX OPTION_JACK_CLIENT_NAME;
    52 
    52 
    53 	Configuration parse(const std::vector<relpipe::common::type::StringX>& arguments) {
    53 	Configuration parse(const std::vector<relpipe::common::type::StringX>& arguments) {
    54 		Configuration c;
    54 		Configuration c;
    55 
    55 
    56 		for (int i = 0; i < arguments.size();) {
    56 		for (int i = 0; i < arguments.size();) {
    57 			relpipe::common::type::StringX option = readNext(arguments, i);
    57 			relpipe::common::type::StringX option = readNext(arguments, i);
    58 
    58 
    59 			if (option == OPTION_TODO) {
    59 			if (option == OPTION_JACK_CLIENT_NAME) {
    60 				c.todo = parseBoolean(readNext(arguments, i));
    60 				c.jackClientName = readNext(arguments, i);
    61 			} else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    61 			} else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    62 		}
    62 		}
    63 
    63 
    64 		return c;
    64 		return c;
    65 	}
    65 	}
    66 
    66 
    67 	virtual ~CLIParser() {
    67 	virtual ~CLIParser() {
    68 	}
    68 	}
    69 };
    69 };
    70 
    70 
    71 const relpipe::common::type::StringX CLIParser::OPTION_TODO = L"--todo";
    71 const relpipe::common::type::StringX CLIParser::OPTION_JACK_CLIENT_NAME = L"--jack-client-name";
    72 
    72 
    73 }
    73 }
    74 }
    74 }
    75 }
    75 }