Commit 4577df4b5ddf363f5f877fe3b4b4c9ae710c9d55

Authored by Jay Berkenbilt
1 parent f1d805ba

QPDFJob increment: generate option table initialization

generate_auto_job
@@ -162,11 +162,66 @@ class Main: @@ -162,11 +162,66 @@ class Main:
162 print(f'void {identifier}();', file=f) 162 print(f'void {identifier}();', file=f)
163 163
164 def generate_init(self, data, f): 164 def generate_init(self, data, f):
  165 + print('auto b = [this](void (ArgParser::*f)()) {', file=f)
  166 + print(' return QPDFArgParser::bindBare(f, this);', file=f)
  167 + print('};', file=f)
  168 + print('auto p = [this](void (ArgParser::*f)(char *)) {', file=f)
  169 + print(' return QPDFArgParser::bindParam(f, this);', file=f)
  170 + print('};', file=f)
  171 + print('', file=f)
165 for k, v in data['choices'].items(): 172 for k, v in data['choices'].items():
166 print(f'char const* {k}_choices[] = {{', file=f, end='') 173 print(f'char const* {k}_choices[] = {{', file=f, end='')
167 for i in v: 174 for i in v:
168 print(f'"{i}", ', file=f, end='') 175 print(f'"{i}", ', file=f, end='')
169 print('0};', file=f) 176 print('0};', file=f)
  177 + print('', file=f)
  178 + for o in data['options']:
  179 + table = o['table']
  180 + if table == 'main':
  181 + print('this->ap.selectMainOptionTable();', file=f)
  182 + elif table == 'help':
  183 + print('this->ap.selectHelpOptionTable();', file=f)
  184 + else:
  185 + identifier = self.to_identifier(table, 'argEnd', False)
  186 + print(f'this->ap.registerOptionTable("{table}",'
  187 + f' b(&ArgParser::{identifier}));', file=f)
  188 + prefix = 'arg' + o.get('prefix', '')
  189 + if o.get('positional', False):
  190 + print('this->ap.addPositional('
  191 + f'p(&ArgParser::{prefix}Positional));', file=f)
  192 + for i in o.get('bare', []):
  193 + identifier = self.to_identifier(i, prefix, False)
  194 + print(f'this->ap.addBare("{i}", '
  195 + f'b(&ArgParser::{identifier}));', file=f)
  196 + for i in o.get('optional_parameter', []):
  197 + identifier = self.to_identifier(i, prefix, False)
  198 + print(f'this->ap.addOptionalParameter("{i}", '
  199 + f'p(&ArgParser::{identifier}));', file=f)
  200 + for k, v in o.get('required_parameter', {}).items():
  201 + identifier = self.to_identifier(k, prefix, False)
  202 + print(f'this->ap.addRequiredParameter("{k}", '
  203 + f'p(&ArgParser::{identifier})'
  204 + f', "{v}");', file=f)
  205 + for k, v in o.get('required_choices', {}).items():
  206 + identifier = self.to_identifier(k, prefix, False)
  207 + print(f'this->ap.addRequiredChoices("{k}", '
  208 + f'p(&ArgParser::{identifier})'
  209 + f', {v}_choices);', file=f)
  210 + for o in data['options']:
  211 + table = o['table']
  212 + if 'from_table' not in o:
  213 + continue
  214 + if table == 'main':
  215 + print('this->ap.selectMainOptionTable();', file=f)
  216 + elif table == 'help':
  217 + print('this->ap.selectHelpOptionTable();', file=f)
  218 + else:
  219 + print(f'this->ap.selectOptionTable("{table}");', file=f)
  220 + ft = o['from_table']
  221 + other_table = ft['table']
  222 + for j in ft['options']:
  223 + print('this->ap.copyFromOtherTable'
  224 + f'("{j}", "{other_table}");', file=f)
170 225
171 226
172 if __name__ == '__main__': 227 if __name__ == '__main__':
job.sums
1 # Generated by generate_auto_job 1 # Generated by generate_auto_job
2 -generate_auto_job 52a5e6bc70375e1183fedd5865ae4eae2a10be8d80edede1c48f9946be5d2538  
3 -job.yml b4d230c46ca2b2e75b3b974e2d9ad21fb007eb5007d05cf249ae1e2cde81040c 2 +generate_auto_job 575569edf2ab0036ed7f810bf506968c73c9209a64ec0ae2ed959f0426291447
  3 +job.yml 5de5f1cd3f998274ed4aafa234e61b726a8f96157148ad463970439a96e897bd
4 libqpdf/qpdf/auto_job_decl.hh fca37543c1a2b7f675374e23b1ab34b30a7f5f2d843c53d4bc7e9a12bf4c3615 4 libqpdf/qpdf/auto_job_decl.hh fca37543c1a2b7f675374e23b1ab34b30a7f5f2d843c53d4bc7e9a12bf4c3615
5 -libqpdf/qpdf/auto_job_init.hh 0640167b8d550030c086851408b842e2a93c86577253d78f1b7d41d4ca695bd9 5 +libqpdf/qpdf/auto_job_init.hh 7d7dfe96d4da765b8defb646058027584ea8924c604c558402aa7f2d2e61a005
@@ -165,12 +165,12 @@ options: @@ -165,12 +165,12 @@ options:
165 required_choices: 165 required_choices:
166 accessibility: yn 166 accessibility: yn
167 extract: yn 167 extract: yn
168 - print: print128_choices 168 + print: print128
169 assemble: yn 169 assemble: yn
170 annotate: yn 170 annotate: yn
171 form: yn 171 form: yn
172 modify-other: yn 172 modify-other: yn
173 - modify: modify128_choices 173 + modify: modify128
174 use-aes: yn 174 use-aes: yn
175 - table: 256-bit encryption 175 - table: 256-bit encryption
176 prefix: Enc256 176 prefix: Enc256
libqpdf/QPDFJob_argv.cc
@@ -26,7 +26,7 @@ namespace @@ -26,7 +26,7 @@ namespace
26 # include <qpdf/auto_job_decl.hh> 26 # include <qpdf/auto_job_decl.hh>
27 27
28 void usage(std::string const& message); 28 void usage(std::string const& message);
29 - void initOptionTable(); 29 + void initOptionTables();
30 void doFinalChecks(); 30 void doFinalChecks();
31 void parseUnderOverlayOptions(QPDFJob::UnderOverlay*); 31 void parseUnderOverlayOptions(QPDFJob::UnderOverlay*);
32 void parseRotationParameter(std::string const&); 32 void parseRotationParameter(std::string const&);
@@ -45,221 +45,16 @@ ArgParser::ArgParser(QPDFArgParser&amp; ap, QPDFJob&amp; o) : @@ -45,221 +45,16 @@ ArgParser::ArgParser(QPDFArgParser&amp; ap, QPDFJob&amp; o) :
45 o(o), 45 o(o),
46 pages_password(nullptr) 46 pages_password(nullptr)
47 { 47 {
48 - initOptionTable(); 48 + initOptionTables();
49 } 49 }
50 50
51 void 51 void
52 -ArgParser::initOptionTable() 52 +ArgParser::initOptionTables()
53 { 53 {
54 - auto b = [this](void (ArgParser::*f)()) {  
55 - return QPDFArgParser::bindBare(f, this);  
56 - };  
57 - auto p = [this](void (ArgParser::*f)(char *)) {  
58 - return QPDFArgParser::bindParam(f, this);  
59 - };  
60 -  
61 - this->ap.addFinalCheck(b(&ArgParser::doFinalChecks));  
62 54
63 # include <qpdf/auto_job_init.hh> 55 # include <qpdf/auto_job_init.hh>
64 -  
65 - this->ap.selectHelpOptionTable();  
66 - this->ap.addBare("help", b(&ArgParser::argHelp));  
67 - this->ap.addBare("version", b(&ArgParser::argVersion));  
68 - this->ap.addBare("copyright", b(&ArgParser::argCopyright));  
69 - this->ap.addBare("json-help", b(&ArgParser::argJsonHelp));  
70 - this->ap.addBare("show-crypto", b(&ArgParser::argShowCrypto));  
71 -  
72 - this->ap.selectMainOptionTable();  
73 - this->ap.addPositional(p(&ArgParser::argPositional));  
74 - this->ap.addRequiredParameter("password",  
75 - p(&ArgParser::argPassword), "password");  
76 - this->ap.addRequiredParameter("password-file",  
77 - p(&ArgParser::argPasswordFile), "password-file");  
78 - this->ap.addBare("empty", b(&ArgParser::argEmpty));  
79 - this->ap.addBare("linearize", b(&ArgParser::argLinearize));  
80 - this->ap.addBare("decrypt", b(&ArgParser::argDecrypt));  
81 - this->ap.addBare("password-is-hex-key", b(&ArgParser::argPasswordIsHexKey));  
82 - this->ap.addBare("suppress-password-recovery",  
83 - b(&ArgParser::argSuppressPasswordRecovery));  
84 - this->ap.addRequiredChoices("password-mode",  
85 - p(&ArgParser::argPasswordMode), password_mode_choices);  
86 - this->ap.addRequiredParameter("copy-encryption",  
87 - p(&ArgParser::argCopyEncryption), "file");  
88 - this->ap.addRequiredParameter("encryption-file-password",  
89 - p(&ArgParser::argEncryptionFilePassword), "password");  
90 - this->ap.addRequiredParameter("rotate",  
91 - p(&ArgParser::argRotate), "[+|-]angle:page-range");  
92 - this->ap.addOptionalParameter("collate",p(&ArgParser::argCollate));  
93 - this->ap.addBare("flatten-rotation", b(&ArgParser::argFlattenRotation));  
94 - this->ap.addBare("list-attachments", b(&ArgParser::argListAttachments));  
95 - this->ap.addRequiredParameter("show-attachment",  
96 - p(&ArgParser::argShowAttachment), "attachment-key");  
97 - this->ap.addRequiredParameter("remove-attachment",  
98 - p(&ArgParser::argRemoveAttachment), "attachment-key");  
99 - this->ap.addBare("add-attachment", b(&ArgParser::argAddAttachment));  
100 - this->ap.addBare(  
101 - "copy-attachments-from", b(&ArgParser::argCopyAttachmentsFrom));  
102 - this->ap.addRequiredChoices("stream-data",  
103 - p(&ArgParser::argStreamData), stream_data_choices);  
104 - this->ap.addRequiredChoices("compress-streams",  
105 - p(&ArgParser::argCompressStreams), yn_choices);  
106 - this->ap.addBare("recompress-flate", b(&ArgParser::argRecompressFlate));  
107 - this->ap.addRequiredParameter("compression-level",  
108 - p(&ArgParser::argCompressionLevel), "level");  
109 - this->ap.addRequiredChoices("decode-level",  
110 - p(&ArgParser::argDecodeLevel), decode_level_choices);  
111 - this->ap.addRequiredChoices("normalize-content",  
112 - p(&ArgParser::argNormalizeContent), yn_choices);  
113 - this->ap.addBare("suppress-recovery", b(&ArgParser::argSuppressRecovery));  
114 - this->ap.addRequiredChoices("object-streams",  
115 - p(&ArgParser::argObjectStreams), object_streams_choices);  
116 - this->ap.addBare(  
117 - "ignore-xref-streams", b(&ArgParser::argIgnoreXrefStreams));  
118 - this->ap.addBare("qdf", b(&ArgParser::argQdf));  
119 - this->ap.addBare(  
120 - "preserve-unreferenced", b(&ArgParser::argPreserveUnreferenced));  
121 - this->ap.addBare(  
122 - "preserve-unreferenced-resources",  
123 - b(&ArgParser::argPreserveUnreferencedResources));  
124 - this->ap.addRequiredChoices("remove-unreferenced-resources",  
125 - p(&ArgParser::argRemoveUnreferencedResources), remove_unref_choices);  
126 - this->ap.addRequiredChoices("keep-files-open",  
127 - p(&ArgParser::argKeepFilesOpen), yn_choices);  
128 - this->ap.addRequiredParameter("keep-files-open-threshold",  
129 - p(&ArgParser::argKeepFilesOpenThreshold), "count");  
130 - this->ap.addBare("newline-before-endstream", b(&ArgParser::argNewlineBeforeEndstream));  
131 - this->ap.addRequiredParameter("linearize-pass1",  
132 - p(&ArgParser::argLinearizePass1), "filename");  
133 - this->ap.addBare("coalesce-contents", b(&ArgParser::argCoalesceContents));  
134 - this->ap.addRequiredChoices("flatten-annotations",  
135 - p(&ArgParser::argFlattenAnnotations), flatten_choices);  
136 - this->ap.addBare("generate-appearances", b(&ArgParser::argGenerateAppearances));  
137 - this->ap.addRequiredParameter("min-version",  
138 - p(&ArgParser::argMinVersion), "version");  
139 - this->ap.addRequiredParameter("force-version",  
140 - p(&ArgParser::argForceVersion), "version");  
141 - this->ap.addOptionalParameter("split-pages",p(&ArgParser::argSplitPages));  
142 - this->ap.addBare("verbose", b(&ArgParser::argVerbose));  
143 - this->ap.addBare("progress", b(&ArgParser::argProgress));  
144 - this->ap.addBare("no-warn", b(&ArgParser::argNoWarn));  
145 - this->ap.addBare("warning-exit-0", b(&ArgParser::argWarningExit0));  
146 - this->ap.addBare("deterministic-id", b(&ArgParser::argDeterministicId));  
147 - this->ap.addBare("static-id", b(&ArgParser::argStaticId));  
148 - this->ap.addBare("static-aes-iv", b(&ArgParser::argStaticAesIv));  
149 - this->ap.addBare("no-original-object-ids", b(&ArgParser::argNoOriginalObjectIds));  
150 - this->ap.addBare("show-encryption", b(&ArgParser::argShowEncryption));  
151 - this->ap.addBare("show-encryption-key", b(&ArgParser::argShowEncryptionKey));  
152 - this->ap.addBare("check-linearization", b(&ArgParser::argCheckLinearization));  
153 - this->ap.addBare("show-linearization", b(&ArgParser::argShowLinearization));  
154 - this->ap.addBare("show-xref", b(&ArgParser::argShowXref));  
155 - this->ap.addRequiredParameter("show-object",  
156 - p(&ArgParser::argShowObject), "trailer|obj[,gen]");  
157 - this->ap.addBare("raw-stream-data", b(&ArgParser::argRawStreamData));  
158 - this->ap.addBare("filtered-stream-data", b(&ArgParser::argFilteredStreamData));  
159 - this->ap.addBare("show-npages", b(&ArgParser::argShowNpages));  
160 - this->ap.addBare("show-pages", b(&ArgParser::argShowPages));  
161 - this->ap.addBare("with-images", b(&ArgParser::argWithImages));  
162 - this->ap.addBare("json", b(&ArgParser::argJson));  
163 - this->ap.addRequiredChoices("json-key",  
164 - p(&ArgParser::argJsonKey), json_key_choices);  
165 - this->ap.addRequiredParameter("json-object",  
166 - p(&ArgParser::argJsonObject), "trailer|obj[,gen]");  
167 - this->ap.addBare("check", b(&ArgParser::argCheck));  
168 - this->ap.addBare("optimize-images", b(&ArgParser::argOptimizeImages));  
169 - this->ap.addBare("externalize-inline-images", b(&ArgParser::argExternalizeInlineImages));  
170 - this->ap.addBare("keep-inline-images", b(&ArgParser::argKeepInlineImages));  
171 - this->ap.addBare("remove-page-labels", b(&ArgParser::argRemovePageLabels));  
172 - this->ap.addRequiredParameter("oi-min-width",  
173 - p(&ArgParser::argOiMinWidth), "minimum-width");  
174 - this->ap.addRequiredParameter("oi-min-height",  
175 - p(&ArgParser::argOiMinHeight), "minimum-height");  
176 - this->ap.addRequiredParameter("oi-min-area",  
177 - p(&ArgParser::argOiMinArea), "minimum-area");  
178 - this->ap.addRequiredParameter("ii-min-bytes",  
179 - p(&ArgParser::argIiMinBytes), "minimum-bytes");  
180 - this->ap.addBare("overlay", b(&ArgParser::argOverlay));  
181 - this->ap.addBare("underlay", b(&ArgParser::argUnderlay));  
182 - this->ap.addBare("replace-input", b(&ArgParser::argReplaceInput));  
183 - this->ap.addBare("is-encrypted", b(&ArgParser::argIsEncrypted));  
184 - this->ap.addBare("requires-password", b(&ArgParser::argRequiresPassword));  
185 - this->ap.addBare("allow-weak-crypto", b(&ArgParser::argAllowWeakCrypto));  
186 -  
187 - this->ap.selectMainOptionTable();  
188 - this->ap.addBare("pages", b(&ArgParser::argPages));  
189 - this->ap.registerOptionTable(O_PAGES, b(&ArgParser::argEndPages));  
190 - this->ap.addRequiredParameter(  
191 - "password", p(&ArgParser::argPagesPassword), "password");  
192 - this->ap.addPositional(p(&ArgParser::argPagesPositional));  
193 -  
194 - this->ap.selectMainOptionTable();  
195 - this->ap.addBare("encrypt", b(&ArgParser::argEncrypt));  
196 - this->ap.registerOptionTable(O_ENCRYPTION, b(&ArgParser::argEndEncryption));  
197 - this->ap.addPositional(p(&ArgParser::argEncPositional));  
198 - this->ap.registerOptionTable(O_40_BIT_ENCRYPTION, b(&ArgParser::argEndEncryption));  
199 - this->ap.addRequiredChoices("extract",p(&ArgParser::argEnc40Extract), yn_choices);  
200 - this->ap.addRequiredChoices("annotate",p(&ArgParser::argEnc40Annotate), yn_choices);  
201 - this->ap.addRequiredChoices("print",p(&ArgParser::argEnc40Print), yn_choices);  
202 - this->ap.addRequiredChoices("modify",p(&ArgParser::argEnc40Modify), yn_choices);  
203 - this->ap.registerOptionTable(O_128_BIT_ENCRYPTION, b(&ArgParser::argEndEncryption));  
204 - this->ap.registerOptionTable(O_256_BIT_ENCRYPTION, b(&ArgParser::argEndEncryption));  
205 - for (char const* k: {O_128_BIT_ENCRYPTION, O_256_BIT_ENCRYPTION})  
206 - {  
207 - this->ap.selectOptionTable(k);  
208 - this->ap.addRequiredChoices("accessibility",  
209 - p(&ArgParser::argEnc128Accessibility), yn_choices);  
210 - this->ap.addRequiredChoices("extract", p(&ArgParser::argEnc128Extract), yn_choices);  
211 - this->ap.addRequiredChoices("print",  
212 - p(&ArgParser::argEnc128Print), print128_choices);  
213 - this->ap.addRequiredChoices("assemble",p(&ArgParser::argEnc128Assemble), yn_choices);  
214 - this->ap.addRequiredChoices("annotate",p(&ArgParser::argEnc128Annotate), yn_choices);  
215 - this->ap.addRequiredChoices("form",p(&ArgParser::argEnc128Form), yn_choices);  
216 - this->ap.addRequiredChoices("modify-other",p(&ArgParser::argEnc128ModifyOther), yn_choices);  
217 - this->ap.addRequiredChoices("modify",  
218 - p(&ArgParser::argEnc128Modify), modify128_choices);  
219 - this->ap.addBare("cleartext-metadata", b(&ArgParser::argEnc128CleartextMetadata));  
220 - }  
221 -  
222 - this->ap.selectOptionTable(O_128_BIT_ENCRYPTION);  
223 - this->ap.addRequiredChoices("use-aes",p(&ArgParser::argEnc128UseAes), yn_choices);  
224 - this->ap.addBare("force-V4", b(&ArgParser::argEnc128ForceV4));  
225 -  
226 - this->ap.selectOptionTable(O_256_BIT_ENCRYPTION);  
227 - this->ap.addBare("force-R5", b(&ArgParser::argEnc256ForceR5));  
228 - this->ap.addBare("allow-insecure", b(&ArgParser::argEnc256AllowInsecure));  
229 -  
230 - this->ap.registerOptionTable(O_UNDERLAY_OVERLAY, b(&ArgParser::argEndUnderlayOverlay));  
231 - this->ap.addPositional(p(&ArgParser::argUOPositional));  
232 - this->ap.addRequiredParameter("to",  
233 - p(&ArgParser::argUOTo), "page-range");  
234 - this->ap.addRequiredParameter("from",  
235 - p(&ArgParser::argUOFrom), "page-range");  
236 - this->ap.addRequiredParameter("repeat",  
237 - p(&ArgParser::argUORepeat), "page-range");  
238 - this->ap.addRequiredParameter("password",  
239 - p(&ArgParser::argUOPassword), "password");  
240 -  
241 - this->ap.registerOptionTable(O_ATTACHMENT, b(&ArgParser::argEndAttachment));  
242 - this->ap.addPositional(p(&ArgParser::argAttPositional));  
243 - this->ap.addRequiredParameter("key",  
244 - p(&ArgParser::argAttKey), "attachment-key");  
245 - this->ap.addRequiredParameter("filename",  
246 - p(&ArgParser::argAttFilename), "filename");  
247 - this->ap.addRequiredParameter("creationdate",  
248 - p(&ArgParser::argAttCreationdate), "creation-date");  
249 - this->ap.addRequiredParameter("moddate",  
250 - p(&ArgParser::argAttModdate), "modification-date");  
251 - this->ap.addRequiredParameter("mimetype",  
252 - p(&ArgParser::argAttMimetype), "mime/type");  
253 - this->ap.addRequiredParameter("description",  
254 - p(&ArgParser::argAttDescription), "description");  
255 - this->ap.addBare("replace", b(&ArgParser::argAttReplace));  
256 -  
257 - this->ap.registerOptionTable(O_COPY_ATTACHMENT, b(&ArgParser::argEndCopyAttachment));  
258 - this->ap.addPositional(p(&ArgParser::argCopyAttPositional));  
259 - this->ap.addRequiredParameter("prefix",  
260 - p(&ArgParser::argCopyAttPrefix), "prefix");  
261 - this->ap.addRequiredParameter("password",  
262 - p(&ArgParser::argCopyAttPassword), "password"); 56 + this->ap.addFinalCheck(
  57 + QPDFArgParser::bindBare(&ArgParser::doFinalChecks, this));
263 } 58 }
264 59
265 void 60 void
@@ -1822,6 +1617,24 @@ ArgParser::argEndEncryption() @@ -1822,6 +1617,24 @@ ArgParser::argEndEncryption()
1822 } 1617 }
1823 1618
1824 void 1619 void
  1620 +ArgParser::argEnd40BitEncryption()
  1621 +{
  1622 + argEndEncryption();
  1623 +}
  1624 +
  1625 +void
  1626 +ArgParser::argEnd128BitEncryption()
  1627 +{
  1628 + argEndEncryption();
  1629 +}
  1630 +
  1631 +void
  1632 +ArgParser::argEnd256BitEncryption()
  1633 +{
  1634 + argEndEncryption();
  1635 +}
  1636 +
  1637 +void
1825 ArgParser::argUOPositional(char* arg) 1638 ArgParser::argUOPositional(char* arg)
1826 { 1639 {
1827 if (o.under_overlay->filename) 1640 if (o.under_overlay->filename)
libqpdf/qpdf/auto_job_init.hh
@@ -3,6 +3,13 @@ @@ -3,6 +3,13 @@
3 // Edits will be automatically overwritten if the build is 3 // Edits will be automatically overwritten if the build is
4 // run in maintainer mode. 4 // run in maintainer mode.
5 // 5 //
  6 +auto b = [this](void (ArgParser::*f)()) {
  7 + return QPDFArgParser::bindBare(f, this);
  8 +};
  9 +auto p = [this](void (ArgParser::*f)(char *)) {
  10 + return QPDFArgParser::bindParam(f, this);
  11 +};
  12 +
6 char const* yn_choices[] = {"y", "n", 0}; 13 char const* yn_choices[] = {"y", "n", 0};
7 char const* password_mode_choices[] = {"bytes", "hex-bytes", "unicode", "auto", 0}; 14 char const* password_mode_choices[] = {"bytes", "hex-bytes", "unicode", "auto", 0};
8 char const* stream_data_choices[] = {"compress", "preserve", "uncompress", 0}; 15 char const* stream_data_choices[] = {"compress", "preserve", "uncompress", 0};
@@ -13,3 +20,146 @@ char const* flatten_choices[] = {&quot;all&quot;, &quot;print&quot;, &quot;screen&quot;, 0}; @@ -13,3 +20,146 @@ char const* flatten_choices[] = {&quot;all&quot;, &quot;print&quot;, &quot;screen&quot;, 0};
13 char const* json_key_choices[] = {"acroform", "attachments", "encrypt", "objectinfo", "objects", "outlines", "pagelabels", "pages", 0}; 20 char const* json_key_choices[] = {"acroform", "attachments", "encrypt", "objectinfo", "objects", "outlines", "pagelabels", "pages", 0};
14 char const* print128_choices[] = {"full", "low", "none", 0}; 21 char const* print128_choices[] = {"full", "low", "none", 0};
15 char const* modify128_choices[] = {"all", "annotate", "form", "assembly", "none", 0}; 22 char const* modify128_choices[] = {"all", "annotate", "form", "assembly", "none", 0};
  23 +
  24 +this->ap.selectHelpOptionTable();
  25 +this->ap.addBare("help", b(&ArgParser::argHelp));
  26 +this->ap.addBare("version", b(&ArgParser::argVersion));
  27 +this->ap.addBare("copyright", b(&ArgParser::argCopyright));
  28 +this->ap.addBare("json-help", b(&ArgParser::argJsonHelp));
  29 +this->ap.addBare("show-crypto", b(&ArgParser::argShowCrypto));
  30 +this->ap.selectMainOptionTable();
  31 +this->ap.addPositional(p(&ArgParser::argPositional));
  32 +this->ap.addBare("add-attachment", b(&ArgParser::argAddAttachment));
  33 +this->ap.addBare("allow-weak-crypto", b(&ArgParser::argAllowWeakCrypto));
  34 +this->ap.addBare("check", b(&ArgParser::argCheck));
  35 +this->ap.addBare("check-linearization", b(&ArgParser::argCheckLinearization));
  36 +this->ap.addBare("coalesce-contents", b(&ArgParser::argCoalesceContents));
  37 +this->ap.addBare("copy-attachments-from", b(&ArgParser::argCopyAttachmentsFrom));
  38 +this->ap.addBare("decrypt", b(&ArgParser::argDecrypt));
  39 +this->ap.addBare("deterministic-id", b(&ArgParser::argDeterministicId));
  40 +this->ap.addBare("empty", b(&ArgParser::argEmpty));
  41 +this->ap.addBare("encrypt", b(&ArgParser::argEncrypt));
  42 +this->ap.addBare("externalize-inline-images", b(&ArgParser::argExternalizeInlineImages));
  43 +this->ap.addBare("filtered-stream-data", b(&ArgParser::argFilteredStreamData));
  44 +this->ap.addBare("flatten-rotation", b(&ArgParser::argFlattenRotation));
  45 +this->ap.addBare("generate-appearances", b(&ArgParser::argGenerateAppearances));
  46 +this->ap.addBare("ignore-xref-streams", b(&ArgParser::argIgnoreXrefStreams));
  47 +this->ap.addBare("is-encrypted", b(&ArgParser::argIsEncrypted));
  48 +this->ap.addBare("json", b(&ArgParser::argJson));
  49 +this->ap.addBare("keep-inline-images", b(&ArgParser::argKeepInlineImages));
  50 +this->ap.addBare("linearize", b(&ArgParser::argLinearize));
  51 +this->ap.addBare("list-attachments", b(&ArgParser::argListAttachments));
  52 +this->ap.addBare("newline-before-endstream", b(&ArgParser::argNewlineBeforeEndstream));
  53 +this->ap.addBare("no-original-object-ids", b(&ArgParser::argNoOriginalObjectIds));
  54 +this->ap.addBare("no-warn", b(&ArgParser::argNoWarn));
  55 +this->ap.addBare("optimize-images", b(&ArgParser::argOptimizeImages));
  56 +this->ap.addBare("overlay", b(&ArgParser::argOverlay));
  57 +this->ap.addBare("pages", b(&ArgParser::argPages));
  58 +this->ap.addBare("password-is-hex-key", b(&ArgParser::argPasswordIsHexKey));
  59 +this->ap.addBare("preserve-unreferenced", b(&ArgParser::argPreserveUnreferenced));
  60 +this->ap.addBare("preserve-unreferenced-resources", b(&ArgParser::argPreserveUnreferencedResources));
  61 +this->ap.addBare("progress", b(&ArgParser::argProgress));
  62 +this->ap.addBare("qdf", b(&ArgParser::argQdf));
  63 +this->ap.addBare("raw-stream-data", b(&ArgParser::argRawStreamData));
  64 +this->ap.addBare("recompress-flate", b(&ArgParser::argRecompressFlate));
  65 +this->ap.addBare("remove-page-labels", b(&ArgParser::argRemovePageLabels));
  66 +this->ap.addBare("replace-input", b(&ArgParser::argReplaceInput));
  67 +this->ap.addBare("requires-password", b(&ArgParser::argRequiresPassword));
  68 +this->ap.addBare("show-encryption", b(&ArgParser::argShowEncryption));
  69 +this->ap.addBare("show-encryption-key", b(&ArgParser::argShowEncryptionKey));
  70 +this->ap.addBare("show-linearization", b(&ArgParser::argShowLinearization));
  71 +this->ap.addBare("show-npages", b(&ArgParser::argShowNpages));
  72 +this->ap.addBare("show-pages", b(&ArgParser::argShowPages));
  73 +this->ap.addBare("show-xref", b(&ArgParser::argShowXref));
  74 +this->ap.addBare("static-aes-iv", b(&ArgParser::argStaticAesIv));
  75 +this->ap.addBare("static-id", b(&ArgParser::argStaticId));
  76 +this->ap.addBare("suppress-password-recovery", b(&ArgParser::argSuppressPasswordRecovery));
  77 +this->ap.addBare("suppress-recovery", b(&ArgParser::argSuppressRecovery));
  78 +this->ap.addBare("underlay", b(&ArgParser::argUnderlay));
  79 +this->ap.addBare("verbose", b(&ArgParser::argVerbose));
  80 +this->ap.addBare("warning-exit-0", b(&ArgParser::argWarningExit0));
  81 +this->ap.addBare("with-images", b(&ArgParser::argWithImages));
  82 +this->ap.addOptionalParameter("collate", p(&ArgParser::argCollate));
  83 +this->ap.addOptionalParameter("split-pages", p(&ArgParser::argSplitPages));
  84 +this->ap.addRequiredParameter("compression-level", p(&ArgParser::argCompressionLevel), "level");
  85 +this->ap.addRequiredParameter("copy-encryption", p(&ArgParser::argCopyEncryption), "file");
  86 +this->ap.addRequiredParameter("encryption-file-password", p(&ArgParser::argEncryptionFilePassword), "password");
  87 +this->ap.addRequiredParameter("force-version", p(&ArgParser::argForceVersion), "version");
  88 +this->ap.addRequiredParameter("ii-min-bytes", p(&ArgParser::argIiMinBytes), "minimum");
  89 +this->ap.addRequiredParameter("json-object", p(&ArgParser::argJsonObject), "trailer");
  90 +this->ap.addRequiredParameter("keep-files-open-threshold", p(&ArgParser::argKeepFilesOpenThreshold), "count");
  91 +this->ap.addRequiredParameter("linearize-pass1", p(&ArgParser::argLinearizePass1), "filename");
  92 +this->ap.addRequiredParameter("min-version", p(&ArgParser::argMinVersion), "version");
  93 +this->ap.addRequiredParameter("oi-min-area", p(&ArgParser::argOiMinArea), "minimum");
  94 +this->ap.addRequiredParameter("oi-min-height", p(&ArgParser::argOiMinHeight), "minimum");
  95 +this->ap.addRequiredParameter("oi-min-width", p(&ArgParser::argOiMinWidth), "minimum");
  96 +this->ap.addRequiredParameter("password", p(&ArgParser::argPassword), "password");
  97 +this->ap.addRequiredParameter("password-file", p(&ArgParser::argPasswordFile), "password");
  98 +this->ap.addRequiredParameter("remove-attachment", p(&ArgParser::argRemoveAttachment), "attachment");
  99 +this->ap.addRequiredParameter("rotate", p(&ArgParser::argRotate), "[+|-]angle");
  100 +this->ap.addRequiredParameter("show-attachment", p(&ArgParser::argShowAttachment), "attachment");
  101 +this->ap.addRequiredParameter("show-object", p(&ArgParser::argShowObject), "trailer");
  102 +this->ap.addRequiredChoices("compress-streams", p(&ArgParser::argCompressStreams), yn_choices);
  103 +this->ap.addRequiredChoices("decode-level", p(&ArgParser::argDecodeLevel), decode_level_choices);
  104 +this->ap.addRequiredChoices("flatten-annotations", p(&ArgParser::argFlattenAnnotations), flatten_choices);
  105 +this->ap.addRequiredChoices("json-key", p(&ArgParser::argJsonKey), json_key_choices);
  106 +this->ap.addRequiredChoices("keep-files-open", p(&ArgParser::argKeepFilesOpen), yn_choices);
  107 +this->ap.addRequiredChoices("normalize-content", p(&ArgParser::argNormalizeContent), yn_choices);
  108 +this->ap.addRequiredChoices("object-streams", p(&ArgParser::argObjectStreams), object_streams_choices);
  109 +this->ap.addRequiredChoices("password-mode", p(&ArgParser::argPasswordMode), password_mode_choices);
  110 +this->ap.addRequiredChoices("remove-unreferenced-resources", p(&ArgParser::argRemoveUnreferencedResources), remove_unref_choices);
  111 +this->ap.addRequiredChoices("stream-data", p(&ArgParser::argStreamData), stream_data_choices);
  112 +this->ap.registerOptionTable("pages", b(&ArgParser::argEndPages));
  113 +this->ap.addPositional(p(&ArgParser::argPagesPositional));
  114 +this->ap.addRequiredParameter("password", p(&ArgParser::argPagesPassword), "password");
  115 +this->ap.registerOptionTable("encryption", b(&ArgParser::argEndEncryption));
  116 +this->ap.addPositional(p(&ArgParser::argEncPositional));
  117 +this->ap.registerOptionTable("40-bit encryption", b(&ArgParser::argEnd40BitEncryption));
  118 +this->ap.addRequiredChoices("extract", p(&ArgParser::argEnc40Extract), yn_choices);
  119 +this->ap.addRequiredChoices("annotate", p(&ArgParser::argEnc40Annotate), yn_choices);
  120 +this->ap.addRequiredChoices("print", p(&ArgParser::argEnc40Print), yn_choices);
  121 +this->ap.addRequiredChoices("modify", p(&ArgParser::argEnc40Modify), yn_choices);
  122 +this->ap.registerOptionTable("128-bit encryption", b(&ArgParser::argEnd128BitEncryption));
  123 +this->ap.addBare("cleartext-metadata", b(&ArgParser::argEnc128CleartextMetadata));
  124 +this->ap.addBare("force-V4", b(&ArgParser::argEnc128ForceV4));
  125 +this->ap.addRequiredChoices("accessibility", p(&ArgParser::argEnc128Accessibility), yn_choices);
  126 +this->ap.addRequiredChoices("extract", p(&ArgParser::argEnc128Extract), yn_choices);
  127 +this->ap.addRequiredChoices("print", p(&ArgParser::argEnc128Print), print128_choices);
  128 +this->ap.addRequiredChoices("assemble", p(&ArgParser::argEnc128Assemble), yn_choices);
  129 +this->ap.addRequiredChoices("annotate", p(&ArgParser::argEnc128Annotate), yn_choices);
  130 +this->ap.addRequiredChoices("form", p(&ArgParser::argEnc128Form), yn_choices);
  131 +this->ap.addRequiredChoices("modify-other", p(&ArgParser::argEnc128ModifyOther), yn_choices);
  132 +this->ap.addRequiredChoices("modify", p(&ArgParser::argEnc128Modify), modify128_choices);
  133 +this->ap.addRequiredChoices("use-aes", p(&ArgParser::argEnc128UseAes), yn_choices);
  134 +this->ap.registerOptionTable("256-bit encryption", b(&ArgParser::argEnd256BitEncryption));
  135 +this->ap.addBare("force-R5", b(&ArgParser::argEnc256ForceR5));
  136 +this->ap.addBare("allow-insecure", b(&ArgParser::argEnc256AllowInsecure));
  137 +this->ap.registerOptionTable("underlay/overlay", b(&ArgParser::argEndUnderlayOverlay));
  138 +this->ap.addPositional(p(&ArgParser::argUOPositional));
  139 +this->ap.addRequiredParameter("to", p(&ArgParser::argUOTo), "page-range");
  140 +this->ap.addRequiredParameter("from", p(&ArgParser::argUOFrom), "page-range");
  141 +this->ap.addRequiredParameter("repeat", p(&ArgParser::argUORepeat), "page-range");
  142 +this->ap.addRequiredParameter("password", p(&ArgParser::argUOPassword), "password");
  143 +this->ap.registerOptionTable("attachment", b(&ArgParser::argEndAttachment));
  144 +this->ap.addPositional(p(&ArgParser::argAttPositional));
  145 +this->ap.addBare("replace", b(&ArgParser::argAttReplace));
  146 +this->ap.addRequiredParameter("key", p(&ArgParser::argAttKey), "attachment-key");
  147 +this->ap.addRequiredParameter("filename", p(&ArgParser::argAttFilename), "filename");
  148 +this->ap.addRequiredParameter("creationdate", p(&ArgParser::argAttCreationdate), "creation-date");
  149 +this->ap.addRequiredParameter("moddate", p(&ArgParser::argAttModdate), "modification-date");
  150 +this->ap.addRequiredParameter("mimetype", p(&ArgParser::argAttMimetype), "mime/type");
  151 +this->ap.addRequiredParameter("description", p(&ArgParser::argAttDescription), "description");
  152 +this->ap.registerOptionTable("copy attachment", b(&ArgParser::argEndCopyAttachment));
  153 +this->ap.addPositional(p(&ArgParser::argCopyAttPositional));
  154 +this->ap.addRequiredParameter("prefix", p(&ArgParser::argCopyAttPrefix), "prefix");
  155 +this->ap.addRequiredParameter("password", p(&ArgParser::argCopyAttPassword), "password");
  156 +this->ap.selectOptionTable("256-bit encryption");
  157 +this->ap.copyFromOtherTable("cleartext-metadata", "128-bit encryption");
  158 +this->ap.copyFromOtherTable("accessibility", "128-bit encryption");
  159 +this->ap.copyFromOtherTable("extract", "128-bit encryption");
  160 +this->ap.copyFromOtherTable("print", "128-bit encryption");
  161 +this->ap.copyFromOtherTable("assemble", "128-bit encryption");
  162 +this->ap.copyFromOtherTable("annotate", "128-bit encryption");
  163 +this->ap.copyFromOtherTable("form", "128-bit encryption");
  164 +this->ap.copyFromOtherTable("modify-other", "128-bit encryption");
  165 +this->ap.copyFromOtherTable("modify", "128-bit encryption");