mirror of
https://github.com/qpdf/qpdf.git
synced 2025-04-02 14:41:50 +00:00
QPDFArgParser: remove unused copyFromOtherTable
This was used, but it no longer is, so let's not keep the extra complexity around.
This commit is contained in:
parent
700dfa40d3
commit
901e3e4fbf
@ -130,13 +130,6 @@ class QPDFArgParser
|
|||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
void addInvalidChoiceHandler(std::string const& arg, param_arg_handler_t);
|
void addInvalidChoiceHandler(std::string const& arg, param_arg_handler_t);
|
||||||
|
|
||||||
// If an option is shared among multiple tables and uses identical
|
|
||||||
// handlers, you can just copy it instead of repeating the
|
|
||||||
// registration call.
|
|
||||||
QPDF_DLL
|
|
||||||
void copyFromOtherTable(std::string const& arg,
|
|
||||||
std::string const& other_table);
|
|
||||||
|
|
||||||
// The final check handler is called at the very end of argument
|
// The final check handler is called at the very end of argument
|
||||||
// parsing.
|
// parsing.
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
|
@ -176,29 +176,6 @@ QPDFArgParser::addInvalidChoiceHandler(
|
|||||||
oe.invalid_choice_handler = handler;
|
oe.invalid_choice_handler = handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
QPDFArgParser::copyFromOtherTable(std::string const& arg,
|
|
||||||
std::string const& other_table)
|
|
||||||
{
|
|
||||||
if (! this->m->option_tables.count(other_table))
|
|
||||||
{
|
|
||||||
QTC::TC("libtests", "QPDFArgParser copy from unknown");
|
|
||||||
throw std::logic_error(
|
|
||||||
"QPDFArgParser: attempt to copy from unknown table " +
|
|
||||||
other_table);
|
|
||||||
}
|
|
||||||
auto& ot = this->m->option_tables[other_table];
|
|
||||||
if (! ot.count(arg))
|
|
||||||
{
|
|
||||||
QTC::TC("libtests", "QPDFArgParser copy unknown");
|
|
||||||
throw std::logic_error(
|
|
||||||
"QPDFArgParser: attempt to copy unknown argument " + arg +
|
|
||||||
" from table " + other_table);
|
|
||||||
}
|
|
||||||
OptionEntry& oe = registerArg(arg);
|
|
||||||
oe = ot[arg];
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
QPDFArgParser::addFinalCheck(bare_arg_handler_t handler)
|
QPDFArgParser::addFinalCheck(bare_arg_handler_t handler)
|
||||||
{
|
{
|
||||||
|
@ -67,7 +67,6 @@ ArgParser::initOptions()
|
|||||||
ap.selectMainOptionTable();
|
ap.selectMainOptionTable();
|
||||||
ap.addBare("sheep", [this](){ this->ap.selectOptionTable("sheep"); });
|
ap.addBare("sheep", [this](){ this->ap.selectOptionTable("sheep"); });
|
||||||
ap.registerOptionTable("sheep", nullptr);
|
ap.registerOptionTable("sheep", nullptr);
|
||||||
ap.copyFromOtherTable("ewe", "baaa");
|
|
||||||
|
|
||||||
ap.addHelpFooter("For more help, read the manual.\n");
|
ap.addHelpFooter("For more help, read the manual.\n");
|
||||||
ap.addHelpTopic(
|
ap.addHelpTopic(
|
||||||
@ -190,12 +189,6 @@ ArgParser::test_exceptions()
|
|||||||
err("unknown table", [this]() {
|
err("unknown table", [this]() {
|
||||||
ap.selectOptionTable("aardvark");
|
ap.selectOptionTable("aardvark");
|
||||||
});
|
});
|
||||||
err("copy from unknown table", [this]() {
|
|
||||||
ap.copyFromOtherTable("one", "two");
|
|
||||||
});
|
|
||||||
err("copy unknown from other table", [this]() {
|
|
||||||
ap.copyFromOtherTable("two", "baaa");
|
|
||||||
});
|
|
||||||
err("add existing help topic", [this]() {
|
err("add existing help topic", [this]() {
|
||||||
ap.addHelpTopic("baaa", "potato", "salad");
|
ap.addHelpTopic("baaa", "potato", "salad");
|
||||||
});
|
});
|
||||||
|
@ -52,8 +52,6 @@ QPDFArgParser help option 0
|
|||||||
QPDFArgParser positional 0
|
QPDFArgParser positional 0
|
||||||
QPDFArgParser unrecognized 0
|
QPDFArgParser unrecognized 0
|
||||||
QPDFArgParser complete choices 0
|
QPDFArgParser complete choices 0
|
||||||
QPDFArgParser copy from unknown 0
|
|
||||||
QPDFArgParser copy unknown 0
|
|
||||||
QPDFArgParser add reserved help topic 0
|
QPDFArgParser add reserved help topic 0
|
||||||
QPDFArgParser add existing topic 0
|
QPDFArgParser add existing topic 0
|
||||||
QPDFArgParser add to unknown topic 0
|
QPDFArgParser add to unknown topic 0
|
||||||
|
@ -79,7 +79,6 @@ my @arg_tests = (
|
|||||||
['@quack-xyz --', 0], # 15
|
['@quack-xyz --', 0], # 15
|
||||||
['--salad', 2], # 16
|
['--salad', 2], # 16
|
||||||
['--salad=spinach', 0], # 17
|
['--salad=spinach', 0], # 17
|
||||||
['--sheep --ewe --', 0], # 18
|
|
||||||
);
|
);
|
||||||
|
|
||||||
for (my $i = 0; $i < scalar(@arg_tests); ++$i)
|
for (my $i = 0; $i < scalar(@arg_tests); ++$i)
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
you
|
|
||||||
total quacks: 0
|
|
@ -1,3 +1,2 @@
|
|||||||
--ewe
|
|
||||||
!--potato
|
!--potato
|
||||||
!--ram
|
!--ram
|
||||||
|
@ -2,8 +2,6 @@ duplicate handler: QPDFArgParser: adding a duplicate handler for option potato i
|
|||||||
duplicate handler: QPDFArgParser: adding a duplicate handler for option ram in baaa option table
|
duplicate handler: QPDFArgParser: adding a duplicate handler for option ram in baaa option table
|
||||||
duplicate table: QPDFArgParser: registering already registered option table baaa
|
duplicate table: QPDFArgParser: registering already registered option table baaa
|
||||||
unknown table: QPDFArgParser: selecting unregistered option table aardvark
|
unknown table: QPDFArgParser: selecting unregistered option table aardvark
|
||||||
copy from unknown table: QPDFArgParser: attempt to copy from unknown table two
|
|
||||||
copy unknown from other table: QPDFArgParser: attempt to copy unknown argument two from table baaa
|
|
||||||
add existing help topic: QPDFArgParser: topic baaa has already been added
|
add existing help topic: QPDFArgParser: topic baaa has already been added
|
||||||
add reserved help topic: QPDFArgParser: can't register reserved help topic all
|
add reserved help topic: QPDFArgParser: can't register reserved help topic all
|
||||||
add to unknown topic: QPDFArgParser: unable to add option --new to unknown help topic oops
|
add to unknown topic: QPDFArgParser: unable to add option --new to unknown help topic oops
|
||||||
|
Loading…
x
Reference in New Issue
Block a user