src/CLIParser.h
branchv_0
changeset 6 fb717cfbfea1
parent 5 d70ea23682aa
child 23 b497140b0b63
equal deleted inserted replaced
5:d70ea23682aa 6:fb717cfbfea1
    50 
    50 
    51 	static const relpipe::writer::string_t OPTION_RELATION;
    51 	static const relpipe::writer::string_t OPTION_RELATION;
    52 	static const relpipe::writer::string_t OPTION_ENABLE_SECTIONS;
    52 	static const relpipe::writer::string_t OPTION_ENABLE_SECTIONS;
    53 	static const relpipe::writer::string_t OPTION_ENABLE_SUB_KEYS;
    53 	static const relpipe::writer::string_t OPTION_ENABLE_SUB_KEYS;
    54 	static const relpipe::writer::string_t OPTION_ENABLE_COMMENTS;
    54 	static const relpipe::writer::string_t OPTION_ENABLE_COMMENTS;
       
    55 	static const relpipe::writer::string_t OPTION_ENABLE_WHITESPACE;
    55 	static const relpipe::writer::string_t OPTION_ENABLE_LINE_NUMBERS;
    56 	static const relpipe::writer::string_t OPTION_ENABLE_LINE_NUMBERS;
    56 	static const relpipe::writer::string_t OPTION_ENABLE_EVENT_NUMBERS;
    57 	static const relpipe::writer::string_t OPTION_ENABLE_EVENT_NUMBERS;
    57 
    58 
    58 	Configuration parse(const std::vector<relpipe::writer::string_t>& arguments) {
    59 	Configuration parse(const std::vector<relpipe::writer::string_t>& arguments) {
    59 		Configuration c;
    60 		Configuration c;
    63 
    64 
    64 			if (option == OPTION_RELATION) c.relation = readNext(arguments, i);
    65 			if (option == OPTION_RELATION) c.relation = readNext(arguments, i);
    65 			else if (option == OPTION_ENABLE_SECTIONS) c.enableSections = parseBoolean(readNext(arguments, i));
    66 			else if (option == OPTION_ENABLE_SECTIONS) c.enableSections = parseBoolean(readNext(arguments, i));
    66 			else if (option == OPTION_ENABLE_SUB_KEYS) c.enableSubKeys = parseBoolean(readNext(arguments, i));
    67 			else if (option == OPTION_ENABLE_SUB_KEYS) c.enableSubKeys = parseBoolean(readNext(arguments, i));
    67 			else if (option == OPTION_ENABLE_COMMENTS) c.enableComments = parseBoolean(readNext(arguments, i));
    68 			else if (option == OPTION_ENABLE_COMMENTS) c.enableComments = parseBoolean(readNext(arguments, i));
       
    69 			else if (option == OPTION_ENABLE_WHITESPACE) c.enableWhitespace = parseBoolean(readNext(arguments, i));
    68 			else if (option == OPTION_ENABLE_LINE_NUMBERS) c.enableLineNumbers = parseBoolean(readNext(arguments, i));
    70 			else if (option == OPTION_ENABLE_LINE_NUMBERS) c.enableLineNumbers = parseBoolean(readNext(arguments, i));
    69 			else if (option == OPTION_ENABLE_EVENT_NUMBERS) c.enableEventNumbers = parseBoolean(readNext(arguments, i));
    71 			else if (option == OPTION_ENABLE_EVENT_NUMBERS) c.enableEventNumbers = parseBoolean(readNext(arguments, i));
    70 			else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    72 			else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
    71 		}
    73 		}
    72 
    74 
    79 
    81 
    80 const relpipe::writer::string_t CLIParser::OPTION_RELATION = L"--relation";
    82 const relpipe::writer::string_t CLIParser::OPTION_RELATION = L"--relation";
    81 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_SECTIONS = L"--enable-sections";
    83 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_SECTIONS = L"--enable-sections";
    82 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_SUB_KEYS = L"--enable-sub-keys";
    84 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_SUB_KEYS = L"--enable-sub-keys";
    83 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_COMMENTS = L"--enable-comments";
    85 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_COMMENTS = L"--enable-comments";
       
    86 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_WHITESPACE = L"--enable-whitespace";
    84 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_LINE_NUMBERS = L"--enable-line-numbers";
    87 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_LINE_NUMBERS = L"--enable-line-numbers";
    85 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_EVENT_NUMBERS = L"--enable-event-numbers";
    88 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_EVENT_NUMBERS = L"--enable-event-numbers";
    86 
    89 
    87 }
    90 }
    88 }
    91 }