Commit 901e3e4fbfb22566c44c5ab305c93f70c7b0aa49

Authored by Jay Berkenbilt
1 parent 700dfa40

QPDFArgParser: remove unused copyFromOtherTable

This was used, but it no longer is, so let's not keep the extra
complexity around.
include/qpdf/QPDFArgParser.hh
... ... @@ -130,13 +130,6 @@ class QPDFArgParser
130 130 QPDF_DLL
131 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 133 // The final check handler is called at the very end of argument
141 134 // parsing.
142 135 QPDF_DLL
... ...
libqpdf/QPDFArgParser.cc
... ... @@ -177,29 +177,6 @@ QPDFArgParser::addInvalidChoiceHandler(
177 177 }
178 178  
179 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 180 QPDFArgParser::addFinalCheck(bare_arg_handler_t handler)
204 181 {
205 182 this->m->final_check_handler = handler;
... ...
libtests/arg_parser.cc
... ... @@ -67,7 +67,6 @@ ArgParser::initOptions()
67 67 ap.selectMainOptionTable();
68 68 ap.addBare("sheep", [this](){ this->ap.selectOptionTable("sheep"); });
69 69 ap.registerOptionTable("sheep", nullptr);
70   - ap.copyFromOtherTable("ewe", "baaa");
71 70  
72 71 ap.addHelpFooter("For more help, read the manual.\n");
73 72 ap.addHelpTopic(
... ... @@ -190,12 +189,6 @@ ArgParser::test_exceptions()
190 189 err("unknown table", [this]() {
191 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 192 err("add existing help topic", [this]() {
200 193 ap.addHelpTopic("baaa", "potato", "salad");
201 194 });
... ...
libtests/libtests.testcov
... ... @@ -52,8 +52,6 @@ QPDFArgParser help option 0
52 52 QPDFArgParser positional 0
53 53 QPDFArgParser unrecognized 0
54 54 QPDFArgParser complete choices 0
55   -QPDFArgParser copy from unknown 0
56   -QPDFArgParser copy unknown 0
57 55 QPDFArgParser add reserved help topic 0
58 56 QPDFArgParser add existing topic 0
59 57 QPDFArgParser add to unknown topic 0
... ...
libtests/qtest/arg_parser.test
... ... @@ -79,7 +79,6 @@ my @arg_tests = (
79 79 ['@quack-xyz --', 0], # 15
80 80 ['--salad', 2], # 16
81 81 ['--salad=spinach', 0], # 17
82   - ['--sheep --ewe --', 0], # 18
83 82 );
84 83  
85 84 for (my $i = 0; $i < scalar(@arg_tests); ++$i)
... ...
libtests/qtest/arg_parser/args-18.out deleted
1   -you
2   -total quacks: 0
libtests/qtest/arg_parser/completion-sheep.out
1   ---ewe
2 1 !--potato
3 2 !--ram
... ...
libtests/qtest/arg_parser/exceptions.out
... ... @@ -2,8 +2,6 @@ duplicate handler: QPDFArgParser: adding a duplicate handler for option potato i
2 2 duplicate handler: QPDFArgParser: adding a duplicate handler for option ram in baaa option table
3 3 duplicate table: QPDFArgParser: registering already registered option table baaa
4 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 5 add existing help topic: QPDFArgParser: topic baaa has already been added
8 6 add reserved help topic: QPDFArgParser: can't register reserved help topic all
9 7 add to unknown topic: QPDFArgParser: unable to add option --new to unknown help topic oops
... ...