47 } |
47 } |
48 |
48 |
49 public: |
49 public: |
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_PARSER_OPTION; |
52 static const relpipe::writer::string_t OPTION_ENABLE_SECTIONS; |
53 static const relpipe::writer::string_t OPTION_ENABLE_SECTIONS; |
53 static const relpipe::writer::string_t OPTION_ENABLE_SUB_KEYS; |
54 static const relpipe::writer::string_t OPTION_ENABLE_SUB_KEYS; |
54 static const relpipe::writer::string_t OPTION_ENABLE_COMMENTS; |
55 static const relpipe::writer::string_t OPTION_ENABLE_COMMENTS; |
55 static const relpipe::writer::string_t OPTION_ENABLE_WHITESPACE; |
56 static const relpipe::writer::string_t OPTION_ENABLE_WHITESPACE; |
56 static const relpipe::writer::string_t OPTION_ENABLE_LINE_NUMBERS; |
57 static const relpipe::writer::string_t OPTION_ENABLE_LINE_NUMBERS; |
61 |
62 |
62 for (int i = 0; i < arguments.size();) { |
63 for (int i = 0; i < arguments.size();) { |
63 relpipe::writer::string_t option = readNext(arguments, i); |
64 relpipe::writer::string_t option = readNext(arguments, i); |
64 |
65 |
65 if (option == OPTION_RELATION) c.relation = readNext(arguments, i); |
66 if (option == OPTION_RELATION) c.relation = readNext(arguments, i); |
|
67 else if (option == OPTION_PARSER_OPTION) c.parserOptions.push_back({readNext(arguments, i), readNext(arguments, i)}); |
66 else if (option == OPTION_ENABLE_SECTIONS) c.enableSections = parseBoolean(readNext(arguments, i)); |
68 else if (option == OPTION_ENABLE_SECTIONS) c.enableSections = parseBoolean(readNext(arguments, i)); |
67 else if (option == OPTION_ENABLE_SUB_KEYS) c.enableSubKeys = parseBoolean(readNext(arguments, i)); |
69 else if (option == OPTION_ENABLE_SUB_KEYS) c.enableSubKeys = parseBoolean(readNext(arguments, i)); |
68 else if (option == OPTION_ENABLE_COMMENTS) c.enableComments = parseBoolean(readNext(arguments, i)); |
70 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)); |
71 else if (option == OPTION_ENABLE_WHITESPACE) c.enableWhitespace = parseBoolean(readNext(arguments, i)); |
70 else if (option == OPTION_ENABLE_LINE_NUMBERS) c.enableLineNumbers = parseBoolean(readNext(arguments, i)); |
72 else if (option == OPTION_ENABLE_LINE_NUMBERS) c.enableLineNumbers = parseBoolean(readNext(arguments, i)); |
78 virtual ~CLIParser() { |
80 virtual ~CLIParser() { |
79 } |
81 } |
80 }; |
82 }; |
81 |
83 |
82 const relpipe::writer::string_t CLIParser::OPTION_RELATION = L"--relation"; |
84 const relpipe::writer::string_t CLIParser::OPTION_RELATION = L"--relation"; |
|
85 const relpipe::writer::string_t CLIParser::OPTION_PARSER_OPTION = L"--parser-option"; |
83 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_SECTIONS = L"--enable-sections"; |
86 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_SECTIONS = L"--enable-sections"; |
84 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_SUB_KEYS = L"--enable-sub-keys"; |
87 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_SUB_KEYS = L"--enable-sub-keys"; |
85 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_COMMENTS = L"--enable-comments"; |
88 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"; |
89 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_WHITESPACE = L"--enable-whitespace"; |
87 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_LINE_NUMBERS = L"--enable-line-numbers"; |
90 const relpipe::writer::string_t CLIParser::OPTION_ENABLE_LINE_NUMBERS = L"--enable-line-numbers"; |