Commit 901e3e4fbfb22566c44c5ab305c93f70c7b0aa49
1 parent
700dfa40
QPDFArgParser: remove unused copyFromOtherTable
This was used, but it no longer is, so let's not keep the extra complexity around.
Showing
8 changed files
with
0 additions
and
45 deletions
include/qpdf/QPDFArgParser.hh
| @@ -130,13 +130,6 @@ class QPDFArgParser | @@ -130,13 +130,6 @@ class QPDFArgParser | ||
| 130 | QPDF_DLL | 130 | QPDF_DLL |
| 131 | void addInvalidChoiceHandler(std::string const& arg, param_arg_handler_t); | 131 | void addInvalidChoiceHandler(std::string const& arg, param_arg_handler_t); |
| 132 | 132 | ||
| 133 | - // If an option is shared among multiple tables and uses identical | ||
| 134 | - // handlers, you can just copy it instead of repeating the | ||
| 135 | - // registration call. | ||
| 136 | - QPDF_DLL | ||
| 137 | - void copyFromOtherTable(std::string const& arg, | ||
| 138 | - std::string const& other_table); | ||
| 139 | - | ||
| 140 | // The final check handler is called at the very end of argument | 133 | // The final check handler is called at the very end of argument |
| 141 | // parsing. | 134 | // parsing. |
| 142 | QPDF_DLL | 135 | QPDF_DLL |
libqpdf/QPDFArgParser.cc
| @@ -177,29 +177,6 @@ QPDFArgParser::addInvalidChoiceHandler( | @@ -177,29 +177,6 @@ QPDFArgParser::addInvalidChoiceHandler( | ||
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | void | 179 | void |
| 180 | -QPDFArgParser::copyFromOtherTable(std::string const& arg, | ||
| 181 | - std::string const& other_table) | ||
| 182 | -{ | ||
| 183 | - if (! this->m->option_tables.count(other_table)) | ||
| 184 | - { | ||
| 185 | - QTC::TC("libtests", "QPDFArgParser copy from unknown"); | ||
| 186 | - throw std::logic_error( | ||
| 187 | - "QPDFArgParser: attempt to copy from unknown table " + | ||
| 188 | - other_table); | ||
| 189 | - } | ||
| 190 | - auto& ot = this->m->option_tables[other_table]; | ||
| 191 | - if (! ot.count(arg)) | ||
| 192 | - { | ||
| 193 | - QTC::TC("libtests", "QPDFArgParser copy unknown"); | ||
| 194 | - throw std::logic_error( | ||
| 195 | - "QPDFArgParser: attempt to copy unknown argument " + arg + | ||
| 196 | - " from table " + other_table); | ||
| 197 | - } | ||
| 198 | - OptionEntry& oe = registerArg(arg); | ||
| 199 | - oe = ot[arg]; | ||
| 200 | -} | ||
| 201 | - | ||
| 202 | -void | ||
| 203 | QPDFArgParser::addFinalCheck(bare_arg_handler_t handler) | 180 | QPDFArgParser::addFinalCheck(bare_arg_handler_t handler) |
| 204 | { | 181 | { |
| 205 | this->m->final_check_handler = handler; | 182 | this->m->final_check_handler = handler; |
libtests/arg_parser.cc
| @@ -67,7 +67,6 @@ ArgParser::initOptions() | @@ -67,7 +67,6 @@ ArgParser::initOptions() | ||
| 67 | ap.selectMainOptionTable(); | 67 | ap.selectMainOptionTable(); |
| 68 | ap.addBare("sheep", [this](){ this->ap.selectOptionTable("sheep"); }); | 68 | ap.addBare("sheep", [this](){ this->ap.selectOptionTable("sheep"); }); |
| 69 | ap.registerOptionTable("sheep", nullptr); | 69 | ap.registerOptionTable("sheep", nullptr); |
| 70 | - ap.copyFromOtherTable("ewe", "baaa"); | ||
| 71 | 70 | ||
| 72 | ap.addHelpFooter("For more help, read the manual.\n"); | 71 | ap.addHelpFooter("For more help, read the manual.\n"); |
| 73 | ap.addHelpTopic( | 72 | ap.addHelpTopic( |
| @@ -190,12 +189,6 @@ ArgParser::test_exceptions() | @@ -190,12 +189,6 @@ ArgParser::test_exceptions() | ||
| 190 | err("unknown table", [this]() { | 189 | err("unknown table", [this]() { |
| 191 | ap.selectOptionTable("aardvark"); | 190 | ap.selectOptionTable("aardvark"); |
| 192 | }); | 191 | }); |
| 193 | - err("copy from unknown table", [this]() { | ||
| 194 | - ap.copyFromOtherTable("one", "two"); | ||
| 195 | - }); | ||
| 196 | - err("copy unknown from other table", [this]() { | ||
| 197 | - ap.copyFromOtherTable("two", "baaa"); | ||
| 198 | - }); | ||
| 199 | err("add existing help topic", [this]() { | 192 | err("add existing help topic", [this]() { |
| 200 | ap.addHelpTopic("baaa", "potato", "salad"); | 193 | ap.addHelpTopic("baaa", "potato", "salad"); |
| 201 | }); | 194 | }); |
libtests/libtests.testcov
| @@ -52,8 +52,6 @@ QPDFArgParser help option 0 | @@ -52,8 +52,6 @@ QPDFArgParser help option 0 | ||
| 52 | QPDFArgParser positional 0 | 52 | QPDFArgParser positional 0 |
| 53 | QPDFArgParser unrecognized 0 | 53 | QPDFArgParser unrecognized 0 |
| 54 | QPDFArgParser complete choices 0 | 54 | QPDFArgParser complete choices 0 |
| 55 | -QPDFArgParser copy from unknown 0 | ||
| 56 | -QPDFArgParser copy unknown 0 | ||
| 57 | QPDFArgParser add reserved help topic 0 | 55 | QPDFArgParser add reserved help topic 0 |
| 58 | QPDFArgParser add existing topic 0 | 56 | QPDFArgParser add existing topic 0 |
| 59 | QPDFArgParser add to unknown topic 0 | 57 | QPDFArgParser add to unknown topic 0 |
libtests/qtest/arg_parser.test
| @@ -79,7 +79,6 @@ my @arg_tests = ( | @@ -79,7 +79,6 @@ my @arg_tests = ( | ||
| 79 | ['@quack-xyz --', 0], # 15 | 79 | ['@quack-xyz --', 0], # 15 |
| 80 | ['--salad', 2], # 16 | 80 | ['--salad', 2], # 16 |
| 81 | ['--salad=spinach', 0], # 17 | 81 | ['--salad=spinach', 0], # 17 |
| 82 | - ['--sheep --ewe --', 0], # 18 | ||
| 83 | ); | 82 | ); |
| 84 | 83 | ||
| 85 | for (my $i = 0; $i < scalar(@arg_tests); ++$i) | 84 | for (my $i = 0; $i < scalar(@arg_tests); ++$i) |
libtests/qtest/arg_parser/args-18.out deleted
libtests/qtest/arg_parser/completion-sheep.out
libtests/qtest/arg_parser/exceptions.out
| @@ -2,8 +2,6 @@ duplicate handler: QPDFArgParser: adding a duplicate handler for option potato i | @@ -2,8 +2,6 @@ duplicate handler: QPDFArgParser: adding a duplicate handler for option potato i | ||
| 2 | duplicate handler: QPDFArgParser: adding a duplicate handler for option ram in baaa option table | 2 | duplicate handler: QPDFArgParser: adding a duplicate handler for option ram in baaa option table |
| 3 | duplicate table: QPDFArgParser: registering already registered option table baaa | 3 | duplicate table: QPDFArgParser: registering already registered option table baaa |
| 4 | unknown table: QPDFArgParser: selecting unregistered option table aardvark | 4 | unknown table: QPDFArgParser: selecting unregistered option table aardvark |
| 5 | -copy from unknown table: QPDFArgParser: attempt to copy from unknown table two | ||
| 6 | -copy unknown from other table: QPDFArgParser: attempt to copy unknown argument two from table baaa | ||
| 7 | add existing help topic: QPDFArgParser: topic baaa has already been added | 5 | add existing help topic: QPDFArgParser: topic baaa has already been added |
| 8 | add reserved help topic: QPDFArgParser: can't register reserved help topic all | 6 | add reserved help topic: QPDFArgParser: can't register reserved help topic all |
| 9 | add to unknown topic: QPDFArgParser: unable to add option --new to unknown help topic oops | 7 | add to unknown topic: QPDFArgParser: unable to add option --new to unknown help topic oops |