38 } |
38 } |
39 |
39 |
40 public: |
40 public: |
41 |
41 |
42 static const relpipe::writer::string_t OPTION_RELATION; |
42 static const relpipe::writer::string_t OPTION_RELATION; |
43 static const relpipe::writer::string_t OPTION_ENDPOINT_URL; |
43 static const relpipe::writer::string_t OPTION_CONNECTION_STRING; |
44 static const relpipe::writer::string_t OPTION_MESSAGE_COUNT; |
44 static const relpipe::writer::string_t OPTION_MESSAGE_COUNT; |
45 |
45 |
46 Configuration parse(const std::vector<relpipe::writer::string_t>& arguments) { |
46 Configuration parse(const std::vector<relpipe::writer::string_t>& arguments) { |
47 Configuration c; |
47 Configuration c; |
48 |
48 |
49 for (int i = 0; i < arguments.size();) { |
49 for (int i = 0; i < arguments.size();) { |
50 relpipe::writer::string_t option = readNext(arguments, i); |
50 relpipe::writer::string_t option = readNext(arguments, i); |
51 |
51 |
52 if (option == OPTION_RELATION) { |
52 if (option == OPTION_RELATION) { |
53 c.relation = readNext(arguments, i); |
53 c.relation = readNext(arguments, i); |
54 } else if (option == OPTION_ENDPOINT_URL) { |
54 } else if (option == OPTION_CONNECTION_STRING) { |
55 c.endpointUrl = readNext(arguments, i); |
55 c.connectionString = readNext(arguments, i); |
56 } else if (option == OPTION_MESSAGE_COUNT) { |
56 } else if (option == OPTION_MESSAGE_COUNT) { |
57 c.messageCount = std::stoull(readNext(arguments, i)); |
57 c.messageCount = std::stoull(readNext(arguments, i)); |
58 } else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS); |
58 } else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS); |
59 } |
59 } |
60 |
60 |
64 virtual ~CLIParser() { |
64 virtual ~CLIParser() { |
65 } |
65 } |
66 }; |
66 }; |
67 |
67 |
68 const relpipe::writer::string_t CLIParser::OPTION_RELATION = L"--relation"; |
68 const relpipe::writer::string_t CLIParser::OPTION_RELATION = L"--relation"; |
69 const relpipe::writer::string_t CLIParser::OPTION_ENDPOINT_URL = L"--endpoint-url"; |
69 const relpipe::writer::string_t CLIParser::OPTION_CONNECTION_STRING = L"--connection-string"; |
70 const relpipe::writer::string_t CLIParser::OPTION_MESSAGE_COUNT = L"--message-count"; |
70 const relpipe::writer::string_t CLIParser::OPTION_MESSAGE_COUNT = L"--message-count"; |
71 |
71 |
72 } |
72 } |
73 } |
73 } |
74 } |
74 } |