aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-02-01 10:16:58 +0100
committerJay Berkenbilt <ejb@ql.org>2022-02-01 15:04:55 +0100
commit5a7bb3474eb10ec9dea8409466a14f72ead73e60 (patch)
tree481a833d9954eefaab4052957734f4766597e9bd /libqpdf
parent5953116634660065510fa5892fcc42d0a3c5e725 (diff)
downloadqpdf-5a7bb3474eb10ec9dea8409466a14f72ead73e60.tar.zst
generate_auto_job: generate overloaded config decls for optional
For optional parameter/choices, generate an overloaded config method that takes no arguments. This makes it possible to convert from a bare argument to one that takes an optional parameter without breaking binary compatibility.
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/QPDFJob_config.cc20
-rw-r--r--libqpdf/qpdf/auto_job_init.hh4
2 files changed, 21 insertions, 3 deletions
diff --git a/libqpdf/QPDFJob_config.cc b/libqpdf/QPDFJob_config.cc
index ed8943f6..fb61924c 100644
--- a/libqpdf/QPDFJob_config.cc
+++ b/libqpdf/QPDFJob_config.cc
@@ -106,6 +106,12 @@ QPDFJob::Config::coalesceContents()
}
QPDFJob::Config*
+QPDFJob::Config::collate()
+{
+ return collate(nullptr);
+}
+
+QPDFJob::Config*
QPDFJob::Config::collate(char const* parameter)
{
auto n = (((parameter == 0) || (strlen(parameter) == 0)) ? 1 :
@@ -235,9 +241,15 @@ QPDFJob::Config::isEncrypted()
}
QPDFJob::Config*
+QPDFJob::Config::json()
+{
+ return json(nullptr);
+}
+
+QPDFJob::Config*
QPDFJob::Config::json(char const* parameter)
{
- if (parameter)
+ if (parameter && strlen(parameter))
{
if (strcmp(parameter, "latest") == 0)
{
@@ -517,6 +529,12 @@ QPDFJob::Config::showXref()
}
QPDFJob::Config*
+QPDFJob::Config::splitPages()
+{
+ return splitPages(nullptr);
+}
+
+QPDFJob::Config*
QPDFJob::Config::splitPages(char const* parameter)
{
int n = (((parameter == 0) || (strlen(parameter) == 0)) ? 1 :
diff --git a/libqpdf/qpdf/auto_job_init.hh b/libqpdf/qpdf/auto_job_init.hh
index 28c47be4..17ab0848 100644
--- a/libqpdf/qpdf/auto_job_init.hh
+++ b/libqpdf/qpdf/auto_job_init.hh
@@ -79,8 +79,6 @@ this->ap.addBare("underlay", b(&ArgParser::argUnderlay));
this->ap.addBare("verbose", [this](){c_main->verbose();});
this->ap.addBare("warning-exit-0", [this](){c_main->warningExit0();});
this->ap.addBare("with-images", [this](){c_main->withImages();});
-this->ap.addOptionalParameter("collate", [this](char *x){c_main->collate(x);});
-this->ap.addOptionalParameter("split-pages", [this](char *x){c_main->splitPages(x);});
this->ap.addRequiredParameter("compression-level", [this](char *x){c_main->compressionLevel(x);}, "level");
this->ap.addRequiredParameter("copy-encryption", [this](char *x){c_main->copyEncryption(x);}, "file");
this->ap.addRequiredParameter("encryption-file-password", [this](char *x){c_main->encryptionFilePassword(x);}, "password");
@@ -100,6 +98,8 @@ this->ap.addRequiredParameter("remove-attachment", [this](char *x){c_main->remov
this->ap.addRequiredParameter("rotate", [this](char *x){c_main->rotate(x);}, "[+|-]angle");
this->ap.addRequiredParameter("show-attachment", [this](char *x){c_main->showAttachment(x);}, "attachment");
this->ap.addRequiredParameter("show-object", [this](char *x){c_main->showObject(x);}, "trailer");
+this->ap.addOptionalParameter("collate", [this](char *x){c_main->collate(x);});
+this->ap.addOptionalParameter("split-pages", [this](char *x){c_main->splitPages(x);});
this->ap.addChoices("compress-streams", [this](char *x){c_main->compressStreams(x);}, true, yn_choices);
this->ap.addChoices("decode-level", [this](char *x){c_main->decodeLevel(x);}, true, decode_level_choices);
this->ap.addChoices("flatten-annotations", [this](char *x){c_main->flattenAnnotations(x);}, true, flatten_choices);