Commit 21c897aad0c3edc6e47e88754ab279e0f076cd06
1 parent
965e473a
QPDFJob: convert a flag in other than the main table
Showing
9 changed files
with
173 additions
and
108 deletions
generate_auto_job
| @@ -71,7 +71,6 @@ not_yet = set([ | @@ -71,7 +71,6 @@ not_yet = set([ | ||
| 71 | 'password', | 71 | 'password', |
| 72 | 'password-file', | 72 | 'password-file', |
| 73 | 'password-mode', | 73 | 'password-mode', |
| 74 | - 'prefix', | ||
| 75 | 'print', | 74 | 'print', |
| 76 | 'remove-unreferenced-resources', | 75 | 'remove-unreferenced-resources', |
| 77 | 'repeat', | 76 | 'repeat', |
| @@ -326,26 +325,26 @@ class Main: | @@ -326,26 +325,26 @@ class Main: | ||
| 326 | self.update_hashes() | 325 | self.update_hashes() |
| 327 | # DON'T ADD CODE TO generate AFTER update_hashes | 326 | # DON'T ADD CODE TO generate AFTER update_hashes |
| 328 | 327 | ||
| 329 | - def handle_trivial(self, i, identifier, config, kind, v): | 328 | + def handle_trivial(self, i, identifier, cfg, kind, v): |
| 330 | # QXXXQ could potentially generate declarations for config | 329 | # QXXXQ could potentially generate declarations for config |
| 331 | # methods separately by config object | 330 | # methods separately by config object |
| 332 | if kind == 'bare': | 331 | if kind == 'bare': |
| 333 | self.init.append(f'this->ap.addBare("{i}", ' | 332 | self.init.append(f'this->ap.addBare("{i}", ' |
| 334 | - f'[this](){{{config}.{identifier}();}});') | 333 | + f'[this](){{{cfg}->{identifier}();}});') |
| 335 | elif kind == 'optional_parameter': | 334 | elif kind == 'optional_parameter': |
| 336 | self.init.append(f'this->ap.addOptionalParameter("{i}", ' | 335 | self.init.append(f'this->ap.addOptionalParameter("{i}", ' |
| 337 | - f'[this](char *x){{{config}.{identifier}(x);}});') | 336 | + f'[this](char *x){{{cfg}->{identifier}(x);}});') |
| 338 | elif kind == 'required_parameter': | 337 | elif kind == 'required_parameter': |
| 339 | self.init.append(f'this->ap.addRequiredParameter("{i}", ' | 338 | self.init.append(f'this->ap.addRequiredParameter("{i}", ' |
| 340 | - f'[this](char *x){{{config}.{identifier}(x);}}' | 339 | + f'[this](char *x){{{cfg}->{identifier}(x);}}' |
| 341 | f', "{v}");') | 340 | f', "{v}");') |
| 342 | elif kind == 'required_choices': | 341 | elif kind == 'required_choices': |
| 343 | self.init.append(f'this->ap.addChoices("{i}", ' | 342 | self.init.append(f'this->ap.addChoices("{i}", ' |
| 344 | - f'[this](char *x){{{config}.{identifier}(x);}}' | 343 | + f'[this](char *x){{{cfg}->{identifier}(x);}}' |
| 345 | f', true, {v}_choices);') | 344 | f', true, {v}_choices);') |
| 346 | elif kind == 'optional_choices': | 345 | elif kind == 'optional_choices': |
| 347 | self.init.append(f'this->ap.addChoices("{i}", ' | 346 | self.init.append(f'this->ap.addChoices("{i}", ' |
| 348 | - f'[this](char *x){{{config}.{identifier}(x);}}' | 347 | + f'[this](char *x){{{cfg}->{identifier}(x);}}' |
| 349 | f', false, {v}_choices);') | 348 | f', false, {v}_choices);') |
| 350 | 349 | ||
| 351 | def handle_flag(self, i, identifier, kind, v): | 350 | def handle_flag(self, i, identifier, kind, v): |
include/qpdf/QPDFJob.hh
| @@ -100,11 +100,44 @@ class QPDFJob | @@ -100,11 +100,44 @@ class QPDFJob | ||
| 100 | // CONFIGURATION | 100 | // CONFIGURATION |
| 101 | // (implemented in QPDFJob_config.cc) | 101 | // (implemented in QPDFJob_config.cc) |
| 102 | 102 | ||
| 103 | + private: | ||
| 104 | + struct CopyAttachmentFrom | ||
| 105 | + { | ||
| 106 | + std::string path; | ||
| 107 | + std::string password; | ||
| 108 | + std::string prefix; | ||
| 109 | + }; | ||
| 110 | + | ||
| 111 | + public: | ||
| 112 | + class Config; | ||
| 113 | + class CopyAttConfig | ||
| 114 | + { | ||
| 115 | + friend class QPDFJob; | ||
| 116 | + friend class Config; | ||
| 117 | + public: | ||
| 118 | + QPDF_DLL CopyAttConfig& filename(char const* parameter); | ||
| 119 | + // QXXXQ auto | ||
| 120 | + QPDF_DLL CopyAttConfig& prefix(char const* parameter); | ||
| 121 | + QPDF_DLL CopyAttConfig& password(char const* parameter); | ||
| 122 | + QPDF_DLL Config& end(); | ||
| 123 | + // /QXXXQ | ||
| 124 | + | ||
| 125 | + private: | ||
| 126 | + CopyAttConfig(Config&); | ||
| 127 | + CopyAttConfig(CopyAttConfig const&) = delete; | ||
| 128 | + | ||
| 129 | + Config& config; | ||
| 130 | + CopyAttachmentFrom caf; | ||
| 131 | + }; | ||
| 132 | + | ||
| 103 | // Configuration is performed by calling methods XXX QXXXQ document | 133 | // Configuration is performed by calling methods XXX QXXXQ document |
| 104 | class Config | 134 | class Config |
| 105 | { | 135 | { |
| 106 | friend class QPDFJob; | 136 | friend class QPDFJob; |
| 107 | public: | 137 | public: |
| 138 | + QPDF_DLL | ||
| 139 | + std::shared_ptr<CopyAttConfig> copyAttachmentsFrom(); | ||
| 140 | + | ||
| 108 | // QXXXQ could potentially generate these declarations | 141 | // QXXXQ could potentially generate these declarations |
| 109 | QPDF_DLL Config& allowWeakCrypto(); | 142 | QPDF_DLL Config& allowWeakCrypto(); |
| 110 | QPDF_DLL Config& check(); | 143 | QPDF_DLL Config& check(); |
| @@ -171,9 +204,11 @@ class QPDFJob | @@ -171,9 +204,11 @@ class QPDFJob | ||
| 171 | QPDF_DLL Config& verbose(); | 204 | QPDF_DLL Config& verbose(); |
| 172 | QPDF_DLL Config& warningExit0(); | 205 | QPDF_DLL Config& warningExit0(); |
| 173 | QPDF_DLL Config& withImages(); | 206 | QPDF_DLL Config& withImages(); |
| 207 | + // /QXXXQ | ||
| 174 | 208 | ||
| 175 | private: | 209 | private: |
| 176 | Config() = delete; | 210 | Config() = delete; |
| 211 | + Config(Config const&) = delete; | ||
| 177 | Config(QPDFJob& job) : | 212 | Config(QPDFJob& job) : |
| 178 | o(job) | 213 | o(job) |
| 179 | { | 214 | { |
| @@ -183,7 +218,7 @@ class QPDFJob | @@ -183,7 +218,7 @@ class QPDFJob | ||
| 183 | friend class Config; | 218 | friend class Config; |
| 184 | 219 | ||
| 185 | QPDF_DLL | 220 | QPDF_DLL |
| 186 | - Config config(); | 221 | + std::shared_ptr<Config> config(); |
| 187 | 222 | ||
| 188 | // QXXXQ set options -- implemented in QPDFJob_options.cc | 223 | // QXXXQ set options -- implemented in QPDFJob_options.cc |
| 189 | 224 | ||
| @@ -295,13 +330,6 @@ class QPDFJob | @@ -295,13 +330,6 @@ class QPDFJob | ||
| 295 | bool replace; | 330 | bool replace; |
| 296 | }; | 331 | }; |
| 297 | 332 | ||
| 298 | - struct CopyAttachmentFrom | ||
| 299 | - { | ||
| 300 | - std::string path; | ||
| 301 | - std::string password; | ||
| 302 | - std::string prefix; | ||
| 303 | - }; | ||
| 304 | - | ||
| 305 | enum remove_unref_e { re_auto, re_yes, re_no }; | 333 | enum remove_unref_e { re_auto, re_yes, re_no }; |
| 306 | 334 | ||
| 307 | std::shared_ptr<char> password; | 335 | std::shared_ptr<char> password; |
job.sums
| 1 | # Generated by generate_auto_job | 1 | # Generated by generate_auto_job |
| 2 | -generate_auto_job ab9b8cdb8ccf47417d265eebcf562c51bf4d5bff6abaf0920931b972f6c7b80b | ||
| 3 | -job.yml 2752b11028530f127b06e9731834dc3ae4c3b13d0161608e3b258cd2a79767d7 | ||
| 4 | -libqpdf/qpdf/auto_job_decl.hh db95ca0864e7495532095cd193be1ff0c15797b9ccaf252024c1154bae57b365 | 2 | +generate_auto_job 8e2c467c47a66caef46497d96be461e7373e22124abe1bde3ef353bd99452609 |
| 3 | +job.yml 55d272cca0657e1f96ca92f5253edb6c6e24e6ea19e37690446d2111adc13f91 | ||
| 4 | +libqpdf/qpdf/auto_job_decl.hh ff9bbeec974f6a7e6ed2ba205e3d7f81fbe4f6224860a9ba37c30b817b951a90 | ||
| 5 | libqpdf/qpdf/auto_job_help.hh 383eea80e2c185ef5295fc126246457a7ceeffea759fdb90bb2e6727532ea538 | 5 | libqpdf/qpdf/auto_job_help.hh 383eea80e2c185ef5295fc126246457a7ceeffea759fdb90bb2e6727532ea538 |
| 6 | -libqpdf/qpdf/auto_job_init.hh 864bb0a01df93bff129e7bc1723611d4e73f20ef7b0e33bd52261811eee43e2f | 6 | +libqpdf/qpdf/auto_job_init.hh 45e3d28708c7506a681477a7865fa39dcd10e93819875a8d5664d6629f6e5245 |
| 7 | libqpdf/qpdf/auto_job_schema.hh c91a4e182e088797b70dda94af03ca32d360f3564890132da2a8bdc3c4432423 | 7 | libqpdf/qpdf/auto_job_schema.hh c91a4e182e088797b70dda94af03ca32d360f3564890132da2a8bdc3c4432423 |
| 8 | manual/_ext/qpdf.py 855fe12de5af7a10bb24be6ecc4d5dff4c84ac58cf388a13be6bbb394346a67d | 8 | manual/_ext/qpdf.py 855fe12de5af7a10bb24be6ecc4d5dff4c84ac58cf388a13be6bbb394346a67d |
| 9 | manual/cli.rst 68122ff8179c10df3fe6d577adde4973c346f7866ba9a511bab5a6e6f292a6f1 | 9 | manual/cli.rst 68122ff8179c10df3fe6d577adde4973c346f7866ba9a511bab5a6e6f292a6f1 |
job.yml
| @@ -60,7 +60,7 @@ options: | @@ -60,7 +60,7 @@ options: | ||
| 60 | - show-crypto | 60 | - show-crypto |
| 61 | - job-json-help | 61 | - job-json-help |
| 62 | - table: main | 62 | - table: main |
| 63 | - config: jc | 63 | + config: c_main |
| 64 | positional: true | 64 | positional: true |
| 65 | bare: | 65 | bare: |
| 66 | - add-attachment | 66 | - add-attachment |
| @@ -215,6 +215,7 @@ options: | @@ -215,6 +215,7 @@ options: | ||
| 215 | mimetype: mime/type | 215 | mimetype: mime/type |
| 216 | description: description | 216 | description: description |
| 217 | - table: copy attachment | 217 | - table: copy attachment |
| 218 | + config: c_copy_att | ||
| 218 | prefix: CopyAtt | 219 | prefix: CopyAtt |
| 219 | positional: true | 220 | positional: true |
| 220 | required_parameter: | 221 | required_parameter: |
libqpdf/QPDFJob.cc
| @@ -453,10 +453,10 @@ QPDFJob::doIfVerbose( | @@ -453,10 +453,10 @@ QPDFJob::doIfVerbose( | ||
| 453 | } | 453 | } |
| 454 | } | 454 | } |
| 455 | 455 | ||
| 456 | -QPDFJob::Config | 456 | +std::shared_ptr<QPDFJob::Config> |
| 457 | QPDFJob::config() | 457 | QPDFJob::config() |
| 458 | { | 458 | { |
| 459 | - return Config(*this); | 459 | + return std::shared_ptr<Config>(new Config(*this)); |
| 460 | } | 460 | } |
| 461 | 461 | ||
| 462 | void | 462 | void |
libqpdf/QPDFJob_argv.cc
| @@ -26,7 +26,8 @@ namespace | @@ -26,7 +26,8 @@ namespace | ||
| 26 | class ArgParser | 26 | class ArgParser |
| 27 | { | 27 | { |
| 28 | public: | 28 | public: |
| 29 | - ArgParser(QPDFArgParser& ap, QPDFJob::Config& jc, QPDFJob& o); | 29 | + ArgParser(QPDFArgParser& ap, |
| 30 | + std::shared_ptr<QPDFJob::Config> c_main, QPDFJob& o); | ||
| 30 | void parseOptions(); | 31 | void parseOptions(); |
| 31 | 32 | ||
| 32 | private: | 33 | private: |
| @@ -42,16 +43,18 @@ namespace | @@ -42,16 +43,18 @@ namespace | ||
| 42 | 43 | ||
| 43 | QPDFArgParser ap; | 44 | QPDFArgParser ap; |
| 44 | QPDFJob& o; | 45 | QPDFJob& o; |
| 45 | - QPDFJob::Config& jc; | 46 | + std::shared_ptr<QPDFJob::Config> c_main; |
| 47 | + std::shared_ptr<QPDFJob::CopyAttConfig> c_copy_att; | ||
| 46 | std::vector<char*> accumulated_args; // points to member in ap | 48 | std::vector<char*> accumulated_args; // points to member in ap |
| 47 | char* pages_password; | 49 | char* pages_password; |
| 48 | }; | 50 | }; |
| 49 | } | 51 | } |
| 50 | 52 | ||
| 51 | -ArgParser::ArgParser(QPDFArgParser& ap, QPDFJob::Config& jc, QPDFJob& o) : | 53 | +ArgParser::ArgParser(QPDFArgParser& ap, |
| 54 | + std::shared_ptr<QPDFJob::Config> c_main, QPDFJob& o) : | ||
| 52 | ap(ap), | 55 | ap(ap), |
| 53 | o(o), | 56 | o(o), |
| 54 | - jc(jc), | 57 | + c_main(c_main), |
| 55 | pages_password(nullptr) | 58 | pages_password(nullptr) |
| 56 | { | 59 | { |
| 57 | initOptionTables(); | 60 | initOptionTables(); |
| @@ -451,7 +454,7 @@ ArgParser::argAddAttachment() | @@ -451,7 +454,7 @@ ArgParser::argAddAttachment() | ||
| 451 | void | 454 | void |
| 452 | ArgParser::argCopyAttachmentsFrom() | 455 | ArgParser::argCopyAttachmentsFrom() |
| 453 | { | 456 | { |
| 454 | - o.attachments_to_copy.push_back(QPDFJob::CopyAttachmentFrom()); | 457 | + this->c_copy_att = c_main->copyAttachmentsFrom(); |
| 455 | this->ap.selectOptionTable(O_COPY_ATTACHMENT); | 458 | this->ap.selectOptionTable(O_COPY_ATTACHMENT); |
| 456 | } | 459 | } |
| 457 | 460 | ||
| @@ -888,28 +891,21 @@ ArgParser::argEndAttachment() | @@ -888,28 +891,21 @@ ArgParser::argEndAttachment() | ||
| 888 | void | 891 | void |
| 889 | ArgParser::argCopyAttPositional(char* arg) | 892 | ArgParser::argCopyAttPositional(char* arg) |
| 890 | { | 893 | { |
| 891 | - o.attachments_to_copy.back().path = arg; | ||
| 892 | -} | ||
| 893 | - | ||
| 894 | -void | ||
| 895 | -ArgParser::argCopyAttPrefix(char* parameter) | ||
| 896 | -{ | ||
| 897 | - o.attachments_to_copy.back().prefix = parameter; | 894 | + c_copy_att->filename(arg); |
| 898 | } | 895 | } |
| 899 | 896 | ||
| 900 | void | 897 | void |
| 901 | ArgParser::argCopyAttPassword(char* parameter) | 898 | ArgParser::argCopyAttPassword(char* parameter) |
| 902 | { | 899 | { |
| 903 | - o.attachments_to_copy.back().password = parameter; | 900 | + // QXXXQ @TRIVIAL |
| 901 | + c_copy_att->password(parameter); | ||
| 904 | } | 902 | } |
| 905 | 903 | ||
| 906 | void | 904 | void |
| 907 | ArgParser::argEndCopyAttachment() | 905 | ArgParser::argEndCopyAttachment() |
| 908 | { | 906 | { |
| 909 | - if (o.attachments_to_copy.back().path.empty()) | ||
| 910 | - { | ||
| 911 | - usage("copy attachments: no path specified"); | ||
| 912 | - } | 907 | + c_copy_att->end(); |
| 908 | + c_copy_att = nullptr; | ||
| 913 | } | 909 | } |
| 914 | 910 | ||
| 915 | void | 911 | void |
| @@ -1072,8 +1068,7 @@ QPDFJob::initializeFromArgv(int argc, char* argv[], char const* progname_env) | @@ -1072,8 +1068,7 @@ QPDFJob::initializeFromArgv(int argc, char* argv[], char const* progname_env) | ||
| 1072 | } | 1068 | } |
| 1073 | QPDFArgParser qap(argc, argv, progname_env); | 1069 | QPDFArgParser qap(argc, argv, progname_env); |
| 1074 | setMessagePrefix(qap.getProgname()); | 1070 | setMessagePrefix(qap.getProgname()); |
| 1075 | - auto jc = config(); | ||
| 1076 | - ArgParser ap(qap, jc, *this); | 1071 | + ArgParser ap(qap, config(), *this); |
| 1077 | ap.parseOptions(); | 1072 | ap.parseOptions(); |
| 1078 | } | 1073 | } |
| 1079 | 1074 |
libqpdf/QPDFJob_config.cc
| @@ -489,3 +489,46 @@ QPDFJob::Config::withImages() | @@ -489,3 +489,46 @@ QPDFJob::Config::withImages() | ||
| 489 | o.show_page_images = true; | 489 | o.show_page_images = true; |
| 490 | return *this; | 490 | return *this; |
| 491 | } | 491 | } |
| 492 | + | ||
| 493 | +std::shared_ptr<QPDFJob::CopyAttConfig> | ||
| 494 | +QPDFJob::Config::copyAttachmentsFrom() | ||
| 495 | +{ | ||
| 496 | + return std::shared_ptr<CopyAttConfig>(new CopyAttConfig(*this)); | ||
| 497 | +} | ||
| 498 | + | ||
| 499 | +QPDFJob::CopyAttConfig::CopyAttConfig(Config& c) : | ||
| 500 | + config(c) | ||
| 501 | +{ | ||
| 502 | +} | ||
| 503 | + | ||
| 504 | +QPDFJob::CopyAttConfig& | ||
| 505 | +QPDFJob::CopyAttConfig::filename(char const* parameter) | ||
| 506 | +{ | ||
| 507 | + this->caf.path = parameter; | ||
| 508 | + return *this; | ||
| 509 | +} | ||
| 510 | + | ||
| 511 | +QPDFJob::CopyAttConfig& | ||
| 512 | +QPDFJob::CopyAttConfig::prefix(char const* parameter) | ||
| 513 | +{ | ||
| 514 | + this->caf.prefix = parameter; | ||
| 515 | + return *this; | ||
| 516 | +} | ||
| 517 | + | ||
| 518 | +QPDFJob::CopyAttConfig& | ||
| 519 | +QPDFJob::CopyAttConfig::password(char const* parameter) | ||
| 520 | +{ | ||
| 521 | + this->caf.password = parameter; | ||
| 522 | + return *this; | ||
| 523 | +} | ||
| 524 | + | ||
| 525 | +QPDFJob::Config& | ||
| 526 | +QPDFJob::CopyAttConfig::end() | ||
| 527 | +{ | ||
| 528 | + if (this->caf.path.empty()) | ||
| 529 | + { | ||
| 530 | + throw std::runtime_error("copy attachments: no path specified"); | ||
| 531 | + } | ||
| 532 | + this->config.o.attachments_to_copy.push_back(this->caf); | ||
| 533 | + return this->config; | ||
| 534 | +} |
libqpdf/qpdf/auto_job_decl.hh
| @@ -75,6 +75,5 @@ void argAttMimetype(char *); | @@ -75,6 +75,5 @@ void argAttMimetype(char *); | ||
| 75 | void argAttDescription(char *); | 75 | void argAttDescription(char *); |
| 76 | void argEndAttachment(); | 76 | void argEndAttachment(); |
| 77 | void argCopyAttPositional(char*); | 77 | void argCopyAttPositional(char*); |
| 78 | -void argCopyAttPrefix(char *); | ||
| 79 | void argCopyAttPassword(char *); | 78 | void argCopyAttPassword(char *); |
| 80 | void argEndCopyAttachment(); | 79 | void argEndCopyAttachment(); |
libqpdf/qpdf/auto_job_init.hh
| @@ -30,82 +30,82 @@ this->ap.addBare("job-json-help", b(&ArgParser::argJobJsonHelp)); | @@ -30,82 +30,82 @@ this->ap.addBare("job-json-help", b(&ArgParser::argJobJsonHelp)); | ||
| 30 | this->ap.selectMainOptionTable(); | 30 | this->ap.selectMainOptionTable(); |
| 31 | this->ap.addPositional(p(&ArgParser::argPositional)); | 31 | this->ap.addPositional(p(&ArgParser::argPositional)); |
| 32 | this->ap.addBare("add-attachment", b(&ArgParser::argAddAttachment)); | 32 | this->ap.addBare("add-attachment", b(&ArgParser::argAddAttachment)); |
| 33 | -this->ap.addBare("allow-weak-crypto", [this](){jc.allowWeakCrypto();}); | ||
| 34 | -this->ap.addBare("check", [this](){jc.check();}); | ||
| 35 | -this->ap.addBare("check-linearization", [this](){jc.checkLinearization();}); | ||
| 36 | -this->ap.addBare("coalesce-contents", [this](){jc.coalesceContents();}); | 33 | +this->ap.addBare("allow-weak-crypto", [this](){c_main->allowWeakCrypto();}); |
| 34 | +this->ap.addBare("check", [this](){c_main->check();}); | ||
| 35 | +this->ap.addBare("check-linearization", [this](){c_main->checkLinearization();}); | ||
| 36 | +this->ap.addBare("coalesce-contents", [this](){c_main->coalesceContents();}); | ||
| 37 | this->ap.addBare("copy-attachments-from", b(&ArgParser::argCopyAttachmentsFrom)); | 37 | this->ap.addBare("copy-attachments-from", b(&ArgParser::argCopyAttachmentsFrom)); |
| 38 | -this->ap.addBare("decrypt", [this](){jc.decrypt();}); | ||
| 39 | -this->ap.addBare("deterministic-id", [this](){jc.deterministicId();}); | ||
| 40 | -this->ap.addBare("empty", [this](){jc.empty();}); | 38 | +this->ap.addBare("decrypt", [this](){c_main->decrypt();}); |
| 39 | +this->ap.addBare("deterministic-id", [this](){c_main->deterministicId();}); | ||
| 40 | +this->ap.addBare("empty", [this](){c_main->empty();}); | ||
| 41 | this->ap.addBare("encrypt", b(&ArgParser::argEncrypt)); | 41 | this->ap.addBare("encrypt", b(&ArgParser::argEncrypt)); |
| 42 | -this->ap.addBare("externalize-inline-images", [this](){jc.externalizeInlineImages();}); | ||
| 43 | -this->ap.addBare("filtered-stream-data", [this](){jc.filteredStreamData();}); | ||
| 44 | -this->ap.addBare("flatten-rotation", [this](){jc.flattenRotation();}); | ||
| 45 | -this->ap.addBare("generate-appearances", [this](){jc.generateAppearances();}); | ||
| 46 | -this->ap.addBare("ignore-xref-streams", [this](){jc.ignoreXrefStreams();}); | ||
| 47 | -this->ap.addBare("is-encrypted", [this](){jc.isEncrypted();}); | ||
| 48 | -this->ap.addBare("json", [this](){jc.json();}); | ||
| 49 | -this->ap.addBare("keep-inline-images", [this](){jc.keepInlineImages();}); | ||
| 50 | -this->ap.addBare("linearize", [this](){jc.linearize();}); | ||
| 51 | -this->ap.addBare("list-attachments", [this](){jc.listAttachments();}); | ||
| 52 | -this->ap.addBare("newline-before-endstream", [this](){jc.newlineBeforeEndstream();}); | ||
| 53 | -this->ap.addBare("no-original-object-ids", [this](){jc.noOriginalObjectIds();}); | ||
| 54 | -this->ap.addBare("no-warn", [this](){jc.noWarn();}); | ||
| 55 | -this->ap.addBare("optimize-images", [this](){jc.optimizeImages();}); | 42 | +this->ap.addBare("externalize-inline-images", [this](){c_main->externalizeInlineImages();}); |
| 43 | +this->ap.addBare("filtered-stream-data", [this](){c_main->filteredStreamData();}); | ||
| 44 | +this->ap.addBare("flatten-rotation", [this](){c_main->flattenRotation();}); | ||
| 45 | +this->ap.addBare("generate-appearances", [this](){c_main->generateAppearances();}); | ||
| 46 | +this->ap.addBare("ignore-xref-streams", [this](){c_main->ignoreXrefStreams();}); | ||
| 47 | +this->ap.addBare("is-encrypted", [this](){c_main->isEncrypted();}); | ||
| 48 | +this->ap.addBare("json", [this](){c_main->json();}); | ||
| 49 | +this->ap.addBare("keep-inline-images", [this](){c_main->keepInlineImages();}); | ||
| 50 | +this->ap.addBare("linearize", [this](){c_main->linearize();}); | ||
| 51 | +this->ap.addBare("list-attachments", [this](){c_main->listAttachments();}); | ||
| 52 | +this->ap.addBare("newline-before-endstream", [this](){c_main->newlineBeforeEndstream();}); | ||
| 53 | +this->ap.addBare("no-original-object-ids", [this](){c_main->noOriginalObjectIds();}); | ||
| 54 | +this->ap.addBare("no-warn", [this](){c_main->noWarn();}); | ||
| 55 | +this->ap.addBare("optimize-images", [this](){c_main->optimizeImages();}); | ||
| 56 | this->ap.addBare("overlay", b(&ArgParser::argOverlay)); | 56 | this->ap.addBare("overlay", b(&ArgParser::argOverlay)); |
| 57 | this->ap.addBare("pages", b(&ArgParser::argPages)); | 57 | this->ap.addBare("pages", b(&ArgParser::argPages)); |
| 58 | -this->ap.addBare("password-is-hex-key", [this](){jc.passwordIsHexKey();}); | ||
| 59 | -this->ap.addBare("preserve-unreferenced", [this](){jc.preserveUnreferenced();}); | ||
| 60 | -this->ap.addBare("preserve-unreferenced-resources", [this](){jc.preserveUnreferencedResources();}); | ||
| 61 | -this->ap.addBare("progress", [this](){jc.progress();}); | ||
| 62 | -this->ap.addBare("qdf", [this](){jc.qdf();}); | ||
| 63 | -this->ap.addBare("raw-stream-data", [this](){jc.rawStreamData();}); | ||
| 64 | -this->ap.addBare("recompress-flate", [this](){jc.recompressFlate();}); | ||
| 65 | -this->ap.addBare("remove-page-labels", [this](){jc.removePageLabels();}); | ||
| 66 | -this->ap.addBare("replace-input", [this](){jc.replaceInput();}); | ||
| 67 | -this->ap.addBare("requires-password", [this](){jc.requiresPassword();}); | ||
| 68 | -this->ap.addBare("show-encryption", [this](){jc.showEncryption();}); | ||
| 69 | -this->ap.addBare("show-encryption-key", [this](){jc.showEncryptionKey();}); | ||
| 70 | -this->ap.addBare("show-linearization", [this](){jc.showLinearization();}); | ||
| 71 | -this->ap.addBare("show-npages", [this](){jc.showNpages();}); | ||
| 72 | -this->ap.addBare("show-pages", [this](){jc.showPages();}); | ||
| 73 | -this->ap.addBare("show-xref", [this](){jc.showXref();}); | ||
| 74 | -this->ap.addBare("static-aes-iv", [this](){jc.staticAesIv();}); | ||
| 75 | -this->ap.addBare("static-id", [this](){jc.staticId();}); | ||
| 76 | -this->ap.addBare("suppress-password-recovery", [this](){jc.suppressPasswordRecovery();}); | ||
| 77 | -this->ap.addBare("suppress-recovery", [this](){jc.suppressRecovery();}); | 58 | +this->ap.addBare("password-is-hex-key", [this](){c_main->passwordIsHexKey();}); |
| 59 | +this->ap.addBare("preserve-unreferenced", [this](){c_main->preserveUnreferenced();}); | ||
| 60 | +this->ap.addBare("preserve-unreferenced-resources", [this](){c_main->preserveUnreferencedResources();}); | ||
| 61 | +this->ap.addBare("progress", [this](){c_main->progress();}); | ||
| 62 | +this->ap.addBare("qdf", [this](){c_main->qdf();}); | ||
| 63 | +this->ap.addBare("raw-stream-data", [this](){c_main->rawStreamData();}); | ||
| 64 | +this->ap.addBare("recompress-flate", [this](){c_main->recompressFlate();}); | ||
| 65 | +this->ap.addBare("remove-page-labels", [this](){c_main->removePageLabels();}); | ||
| 66 | +this->ap.addBare("replace-input", [this](){c_main->replaceInput();}); | ||
| 67 | +this->ap.addBare("requires-password", [this](){c_main->requiresPassword();}); | ||
| 68 | +this->ap.addBare("show-encryption", [this](){c_main->showEncryption();}); | ||
| 69 | +this->ap.addBare("show-encryption-key", [this](){c_main->showEncryptionKey();}); | ||
| 70 | +this->ap.addBare("show-linearization", [this](){c_main->showLinearization();}); | ||
| 71 | +this->ap.addBare("show-npages", [this](){c_main->showNpages();}); | ||
| 72 | +this->ap.addBare("show-pages", [this](){c_main->showPages();}); | ||
| 73 | +this->ap.addBare("show-xref", [this](){c_main->showXref();}); | ||
| 74 | +this->ap.addBare("static-aes-iv", [this](){c_main->staticAesIv();}); | ||
| 75 | +this->ap.addBare("static-id", [this](){c_main->staticId();}); | ||
| 76 | +this->ap.addBare("suppress-password-recovery", [this](){c_main->suppressPasswordRecovery();}); | ||
| 77 | +this->ap.addBare("suppress-recovery", [this](){c_main->suppressRecovery();}); | ||
| 78 | this->ap.addBare("underlay", b(&ArgParser::argUnderlay)); | 78 | this->ap.addBare("underlay", b(&ArgParser::argUnderlay)); |
| 79 | -this->ap.addBare("verbose", [this](){jc.verbose();}); | ||
| 80 | -this->ap.addBare("warning-exit-0", [this](){jc.warningExit0();}); | ||
| 81 | -this->ap.addBare("with-images", [this](){jc.withImages();}); | ||
| 82 | -this->ap.addOptionalParameter("collate", [this](char *x){jc.collate(x);}); | ||
| 83 | -this->ap.addOptionalParameter("split-pages", [this](char *x){jc.splitPages(x);}); | ||
| 84 | -this->ap.addRequiredParameter("compression-level", [this](char *x){jc.compressionLevel(x);}, "level"); | ||
| 85 | -this->ap.addRequiredParameter("copy-encryption", [this](char *x){jc.copyEncryption(x);}, "file"); | ||
| 86 | -this->ap.addRequiredParameter("encryption-file-password", [this](char *x){jc.encryptionFilePassword(x);}, "password"); | ||
| 87 | -this->ap.addRequiredParameter("force-version", [this](char *x){jc.forceVersion(x);}, "version"); | ||
| 88 | -this->ap.addRequiredParameter("ii-min-bytes", [this](char *x){jc.iiMinBytes(x);}, "minimum"); | 79 | +this->ap.addBare("verbose", [this](){c_main->verbose();}); |
| 80 | +this->ap.addBare("warning-exit-0", [this](){c_main->warningExit0();}); | ||
| 81 | +this->ap.addBare("with-images", [this](){c_main->withImages();}); | ||
| 82 | +this->ap.addOptionalParameter("collate", [this](char *x){c_main->collate(x);}); | ||
| 83 | +this->ap.addOptionalParameter("split-pages", [this](char *x){c_main->splitPages(x);}); | ||
| 84 | +this->ap.addRequiredParameter("compression-level", [this](char *x){c_main->compressionLevel(x);}, "level"); | ||
| 85 | +this->ap.addRequiredParameter("copy-encryption", [this](char *x){c_main->copyEncryption(x);}, "file"); | ||
| 86 | +this->ap.addRequiredParameter("encryption-file-password", [this](char *x){c_main->encryptionFilePassword(x);}, "password"); | ||
| 87 | +this->ap.addRequiredParameter("force-version", [this](char *x){c_main->forceVersion(x);}, "version"); | ||
| 88 | +this->ap.addRequiredParameter("ii-min-bytes", [this](char *x){c_main->iiMinBytes(x);}, "minimum"); | ||
| 89 | this->ap.addRequiredParameter("job-json-file", p(&ArgParser::argJobJsonFile), "file"); | 89 | this->ap.addRequiredParameter("job-json-file", p(&ArgParser::argJobJsonFile), "file"); |
| 90 | -this->ap.addRequiredParameter("json-object", [this](char *x){jc.jsonObject(x);}, "trailer"); | ||
| 91 | -this->ap.addRequiredParameter("keep-files-open-threshold", [this](char *x){jc.keepFilesOpenThreshold(x);}, "count"); | ||
| 92 | -this->ap.addRequiredParameter("linearize-pass1", [this](char *x){jc.linearizePass1(x);}, "filename"); | ||
| 93 | -this->ap.addRequiredParameter("min-version", [this](char *x){jc.minVersion(x);}, "version"); | ||
| 94 | -this->ap.addRequiredParameter("oi-min-area", [this](char *x){jc.oiMinArea(x);}, "minimum"); | ||
| 95 | -this->ap.addRequiredParameter("oi-min-height", [this](char *x){jc.oiMinHeight(x);}, "minimum"); | ||
| 96 | -this->ap.addRequiredParameter("oi-min-width", [this](char *x){jc.oiMinWidth(x);}, "minimum"); | 90 | +this->ap.addRequiredParameter("json-object", [this](char *x){c_main->jsonObject(x);}, "trailer"); |
| 91 | +this->ap.addRequiredParameter("keep-files-open-threshold", [this](char *x){c_main->keepFilesOpenThreshold(x);}, "count"); | ||
| 92 | +this->ap.addRequiredParameter("linearize-pass1", [this](char *x){c_main->linearizePass1(x);}, "filename"); | ||
| 93 | +this->ap.addRequiredParameter("min-version", [this](char *x){c_main->minVersion(x);}, "version"); | ||
| 94 | +this->ap.addRequiredParameter("oi-min-area", [this](char *x){c_main->oiMinArea(x);}, "minimum"); | ||
| 95 | +this->ap.addRequiredParameter("oi-min-height", [this](char *x){c_main->oiMinHeight(x);}, "minimum"); | ||
| 96 | +this->ap.addRequiredParameter("oi-min-width", [this](char *x){c_main->oiMinWidth(x);}, "minimum"); | ||
| 97 | this->ap.addRequiredParameter("password", p(&ArgParser::argPassword), "password"); | 97 | this->ap.addRequiredParameter("password", p(&ArgParser::argPassword), "password"); |
| 98 | this->ap.addRequiredParameter("password-file", p(&ArgParser::argPasswordFile), "password"); | 98 | this->ap.addRequiredParameter("password-file", p(&ArgParser::argPasswordFile), "password"); |
| 99 | -this->ap.addRequiredParameter("remove-attachment", [this](char *x){jc.removeAttachment(x);}, "attachment"); | 99 | +this->ap.addRequiredParameter("remove-attachment", [this](char *x){c_main->removeAttachment(x);}, "attachment"); |
| 100 | this->ap.addRequiredParameter("rotate", p(&ArgParser::argRotate), "[+|-]angle"); | 100 | this->ap.addRequiredParameter("rotate", p(&ArgParser::argRotate), "[+|-]angle"); |
| 101 | -this->ap.addRequiredParameter("show-attachment", [this](char *x){jc.showAttachment(x);}, "attachment"); | 101 | +this->ap.addRequiredParameter("show-attachment", [this](char *x){c_main->showAttachment(x);}, "attachment"); |
| 102 | this->ap.addRequiredParameter("show-object", p(&ArgParser::argShowObject), "trailer"); | 102 | this->ap.addRequiredParameter("show-object", p(&ArgParser::argShowObject), "trailer"); |
| 103 | -this->ap.addChoices("compress-streams", [this](char *x){jc.compressStreams(x);}, true, yn_choices); | 103 | +this->ap.addChoices("compress-streams", [this](char *x){c_main->compressStreams(x);}, true, yn_choices); |
| 104 | this->ap.addChoices("decode-level", p(&ArgParser::argDecodeLevel), true, decode_level_choices); | 104 | this->ap.addChoices("decode-level", p(&ArgParser::argDecodeLevel), true, decode_level_choices); |
| 105 | -this->ap.addChoices("flatten-annotations", [this](char *x){jc.flattenAnnotations(x);}, true, flatten_choices); | ||
| 106 | -this->ap.addChoices("json-key", [this](char *x){jc.jsonKey(x);}, true, json_key_choices); | ||
| 107 | -this->ap.addChoices("keep-files-open", [this](char *x){jc.keepFilesOpen(x);}, true, yn_choices); | ||
| 108 | -this->ap.addChoices("normalize-content", [this](char *x){jc.normalizeContent(x);}, true, yn_choices); | 105 | +this->ap.addChoices("flatten-annotations", [this](char *x){c_main->flattenAnnotations(x);}, true, flatten_choices); |
| 106 | +this->ap.addChoices("json-key", [this](char *x){c_main->jsonKey(x);}, true, json_key_choices); | ||
| 107 | +this->ap.addChoices("keep-files-open", [this](char *x){c_main->keepFilesOpen(x);}, true, yn_choices); | ||
| 108 | +this->ap.addChoices("normalize-content", [this](char *x){c_main->normalizeContent(x);}, true, yn_choices); | ||
| 109 | this->ap.addChoices("object-streams", p(&ArgParser::argObjectStreams), true, object_streams_choices); | 109 | this->ap.addChoices("object-streams", p(&ArgParser::argObjectStreams), true, object_streams_choices); |
| 110 | this->ap.addChoices("password-mode", p(&ArgParser::argPasswordMode), true, password_mode_choices); | 110 | this->ap.addChoices("password-mode", p(&ArgParser::argPasswordMode), true, password_mode_choices); |
| 111 | this->ap.addChoices("remove-unreferenced-resources", p(&ArgParser::argRemoveUnreferencedResources), true, remove_unref_choices); | 111 | this->ap.addChoices("remove-unreferenced-resources", p(&ArgParser::argRemoveUnreferencedResources), true, remove_unref_choices); |
| @@ -152,7 +152,7 @@ this->ap.addRequiredParameter("mimetype", p(&ArgParser::argAttMimetype), "mime/t | @@ -152,7 +152,7 @@ this->ap.addRequiredParameter("mimetype", p(&ArgParser::argAttMimetype), "mime/t | ||
| 152 | this->ap.addRequiredParameter("description", p(&ArgParser::argAttDescription), "description"); | 152 | this->ap.addRequiredParameter("description", p(&ArgParser::argAttDescription), "description"); |
| 153 | this->ap.registerOptionTable("copy attachment", b(&ArgParser::argEndCopyAttachment)); | 153 | this->ap.registerOptionTable("copy attachment", b(&ArgParser::argEndCopyAttachment)); |
| 154 | this->ap.addPositional(p(&ArgParser::argCopyAttPositional)); | 154 | this->ap.addPositional(p(&ArgParser::argCopyAttPositional)); |
| 155 | -this->ap.addRequiredParameter("prefix", p(&ArgParser::argCopyAttPrefix), "prefix"); | 155 | +this->ap.addRequiredParameter("prefix", [this](char *x){c_copy_att->prefix(x);}, "prefix"); |
| 156 | this->ap.addRequiredParameter("password", p(&ArgParser::argCopyAttPassword), "password"); | 156 | this->ap.addRequiredParameter("password", p(&ArgParser::argCopyAttPassword), "password"); |
| 157 | this->ap.selectOptionTable("256-bit encryption"); | 157 | this->ap.selectOptionTable("256-bit encryption"); |
| 158 | this->ap.copyFromOtherTable("cleartext-metadata", "128-bit encryption"); | 158 | this->ap.copyFromOtherTable("cleartext-metadata", "128-bit encryption"); |