From 4577df4b5ddf363f5f877fe3b4b4c9ae710c9d55 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Thu, 6 Jan 2022 14:26:41 -0500 Subject: [PATCH] QPDFJob increment: generate option table initialization --- generate_auto_job | 55 ++++++++ job.sums | 6 +- job.yml | 4 +- libqpdf/QPDFJob_argv.cc | 233 ++++------------------------------ libqpdf/qpdf/auto_job_init.hh | 150 ++++++++++++++++++++++ 5 files changed, 233 insertions(+), 215 deletions(-) diff --git a/generate_auto_job b/generate_auto_job index 1be26453..7e70d29c 100755 --- a/generate_auto_job +++ b/generate_auto_job @@ -162,11 +162,66 @@ class Main: print(f'void {identifier}();', file=f) def generate_init(self, data, f): + print('auto b = [this](void (ArgParser::*f)()) {', file=f) + print(' return QPDFArgParser::bindBare(f, this);', file=f) + print('};', file=f) + print('auto p = [this](void (ArgParser::*f)(char *)) {', file=f) + print(' return QPDFArgParser::bindParam(f, this);', file=f) + print('};', file=f) + print('', file=f) for k, v in data['choices'].items(): print(f'char const* {k}_choices[] = {{', file=f, end='') for i in v: print(f'"{i}", ', file=f, end='') print('0};', file=f) + print('', file=f) + for o in data['options']: + table = o['table'] + if table == 'main': + print('this->ap.selectMainOptionTable();', file=f) + elif table == 'help': + print('this->ap.selectHelpOptionTable();', file=f) + else: + identifier = self.to_identifier(table, 'argEnd', False) + print(f'this->ap.registerOptionTable("{table}",' + f' b(&ArgParser::{identifier}));', file=f) + prefix = 'arg' + o.get('prefix', '') + if o.get('positional', False): + print('this->ap.addPositional(' + f'p(&ArgParser::{prefix}Positional));', file=f) + for i in o.get('bare', []): + identifier = self.to_identifier(i, prefix, False) + print(f'this->ap.addBare("{i}", ' + f'b(&ArgParser::{identifier}));', file=f) + for i in o.get('optional_parameter', []): + identifier = self.to_identifier(i, prefix, False) + print(f'this->ap.addOptionalParameter("{i}", ' + f'p(&ArgParser::{identifier}));', file=f) + for k, v in o.get('required_parameter', {}).items(): + identifier = self.to_identifier(k, prefix, False) + print(f'this->ap.addRequiredParameter("{k}", ' + f'p(&ArgParser::{identifier})' + f', "{v}");', file=f) + for k, v in o.get('required_choices', {}).items(): + identifier = self.to_identifier(k, prefix, False) + print(f'this->ap.addRequiredChoices("{k}", ' + f'p(&ArgParser::{identifier})' + f', {v}_choices);', file=f) + for o in data['options']: + table = o['table'] + if 'from_table' not in o: + continue + if table == 'main': + print('this->ap.selectMainOptionTable();', file=f) + elif table == 'help': + print('this->ap.selectHelpOptionTable();', file=f) + else: + print(f'this->ap.selectOptionTable("{table}");', file=f) + ft = o['from_table'] + other_table = ft['table'] + for j in ft['options']: + print('this->ap.copyFromOtherTable' + f'("{j}", "{other_table}");', file=f) if __name__ == '__main__': diff --git a/job.sums b/job.sums index bbaa1d25..4429c717 100644 --- a/job.sums +++ b/job.sums @@ -1,5 +1,5 @@ # Generated by generate_auto_job -generate_auto_job 52a5e6bc70375e1183fedd5865ae4eae2a10be8d80edede1c48f9946be5d2538 -job.yml b4d230c46ca2b2e75b3b974e2d9ad21fb007eb5007d05cf249ae1e2cde81040c +generate_auto_job 575569edf2ab0036ed7f810bf506968c73c9209a64ec0ae2ed959f0426291447 +job.yml 5de5f1cd3f998274ed4aafa234e61b726a8f96157148ad463970439a96e897bd libqpdf/qpdf/auto_job_decl.hh fca37543c1a2b7f675374e23b1ab34b30a7f5f2d843c53d4bc7e9a12bf4c3615 -libqpdf/qpdf/auto_job_init.hh 0640167b8d550030c086851408b842e2a93c86577253d78f1b7d41d4ca695bd9 +libqpdf/qpdf/auto_job_init.hh 7d7dfe96d4da765b8defb646058027584ea8924c604c558402aa7f2d2e61a005 diff --git a/job.yml b/job.yml index 95707b90..f432bc3d 100644 --- a/job.yml +++ b/job.yml @@ -165,12 +165,12 @@ options: required_choices: accessibility: yn extract: yn - print: print128_choices + print: print128 assemble: yn annotate: yn form: yn modify-other: yn - modify: modify128_choices + modify: modify128 use-aes: yn - table: 256-bit encryption prefix: Enc256 diff --git a/libqpdf/QPDFJob_argv.cc b/libqpdf/QPDFJob_argv.cc index f1bc8b24..0cf12cd4 100644 --- a/libqpdf/QPDFJob_argv.cc +++ b/libqpdf/QPDFJob_argv.cc @@ -26,7 +26,7 @@ namespace # include void usage(std::string const& message); - void initOptionTable(); + void initOptionTables(); void doFinalChecks(); void parseUnderOverlayOptions(QPDFJob::UnderOverlay*); void parseRotationParameter(std::string const&); @@ -45,221 +45,16 @@ ArgParser::ArgParser(QPDFArgParser& ap, QPDFJob& o) : o(o), pages_password(nullptr) { - initOptionTable(); + initOptionTables(); } void -ArgParser::initOptionTable() +ArgParser::initOptionTables() { - auto b = [this](void (ArgParser::*f)()) { - return QPDFArgParser::bindBare(f, this); - }; - auto p = [this](void (ArgParser::*f)(char *)) { - return QPDFArgParser::bindParam(f, this); - }; - - this->ap.addFinalCheck(b(&ArgParser::doFinalChecks)); # include - - this->ap.selectHelpOptionTable(); - this->ap.addBare("help", b(&ArgParser::argHelp)); - this->ap.addBare("version", b(&ArgParser::argVersion)); - this->ap.addBare("copyright", b(&ArgParser::argCopyright)); - this->ap.addBare("json-help", b(&ArgParser::argJsonHelp)); - this->ap.addBare("show-crypto", b(&ArgParser::argShowCrypto)); - - this->ap.selectMainOptionTable(); - this->ap.addPositional(p(&ArgParser::argPositional)); - this->ap.addRequiredParameter("password", - p(&ArgParser::argPassword), "password"); - this->ap.addRequiredParameter("password-file", - p(&ArgParser::argPasswordFile), "password-file"); - this->ap.addBare("empty", b(&ArgParser::argEmpty)); - this->ap.addBare("linearize", b(&ArgParser::argLinearize)); - this->ap.addBare("decrypt", b(&ArgParser::argDecrypt)); - this->ap.addBare("password-is-hex-key", b(&ArgParser::argPasswordIsHexKey)); - this->ap.addBare("suppress-password-recovery", - b(&ArgParser::argSuppressPasswordRecovery)); - this->ap.addRequiredChoices("password-mode", - p(&ArgParser::argPasswordMode), password_mode_choices); - this->ap.addRequiredParameter("copy-encryption", - p(&ArgParser::argCopyEncryption), "file"); - this->ap.addRequiredParameter("encryption-file-password", - p(&ArgParser::argEncryptionFilePassword), "password"); - this->ap.addRequiredParameter("rotate", - p(&ArgParser::argRotate), "[+|-]angle:page-range"); - this->ap.addOptionalParameter("collate",p(&ArgParser::argCollate)); - this->ap.addBare("flatten-rotation", b(&ArgParser::argFlattenRotation)); - this->ap.addBare("list-attachments", b(&ArgParser::argListAttachments)); - this->ap.addRequiredParameter("show-attachment", - p(&ArgParser::argShowAttachment), "attachment-key"); - this->ap.addRequiredParameter("remove-attachment", - p(&ArgParser::argRemoveAttachment), "attachment-key"); - this->ap.addBare("add-attachment", b(&ArgParser::argAddAttachment)); - this->ap.addBare( - "copy-attachments-from", b(&ArgParser::argCopyAttachmentsFrom)); - this->ap.addRequiredChoices("stream-data", - p(&ArgParser::argStreamData), stream_data_choices); - this->ap.addRequiredChoices("compress-streams", - p(&ArgParser::argCompressStreams), yn_choices); - this->ap.addBare("recompress-flate", b(&ArgParser::argRecompressFlate)); - this->ap.addRequiredParameter("compression-level", - p(&ArgParser::argCompressionLevel), "level"); - this->ap.addRequiredChoices("decode-level", - p(&ArgParser::argDecodeLevel), decode_level_choices); - this->ap.addRequiredChoices("normalize-content", - p(&ArgParser::argNormalizeContent), yn_choices); - this->ap.addBare("suppress-recovery", b(&ArgParser::argSuppressRecovery)); - this->ap.addRequiredChoices("object-streams", - p(&ArgParser::argObjectStreams), object_streams_choices); - this->ap.addBare( - "ignore-xref-streams", b(&ArgParser::argIgnoreXrefStreams)); - this->ap.addBare("qdf", b(&ArgParser::argQdf)); - this->ap.addBare( - "preserve-unreferenced", b(&ArgParser::argPreserveUnreferenced)); - this->ap.addBare( - "preserve-unreferenced-resources", - b(&ArgParser::argPreserveUnreferencedResources)); - this->ap.addRequiredChoices("remove-unreferenced-resources", - p(&ArgParser::argRemoveUnreferencedResources), remove_unref_choices); - this->ap.addRequiredChoices("keep-files-open", - p(&ArgParser::argKeepFilesOpen), yn_choices); - this->ap.addRequiredParameter("keep-files-open-threshold", - p(&ArgParser::argKeepFilesOpenThreshold), "count"); - this->ap.addBare("newline-before-endstream", b(&ArgParser::argNewlineBeforeEndstream)); - this->ap.addRequiredParameter("linearize-pass1", - p(&ArgParser::argLinearizePass1), "filename"); - this->ap.addBare("coalesce-contents", b(&ArgParser::argCoalesceContents)); - this->ap.addRequiredChoices("flatten-annotations", - p(&ArgParser::argFlattenAnnotations), flatten_choices); - this->ap.addBare("generate-appearances", b(&ArgParser::argGenerateAppearances)); - this->ap.addRequiredParameter("min-version", - p(&ArgParser::argMinVersion), "version"); - this->ap.addRequiredParameter("force-version", - p(&ArgParser::argForceVersion), "version"); - this->ap.addOptionalParameter("split-pages",p(&ArgParser::argSplitPages)); - this->ap.addBare("verbose", b(&ArgParser::argVerbose)); - this->ap.addBare("progress", b(&ArgParser::argProgress)); - this->ap.addBare("no-warn", b(&ArgParser::argNoWarn)); - this->ap.addBare("warning-exit-0", b(&ArgParser::argWarningExit0)); - this->ap.addBare("deterministic-id", b(&ArgParser::argDeterministicId)); - this->ap.addBare("static-id", b(&ArgParser::argStaticId)); - this->ap.addBare("static-aes-iv", b(&ArgParser::argStaticAesIv)); - this->ap.addBare("no-original-object-ids", b(&ArgParser::argNoOriginalObjectIds)); - this->ap.addBare("show-encryption", b(&ArgParser::argShowEncryption)); - this->ap.addBare("show-encryption-key", b(&ArgParser::argShowEncryptionKey)); - this->ap.addBare("check-linearization", b(&ArgParser::argCheckLinearization)); - this->ap.addBare("show-linearization", b(&ArgParser::argShowLinearization)); - this->ap.addBare("show-xref", b(&ArgParser::argShowXref)); - this->ap.addRequiredParameter("show-object", - p(&ArgParser::argShowObject), "trailer|obj[,gen]"); - this->ap.addBare("raw-stream-data", b(&ArgParser::argRawStreamData)); - this->ap.addBare("filtered-stream-data", b(&ArgParser::argFilteredStreamData)); - this->ap.addBare("show-npages", b(&ArgParser::argShowNpages)); - this->ap.addBare("show-pages", b(&ArgParser::argShowPages)); - this->ap.addBare("with-images", b(&ArgParser::argWithImages)); - this->ap.addBare("json", b(&ArgParser::argJson)); - this->ap.addRequiredChoices("json-key", - p(&ArgParser::argJsonKey), json_key_choices); - this->ap.addRequiredParameter("json-object", - p(&ArgParser::argJsonObject), "trailer|obj[,gen]"); - this->ap.addBare("check", b(&ArgParser::argCheck)); - this->ap.addBare("optimize-images", b(&ArgParser::argOptimizeImages)); - this->ap.addBare("externalize-inline-images", b(&ArgParser::argExternalizeInlineImages)); - this->ap.addBare("keep-inline-images", b(&ArgParser::argKeepInlineImages)); - this->ap.addBare("remove-page-labels", b(&ArgParser::argRemovePageLabels)); - this->ap.addRequiredParameter("oi-min-width", - p(&ArgParser::argOiMinWidth), "minimum-width"); - this->ap.addRequiredParameter("oi-min-height", - p(&ArgParser::argOiMinHeight), "minimum-height"); - this->ap.addRequiredParameter("oi-min-area", - p(&ArgParser::argOiMinArea), "minimum-area"); - this->ap.addRequiredParameter("ii-min-bytes", - p(&ArgParser::argIiMinBytes), "minimum-bytes"); - this->ap.addBare("overlay", b(&ArgParser::argOverlay)); - this->ap.addBare("underlay", b(&ArgParser::argUnderlay)); - this->ap.addBare("replace-input", b(&ArgParser::argReplaceInput)); - this->ap.addBare("is-encrypted", b(&ArgParser::argIsEncrypted)); - this->ap.addBare("requires-password", b(&ArgParser::argRequiresPassword)); - this->ap.addBare("allow-weak-crypto", b(&ArgParser::argAllowWeakCrypto)); - - this->ap.selectMainOptionTable(); - this->ap.addBare("pages", b(&ArgParser::argPages)); - this->ap.registerOptionTable(O_PAGES, b(&ArgParser::argEndPages)); - this->ap.addRequiredParameter( - "password", p(&ArgParser::argPagesPassword), "password"); - this->ap.addPositional(p(&ArgParser::argPagesPositional)); - - this->ap.selectMainOptionTable(); - this->ap.addBare("encrypt", b(&ArgParser::argEncrypt)); - this->ap.registerOptionTable(O_ENCRYPTION, b(&ArgParser::argEndEncryption)); - this->ap.addPositional(p(&ArgParser::argEncPositional)); - this->ap.registerOptionTable(O_40_BIT_ENCRYPTION, b(&ArgParser::argEndEncryption)); - this->ap.addRequiredChoices("extract",p(&ArgParser::argEnc40Extract), yn_choices); - this->ap.addRequiredChoices("annotate",p(&ArgParser::argEnc40Annotate), yn_choices); - this->ap.addRequiredChoices("print",p(&ArgParser::argEnc40Print), yn_choices); - this->ap.addRequiredChoices("modify",p(&ArgParser::argEnc40Modify), yn_choices); - this->ap.registerOptionTable(O_128_BIT_ENCRYPTION, b(&ArgParser::argEndEncryption)); - this->ap.registerOptionTable(O_256_BIT_ENCRYPTION, b(&ArgParser::argEndEncryption)); - for (char const* k: {O_128_BIT_ENCRYPTION, O_256_BIT_ENCRYPTION}) - { - this->ap.selectOptionTable(k); - this->ap.addRequiredChoices("accessibility", - p(&ArgParser::argEnc128Accessibility), yn_choices); - this->ap.addRequiredChoices("extract", p(&ArgParser::argEnc128Extract), yn_choices); - this->ap.addRequiredChoices("print", - p(&ArgParser::argEnc128Print), print128_choices); - this->ap.addRequiredChoices("assemble",p(&ArgParser::argEnc128Assemble), yn_choices); - this->ap.addRequiredChoices("annotate",p(&ArgParser::argEnc128Annotate), yn_choices); - this->ap.addRequiredChoices("form",p(&ArgParser::argEnc128Form), yn_choices); - this->ap.addRequiredChoices("modify-other",p(&ArgParser::argEnc128ModifyOther), yn_choices); - this->ap.addRequiredChoices("modify", - p(&ArgParser::argEnc128Modify), modify128_choices); - this->ap.addBare("cleartext-metadata", b(&ArgParser::argEnc128CleartextMetadata)); - } - - this->ap.selectOptionTable(O_128_BIT_ENCRYPTION); - this->ap.addRequiredChoices("use-aes",p(&ArgParser::argEnc128UseAes), yn_choices); - this->ap.addBare("force-V4", b(&ArgParser::argEnc128ForceV4)); - - this->ap.selectOptionTable(O_256_BIT_ENCRYPTION); - this->ap.addBare("force-R5", b(&ArgParser::argEnc256ForceR5)); - this->ap.addBare("allow-insecure", b(&ArgParser::argEnc256AllowInsecure)); - - this->ap.registerOptionTable(O_UNDERLAY_OVERLAY, b(&ArgParser::argEndUnderlayOverlay)); - this->ap.addPositional(p(&ArgParser::argUOPositional)); - this->ap.addRequiredParameter("to", - p(&ArgParser::argUOTo), "page-range"); - this->ap.addRequiredParameter("from", - p(&ArgParser::argUOFrom), "page-range"); - this->ap.addRequiredParameter("repeat", - p(&ArgParser::argUORepeat), "page-range"); - this->ap.addRequiredParameter("password", - p(&ArgParser::argUOPassword), "password"); - - this->ap.registerOptionTable(O_ATTACHMENT, b(&ArgParser::argEndAttachment)); - this->ap.addPositional(p(&ArgParser::argAttPositional)); - this->ap.addRequiredParameter("key", - p(&ArgParser::argAttKey), "attachment-key"); - this->ap.addRequiredParameter("filename", - p(&ArgParser::argAttFilename), "filename"); - this->ap.addRequiredParameter("creationdate", - p(&ArgParser::argAttCreationdate), "creation-date"); - this->ap.addRequiredParameter("moddate", - p(&ArgParser::argAttModdate), "modification-date"); - this->ap.addRequiredParameter("mimetype", - p(&ArgParser::argAttMimetype), "mime/type"); - this->ap.addRequiredParameter("description", - p(&ArgParser::argAttDescription), "description"); - this->ap.addBare("replace", b(&ArgParser::argAttReplace)); - - this->ap.registerOptionTable(O_COPY_ATTACHMENT, b(&ArgParser::argEndCopyAttachment)); - this->ap.addPositional(p(&ArgParser::argCopyAttPositional)); - this->ap.addRequiredParameter("prefix", - p(&ArgParser::argCopyAttPrefix), "prefix"); - this->ap.addRequiredParameter("password", - p(&ArgParser::argCopyAttPassword), "password"); + this->ap.addFinalCheck( + QPDFArgParser::bindBare(&ArgParser::doFinalChecks, this)); } void @@ -1821,6 +1616,24 @@ ArgParser::argEndEncryption() o.copy_encryption = false; } +void +ArgParser::argEnd40BitEncryption() +{ + argEndEncryption(); +} + +void +ArgParser::argEnd128BitEncryption() +{ + argEndEncryption(); +} + +void +ArgParser::argEnd256BitEncryption() +{ + argEndEncryption(); +} + void ArgParser::argUOPositional(char* arg) { diff --git a/libqpdf/qpdf/auto_job_init.hh b/libqpdf/qpdf/auto_job_init.hh index b398fabf..8566312f 100644 --- a/libqpdf/qpdf/auto_job_init.hh +++ b/libqpdf/qpdf/auto_job_init.hh @@ -3,6 +3,13 @@ // Edits will be automatically overwritten if the build is // run in maintainer mode. // +auto b = [this](void (ArgParser::*f)()) { + return QPDFArgParser::bindBare(f, this); +}; +auto p = [this](void (ArgParser::*f)(char *)) { + return QPDFArgParser::bindParam(f, this); +}; + char const* yn_choices[] = {"y", "n", 0}; char const* password_mode_choices[] = {"bytes", "hex-bytes", "unicode", "auto", 0}; char const* stream_data_choices[] = {"compress", "preserve", "uncompress", 0}; @@ -13,3 +20,146 @@ char const* flatten_choices[] = {"all", "print", "screen", 0}; char const* json_key_choices[] = {"acroform", "attachments", "encrypt", "objectinfo", "objects", "outlines", "pagelabels", "pages", 0}; char const* print128_choices[] = {"full", "low", "none", 0}; char const* modify128_choices[] = {"all", "annotate", "form", "assembly", "none", 0}; + +this->ap.selectHelpOptionTable(); +this->ap.addBare("help", b(&ArgParser::argHelp)); +this->ap.addBare("version", b(&ArgParser::argVersion)); +this->ap.addBare("copyright", b(&ArgParser::argCopyright)); +this->ap.addBare("json-help", b(&ArgParser::argJsonHelp)); +this->ap.addBare("show-crypto", b(&ArgParser::argShowCrypto)); +this->ap.selectMainOptionTable(); +this->ap.addPositional(p(&ArgParser::argPositional)); +this->ap.addBare("add-attachment", b(&ArgParser::argAddAttachment)); +this->ap.addBare("allow-weak-crypto", b(&ArgParser::argAllowWeakCrypto)); +this->ap.addBare("check", b(&ArgParser::argCheck)); +this->ap.addBare("check-linearization", b(&ArgParser::argCheckLinearization)); +this->ap.addBare("coalesce-contents", b(&ArgParser::argCoalesceContents)); +this->ap.addBare("copy-attachments-from", b(&ArgParser::argCopyAttachmentsFrom)); +this->ap.addBare("decrypt", b(&ArgParser::argDecrypt)); +this->ap.addBare("deterministic-id", b(&ArgParser::argDeterministicId)); +this->ap.addBare("empty", b(&ArgParser::argEmpty)); +this->ap.addBare("encrypt", b(&ArgParser::argEncrypt)); +this->ap.addBare("externalize-inline-images", b(&ArgParser::argExternalizeInlineImages)); +this->ap.addBare("filtered-stream-data", b(&ArgParser::argFilteredStreamData)); +this->ap.addBare("flatten-rotation", b(&ArgParser::argFlattenRotation)); +this->ap.addBare("generate-appearances", b(&ArgParser::argGenerateAppearances)); +this->ap.addBare("ignore-xref-streams", b(&ArgParser::argIgnoreXrefStreams)); +this->ap.addBare("is-encrypted", b(&ArgParser::argIsEncrypted)); +this->ap.addBare("json", b(&ArgParser::argJson)); +this->ap.addBare("keep-inline-images", b(&ArgParser::argKeepInlineImages)); +this->ap.addBare("linearize", b(&ArgParser::argLinearize)); +this->ap.addBare("list-attachments", b(&ArgParser::argListAttachments)); +this->ap.addBare("newline-before-endstream", b(&ArgParser::argNewlineBeforeEndstream)); +this->ap.addBare("no-original-object-ids", b(&ArgParser::argNoOriginalObjectIds)); +this->ap.addBare("no-warn", b(&ArgParser::argNoWarn)); +this->ap.addBare("optimize-images", b(&ArgParser::argOptimizeImages)); +this->ap.addBare("overlay", b(&ArgParser::argOverlay)); +this->ap.addBare("pages", b(&ArgParser::argPages)); +this->ap.addBare("password-is-hex-key", b(&ArgParser::argPasswordIsHexKey)); +this->ap.addBare("preserve-unreferenced", b(&ArgParser::argPreserveUnreferenced)); +this->ap.addBare("preserve-unreferenced-resources", b(&ArgParser::argPreserveUnreferencedResources)); +this->ap.addBare("progress", b(&ArgParser::argProgress)); +this->ap.addBare("qdf", b(&ArgParser::argQdf)); +this->ap.addBare("raw-stream-data", b(&ArgParser::argRawStreamData)); +this->ap.addBare("recompress-flate", b(&ArgParser::argRecompressFlate)); +this->ap.addBare("remove-page-labels", b(&ArgParser::argRemovePageLabels)); +this->ap.addBare("replace-input", b(&ArgParser::argReplaceInput)); +this->ap.addBare("requires-password", b(&ArgParser::argRequiresPassword)); +this->ap.addBare("show-encryption", b(&ArgParser::argShowEncryption)); +this->ap.addBare("show-encryption-key", b(&ArgParser::argShowEncryptionKey)); +this->ap.addBare("show-linearization", b(&ArgParser::argShowLinearization)); +this->ap.addBare("show-npages", b(&ArgParser::argShowNpages)); +this->ap.addBare("show-pages", b(&ArgParser::argShowPages)); +this->ap.addBare("show-xref", b(&ArgParser::argShowXref)); +this->ap.addBare("static-aes-iv", b(&ArgParser::argStaticAesIv)); +this->ap.addBare("static-id", b(&ArgParser::argStaticId)); +this->ap.addBare("suppress-password-recovery", b(&ArgParser::argSuppressPasswordRecovery)); +this->ap.addBare("suppress-recovery", b(&ArgParser::argSuppressRecovery)); +this->ap.addBare("underlay", b(&ArgParser::argUnderlay)); +this->ap.addBare("verbose", b(&ArgParser::argVerbose)); +this->ap.addBare("warning-exit-0", b(&ArgParser::argWarningExit0)); +this->ap.addBare("with-images", b(&ArgParser::argWithImages)); +this->ap.addOptionalParameter("collate", p(&ArgParser::argCollate)); +this->ap.addOptionalParameter("split-pages", p(&ArgParser::argSplitPages)); +this->ap.addRequiredParameter("compression-level", p(&ArgParser::argCompressionLevel), "level"); +this->ap.addRequiredParameter("copy-encryption", p(&ArgParser::argCopyEncryption), "file"); +this->ap.addRequiredParameter("encryption-file-password", p(&ArgParser::argEncryptionFilePassword), "password"); +this->ap.addRequiredParameter("force-version", p(&ArgParser::argForceVersion), "version"); +this->ap.addRequiredParameter("ii-min-bytes", p(&ArgParser::argIiMinBytes), "minimum"); +this->ap.addRequiredParameter("json-object", p(&ArgParser::argJsonObject), "trailer"); +this->ap.addRequiredParameter("keep-files-open-threshold", p(&ArgParser::argKeepFilesOpenThreshold), "count"); +this->ap.addRequiredParameter("linearize-pass1", p(&ArgParser::argLinearizePass1), "filename"); +this->ap.addRequiredParameter("min-version", p(&ArgParser::argMinVersion), "version"); +this->ap.addRequiredParameter("oi-min-area", p(&ArgParser::argOiMinArea), "minimum"); +this->ap.addRequiredParameter("oi-min-height", p(&ArgParser::argOiMinHeight), "minimum"); +this->ap.addRequiredParameter("oi-min-width", p(&ArgParser::argOiMinWidth), "minimum"); +this->ap.addRequiredParameter("password", p(&ArgParser::argPassword), "password"); +this->ap.addRequiredParameter("password-file", p(&ArgParser::argPasswordFile), "password"); +this->ap.addRequiredParameter("remove-attachment", p(&ArgParser::argRemoveAttachment), "attachment"); +this->ap.addRequiredParameter("rotate", p(&ArgParser::argRotate), "[+|-]angle"); +this->ap.addRequiredParameter("show-attachment", p(&ArgParser::argShowAttachment), "attachment"); +this->ap.addRequiredParameter("show-object", p(&ArgParser::argShowObject), "trailer"); +this->ap.addRequiredChoices("compress-streams", p(&ArgParser::argCompressStreams), yn_choices); +this->ap.addRequiredChoices("decode-level", p(&ArgParser::argDecodeLevel), decode_level_choices); +this->ap.addRequiredChoices("flatten-annotations", p(&ArgParser::argFlattenAnnotations), flatten_choices); +this->ap.addRequiredChoices("json-key", p(&ArgParser::argJsonKey), json_key_choices); +this->ap.addRequiredChoices("keep-files-open", p(&ArgParser::argKeepFilesOpen), yn_choices); +this->ap.addRequiredChoices("normalize-content", p(&ArgParser::argNormalizeContent), yn_choices); +this->ap.addRequiredChoices("object-streams", p(&ArgParser::argObjectStreams), object_streams_choices); +this->ap.addRequiredChoices("password-mode", p(&ArgParser::argPasswordMode), password_mode_choices); +this->ap.addRequiredChoices("remove-unreferenced-resources", p(&ArgParser::argRemoveUnreferencedResources), remove_unref_choices); +this->ap.addRequiredChoices("stream-data", p(&ArgParser::argStreamData), stream_data_choices); +this->ap.registerOptionTable("pages", b(&ArgParser::argEndPages)); +this->ap.addPositional(p(&ArgParser::argPagesPositional)); +this->ap.addRequiredParameter("password", p(&ArgParser::argPagesPassword), "password"); +this->ap.registerOptionTable("encryption", b(&ArgParser::argEndEncryption)); +this->ap.addPositional(p(&ArgParser::argEncPositional)); +this->ap.registerOptionTable("40-bit encryption", b(&ArgParser::argEnd40BitEncryption)); +this->ap.addRequiredChoices("extract", p(&ArgParser::argEnc40Extract), yn_choices); +this->ap.addRequiredChoices("annotate", p(&ArgParser::argEnc40Annotate), yn_choices); +this->ap.addRequiredChoices("print", p(&ArgParser::argEnc40Print), yn_choices); +this->ap.addRequiredChoices("modify", p(&ArgParser::argEnc40Modify), yn_choices); +this->ap.registerOptionTable("128-bit encryption", b(&ArgParser::argEnd128BitEncryption)); +this->ap.addBare("cleartext-metadata", b(&ArgParser::argEnc128CleartextMetadata)); +this->ap.addBare("force-V4", b(&ArgParser::argEnc128ForceV4)); +this->ap.addRequiredChoices("accessibility", p(&ArgParser::argEnc128Accessibility), yn_choices); +this->ap.addRequiredChoices("extract", p(&ArgParser::argEnc128Extract), yn_choices); +this->ap.addRequiredChoices("print", p(&ArgParser::argEnc128Print), print128_choices); +this->ap.addRequiredChoices("assemble", p(&ArgParser::argEnc128Assemble), yn_choices); +this->ap.addRequiredChoices("annotate", p(&ArgParser::argEnc128Annotate), yn_choices); +this->ap.addRequiredChoices("form", p(&ArgParser::argEnc128Form), yn_choices); +this->ap.addRequiredChoices("modify-other", p(&ArgParser::argEnc128ModifyOther), yn_choices); +this->ap.addRequiredChoices("modify", p(&ArgParser::argEnc128Modify), modify128_choices); +this->ap.addRequiredChoices("use-aes", p(&ArgParser::argEnc128UseAes), yn_choices); +this->ap.registerOptionTable("256-bit encryption", b(&ArgParser::argEnd256BitEncryption)); +this->ap.addBare("force-R5", b(&ArgParser::argEnc256ForceR5)); +this->ap.addBare("allow-insecure", b(&ArgParser::argEnc256AllowInsecure)); +this->ap.registerOptionTable("underlay/overlay", b(&ArgParser::argEndUnderlayOverlay)); +this->ap.addPositional(p(&ArgParser::argUOPositional)); +this->ap.addRequiredParameter("to", p(&ArgParser::argUOTo), "page-range"); +this->ap.addRequiredParameter("from", p(&ArgParser::argUOFrom), "page-range"); +this->ap.addRequiredParameter("repeat", p(&ArgParser::argUORepeat), "page-range"); +this->ap.addRequiredParameter("password", p(&ArgParser::argUOPassword), "password"); +this->ap.registerOptionTable("attachment", b(&ArgParser::argEndAttachment)); +this->ap.addPositional(p(&ArgParser::argAttPositional)); +this->ap.addBare("replace", b(&ArgParser::argAttReplace)); +this->ap.addRequiredParameter("key", p(&ArgParser::argAttKey), "attachment-key"); +this->ap.addRequiredParameter("filename", p(&ArgParser::argAttFilename), "filename"); +this->ap.addRequiredParameter("creationdate", p(&ArgParser::argAttCreationdate), "creation-date"); +this->ap.addRequiredParameter("moddate", p(&ArgParser::argAttModdate), "modification-date"); +this->ap.addRequiredParameter("mimetype", p(&ArgParser::argAttMimetype), "mime/type"); +this->ap.addRequiredParameter("description", p(&ArgParser::argAttDescription), "description"); +this->ap.registerOptionTable("copy attachment", b(&ArgParser::argEndCopyAttachment)); +this->ap.addPositional(p(&ArgParser::argCopyAttPositional)); +this->ap.addRequiredParameter("prefix", p(&ArgParser::argCopyAttPrefix), "prefix"); +this->ap.addRequiredParameter("password", p(&ArgParser::argCopyAttPassword), "password"); +this->ap.selectOptionTable("256-bit encryption"); +this->ap.copyFromOtherTable("cleartext-metadata", "128-bit encryption"); +this->ap.copyFromOtherTable("accessibility", "128-bit encryption"); +this->ap.copyFromOtherTable("extract", "128-bit encryption"); +this->ap.copyFromOtherTable("print", "128-bit encryption"); +this->ap.copyFromOtherTable("assemble", "128-bit encryption"); +this->ap.copyFromOtherTable("annotate", "128-bit encryption"); +this->ap.copyFromOtherTable("form", "128-bit encryption"); +this->ap.copyFromOtherTable("modify-other", "128-bit encryption"); +this->ap.copyFromOtherTable("modify", "128-bit encryption");