Commit f60526aff93ef1049242b215a9f247dca4c7f99e

Authored by Jay Berkenbilt
1 parent b4b0df0d

QPDFJob: start changing generation for trivial config handlers

generate_auto_job
... ... @@ -19,6 +19,58 @@ def warn(*args, **kwargs):
19 19 print(*args, file=sys.stderr, **kwargs)
20 20  
21 21  
  22 +# QXXXQ
  23 +# These need manual handlers.
  24 +complex = set([
  25 + 'add-attachment',
  26 + 'copy-attachments-from',
  27 + 'encrypt',
  28 + 'overlay',
  29 + 'pages',
  30 + 'underlay',
  31 +])
  32 +
  33 +# QXXXQ
  34 +# These are trivial but not in main and so need a different config
  35 +# object. Some are in more than one table.
  36 +not_yet = set([
  37 + 'accessibility',
  38 + 'allow-insecure',
  39 + 'annotate',
  40 + 'assemble',
  41 + 'cleartext-metadata',
  42 + 'creationdate',
  43 + 'decode-level',
  44 + 'description',
  45 + 'extract',
  46 + 'filename',
  47 + 'force-R5',
  48 + 'force-V4',
  49 + 'form',
  50 + 'from',
  51 + 'job-json-file',
  52 + 'key',
  53 + 'mimetype',
  54 + 'moddate',
  55 + 'modify',
  56 + 'modify-other',
  57 + 'object-streams',
  58 + 'password',
  59 + 'password-file',
  60 + 'password-mode',
  61 + 'prefix',
  62 + 'print',
  63 + 'remove-unreferenced-resources',
  64 + 'repeat',
  65 + 'replace',
  66 + 'rotate',
  67 + 'show-object',
  68 + 'stream-data',
  69 + 'to',
  70 + 'use-aes',
  71 +])
  72 +
  73 +
22 74 class Main:
23 75 SOURCES = [
24 76 whoami,
... ... @@ -261,6 +313,53 @@ class Main:
261 313 self.update_hashes()
262 314 # DON'T ADD CODE TO generate AFTER update_hashes
263 315  
  316 + def handle_trivial(self, i, identifier, config, kind, v):
  317 + # QXXXQ could potentially generate declarations for config
  318 + # methods separately by config object
  319 + if kind == 'bare':
  320 + self.init.append(f'this->ap.addBare("{i}", '
  321 + f'[this](){{{config}.{identifier}();}});')
  322 + elif kind == 'optional_parameter':
  323 + self.init.append(f'this->ap.addOptionalParameter("{i}", '
  324 + f'[this](char *x){{{config}.{identifier}(x);}});')
  325 + elif kind == 'required_parameter':
  326 + self.init.append(f'this->ap.addRequiredParameter("{i}", '
  327 + f'[this](char *x){{{config}.{identifier}(x);}}'
  328 + f', "{v}");')
  329 + elif kind == 'required_choices':
  330 + self.init.append(f'this->ap.addChoices("{i}", '
  331 + f'[this](char *x){{{config}.{identifier}(x);}}'
  332 + f', true, {v}_choices);')
  333 + elif kind == 'optional_choices':
  334 + self.init.append(f'this->ap.addChoices("{i}", '
  335 + f'[this](char *x){{{config}.{identifier}(x);}}'
  336 + f', false, {v}_choices);')
  337 +
  338 + def handle_flag(self, i, identifier, kind, v):
  339 + if kind == 'bare':
  340 + self.decls.append(f'void {identifier}();')
  341 + self.init.append(f'this->ap.addBare("{i}", '
  342 + f'b(&ArgParser::{identifier}));')
  343 + elif kind == 'optional_parameter':
  344 + self.decls.append(f'void {identifier}(char *);')
  345 + self.init.append(f'this->ap.addOptionalParameter("{i}", '
  346 + f'p(&ArgParser::{identifier}));')
  347 + elif kind == 'required_parameter':
  348 + self.decls.append(f'void {identifier}(char *);')
  349 + self.init.append(f'this->ap.addRequiredParameter("{i}", '
  350 + f'p(&ArgParser::{identifier})'
  351 + f', "{v}");')
  352 + elif kind == 'required_choices':
  353 + self.decls.append(f'void {identifier}(char *);')
  354 + self.init.append(f'this->ap.addChoices("{i}", '
  355 + f'p(&ArgParser::{identifier})'
  356 + f', true, {v}_choices);')
  357 + elif kind == 'optional_choices':
  358 + self.decls.append(f'void {identifier}(char *);')
  359 + self.init.append(f'this->ap.addChoices("{i}", '
  360 + f'p(&ArgParser::{identifier})'
  361 + f', false, {v}_choices);')
  362 +
264 363 def prepare(self, data):
265 364 self.decls = []
266 365 self.init = []
... ... @@ -306,6 +405,7 @@ class Main:
306 405 self.decls.append('')
307 406 for o in data['options']:
308 407 table = o['table']
  408 + config = o.get('config', None)
309 409 table_prefix = o.get('prefix', table)
310 410 if table == 'main':
311 411 self.init.append('this->ap.selectMainOptionTable();')
... ... @@ -321,44 +421,31 @@ class Main:
321 421 self.decls.append(f'void {prefix}Positional(char*);')
322 422 self.init.append('this->ap.addPositional('
323 423 f'p(&ArgParser::{prefix}Positional));')
  424 + flags = {}
  425 +
324 426 for i in o.get('bare', []):
325   - self.options_without_help.add(f'--{i}')
326   - identifier = self.to_identifier(i, prefix, False)
327   - self.decls.append(f'void {identifier}();')
328   - self.init.append(f'this->ap.addBare("{i}", '
329   - f'b(&ArgParser::{identifier}));')
330   - add_jdata(i, table_prefix)
  427 + flags[i] = ['bare', None]
331 428 for i in o.get('optional_parameter', []):
332   - self.options_without_help.add(f'--{i}')
333   - identifier = self.to_identifier(i, prefix, False)
334   - self.decls.append(f'void {identifier}(char *);')
335   - self.init.append(f'this->ap.addOptionalParameter("{i}", '
336   - f'p(&ArgParser::{identifier}));')
337   - add_jdata(i, table_prefix)
  429 + flags[i] = ['optional_parameter', None]
338 430 for i, v in o.get('required_parameter', {}).items():
339   - self.options_without_help.add(f'--{i}')
340   - identifier = self.to_identifier(i, prefix, False)
341   - self.decls.append(f'void {identifier}(char *);')
342   - self.init.append(f'this->ap.addRequiredParameter("{i}", '
343   - f'p(&ArgParser::{identifier})'
344   - f', "{v}");')
345   - add_jdata(i, table_prefix)
  431 + flags[i] = ['required_parameter', v]
346 432 for i, v in o.get('required_choices', {}).items():
347   - self.options_without_help.add(f'--{i}')
348   - identifier = self.to_identifier(i, prefix, False)
349   - self.decls.append(f'void {identifier}(char *);')
350   - self.init.append(f'this->ap.addChoices("{i}", '
351   - f'p(&ArgParser::{identifier})'
352   - f', true, {v}_choices);')
353   - add_jdata(i, table_prefix)
  433 + flags[i] = ['required_choices', v]
354 434 for i, v in o.get('optional_choices', {}).items():
  435 + flags[i] = ['optional_choices', v]
  436 + self.options_without_help.add(f'--{i}')
  437 +
  438 + for i, [kind, v] in flags.items():
355 439 self.options_without_help.add(f'--{i}')
356   - identifier = self.to_identifier(i, prefix, False)
357   - self.decls.append(f'void {identifier}(char *);')
358   - self.init.append(f'this->ap.addChoices("{i}", '
359   - f'p(&ArgParser::{identifier})'
360   - f', false, {v}_choices);')
361 440 add_jdata(i, table_prefix)
  441 + # QXXXQ complex, not_yet
  442 + if i in complex or i in not_yet or config is None:
  443 + identifier = self.to_identifier(i, prefix, False)
  444 + self.handle_flag(i, identifier, kind, v)
  445 + else:
  446 + identifier = self.to_identifier(i, '', False)
  447 + self.handle_trivial(i, identifier, config, kind, v)
  448 +
362 449 if table not in ('main', 'help'):
363 450 identifier = self.to_identifier(table, 'argEnd', False)
364 451 self.decls.append(f'void {identifier}();')
... ... @@ -465,7 +552,7 @@ class Main:
465 552 ['choices', 'options', 'no-json', 'json']))
466 553 for o in data['options']:
467 554 self.check_keys('top', o, set(
468   - ['table', 'prefix', 'bare', 'positional',
  555 + ['table', 'prefix', 'config', 'bare', 'positional',
469 556 'optional_parameter', 'required_parameter',
470 557 'required_choices', 'optional_choices', 'from_table']))
471 558  
... ...
include/qpdf/QPDFJob.hh
... ... @@ -105,6 +105,7 @@ class QPDFJob
105 105 {
106 106 friend class QPDFJob;
107 107 public:
  108 + // QXXXQ could potentially generate these declarations
108 109 QPDF_DLL Config& allowWeakCrypto();
109 110 QPDF_DLL Config& check();
110 111 QPDF_DLL Config& checkLinearization();
... ...
job.sums
1 1 # Generated by generate_auto_job
2   -generate_auto_job 0758b244fc4e2d3e440883072d2740bc4cdb26c5aa8de938f028afd7d83fad79
3   -job.yml 78d3b655abe70c0baaa31e51b74931f97084632bca5961fdbae89d7a57f34a67
4   -libqpdf/qpdf/auto_job_decl.hh 9fda0ebd93bce6e308a3f26181293ad7b0d88a3503d4955cbf8e1db9a884d8ee
  2 +generate_auto_job ea845318af6d4226761f7534c489e4abe0c5f4864b2fee10c8a16f11034b4d34
  3 +job.yml 2752b11028530f127b06e9731834dc3ae4c3b13d0161608e3b258cd2a79767d7
  4 +libqpdf/qpdf/auto_job_decl.hh db95ca0864e7495532095cd193be1ff0c15797b9ccaf252024c1154bae57b365
5 5 libqpdf/qpdf/auto_job_help.hh 383eea80e2c185ef5295fc126246457a7ceeffea759fdb90bb2e6727532ea538
6   -libqpdf/qpdf/auto_job_init.hh a16e89fc7be3ca200d47391d949628a92113533135758068b944b64d0d54793d
  6 +libqpdf/qpdf/auto_job_init.hh 864bb0a01df93bff129e7bc1723611d4e73f20ef7b0e33bd52261811eee43e2f
7 7 libqpdf/qpdf/auto_job_schema.hh c91a4e182e088797b70dda94af03ca32d360f3564890132da2a8bdc3c4432423
8 8 manual/_ext/qpdf.py 855fe12de5af7a10bb24be6ecc4d5dff4c84ac58cf388a13be6bbb394346a67d
9 9 manual/cli.rst 68122ff8179c10df3fe6d577adde4973c346f7866ba9a511bab5a6e6f292a6f1
... ...
... ... @@ -60,6 +60,7 @@ options:
60 60 - show-crypto
61 61 - job-json-help
62 62 - table: main
  63 + config: jc
63 64 positional: true
64 65 bare:
65 66 - add-attachment
... ...
libqpdf/QPDFJob_argv.cc
... ... @@ -216,20 +216,6 @@ ArgParser::argPasswordFile(char* parameter)
216 216 }
217 217  
218 218 void
219   -ArgParser::argEmpty()
220   -{
221   - // QXXXQ @TRIVIAL
222   - jc.empty();
223   -}
224   -
225   -void
226   -ArgParser::argLinearize()
227   -{
228   - // QXXXQ @TRIVIAL
229   - jc.linearize();
230   -}
231   -
232   -void
233 219 ArgParser::argEncrypt()
234 220 {
235 221 this->accumulated_args.clear();
... ... @@ -288,27 +274,6 @@ ArgParser::argEncPositional(char* arg)
288 274 }
289 275  
290 276 void
291   -ArgParser::argDecrypt()
292   -{
293   - // QXXXQ @TRIVIAL
294   - jc.decrypt();
295   -}
296   -
297   -void
298   -ArgParser::argPasswordIsHexKey()
299   -{
300   - // QXXXQ @TRIVIAL
301   - jc.passwordIsHexKey();
302   -}
303   -
304   -void
305   -ArgParser::argSuppressPasswordRecovery()
306   -{
307   - // QXXXQ @TRIVIAL
308   - jc.suppressPasswordRecovery();
309   -}
310   -
311   -void
312 277 ArgParser::argPasswordMode(char* parameter)
313 278 {
314 279 if (strcmp(parameter, "bytes") == 0)
... ... @@ -340,34 +305,6 @@ ArgParser::argEnc256AllowInsecure()
340 305 }
341 306  
342 307 void
343   -ArgParser::argAllowWeakCrypto()
344   -{
345   - // QXXXQ @TRIVIAL
346   - jc.allowWeakCrypto();
347   -}
348   -
349   -void
350   -ArgParser::argCopyEncryption(char* parameter)
351   -{
352   - // QXXXQ @TRIVIAL
353   - jc.copyEncryption(parameter);
354   -}
355   -
356   -void
357   -ArgParser::argEncryptionFilePassword(char* parameter)
358   -{
359   - // QXXXQ @TRIVIAL
360   - jc.encryptionFilePassword(parameter);
361   -}
362   -
363   -void
364   -ArgParser::argCollate(char* parameter)
365   -{
366   - // QXXXQ @TRIVIAL
367   - jc.collate(parameter);
368   -}
369   -
370   -void
371 308 ArgParser::argPages()
372 309 {
373 310 if (! o.page_specs.empty())
... ... @@ -505,34 +442,6 @@ ArgParser::argRotate(char* parameter)
505 442 }
506 443  
507 444 void
508   -ArgParser::argFlattenRotation()
509   -{
510   - // QXXXQ @TRIVIAL
511   - jc.flattenRotation();
512   -}
513   -
514   -void
515   -ArgParser::argListAttachments()
516   -{
517   - // QXXXQ @TRIVIAL
518   - jc.listAttachments();
519   -}
520   -
521   -void
522   -ArgParser::argShowAttachment(char* parameter)
523   -{
524   - // QXXXQ @TRIVIAL
525   - jc.showAttachment(parameter);
526   -}
527   -
528   -void
529   -ArgParser::argRemoveAttachment(char* parameter)
530   -{
531   - // QXXXQ @TRIVIAL
532   - jc.removeAttachment(parameter);
533   -}
534   -
535   -void
536 445 ArgParser::argAddAttachment()
537 446 {
538 447 o.attachments_to_add.push_back(QPDFJob::AddAttachment());
... ... @@ -571,27 +480,6 @@ ArgParser::argStreamData(char* parameter)
571 480 }
572 481  
573 482 void
574   -ArgParser::argCompressStreams(char* parameter)
575   -{
576   - // QXXXQ @TRIVIAL
577   - jc.compressStreams(parameter);
578   -}
579   -
580   -void
581   -ArgParser::argRecompressFlate()
582   -{
583   - // QXXXQ @TRIVIAL
584   - jc.recompressFlate();
585   -}
586   -
587   -void
588   -ArgParser::argCompressionLevel(char* parameter)
589   -{
590   - // QXXXQ @TRIVIAL
591   - jc.compressionLevel(parameter);
592   -}
593   -
594   -void
595 483 ArgParser::argDecodeLevel(char* parameter)
596 484 {
597 485 o.decode_level_set = true;
... ... @@ -620,20 +508,6 @@ ArgParser::argDecodeLevel(char* parameter)
620 508 }
621 509  
622 510 void
623   -ArgParser::argNormalizeContent(char* parameter)
624   -{
625   - // QXXXQ @TRIVIAL
626   - jc.normalizeContent(parameter);
627   -}
628   -
629   -void
630   -ArgParser::argSuppressRecovery()
631   -{
632   - // QXXXQ @TRIVIAL
633   - jc.suppressRecovery();
634   -}
635   -
636   -void
637 511 ArgParser::argObjectStreams(char* parameter)
638 512 {
639 513 o.object_stream_set = true;
... ... @@ -658,34 +532,6 @@ ArgParser::argObjectStreams(char* parameter)
658 532 }
659 533  
660 534 void
661   -ArgParser::argIgnoreXrefStreams()
662   -{
663   - // QXXXQ @TRIVIAL
664   - jc.ignoreXrefStreams();
665   -}
666   -
667   -void
668   -ArgParser::argQdf()
669   -{
670   - // QXXXQ @TRIVIAL
671   - jc.qdf();
672   -}
673   -
674   -void
675   -ArgParser::argPreserveUnreferenced()
676   -{
677   - // QXXXQ @TRIVIAL
678   - jc.preserveUnreferenced();
679   -}
680   -
681   -void
682   -ArgParser::argPreserveUnreferencedResources()
683   -{
684   - // QXXXQ @TRIVIAL
685   - jc.preserveUnreferencedResources();
686   -}
687   -
688   -void
689 535 ArgParser::argRemoveUnreferencedResources(char* parameter)
690 536 {
691 537 if (strcmp(parameter, "auto") == 0)
... ... @@ -709,167 +555,6 @@ ArgParser::argRemoveUnreferencedResources(char* parameter)
709 555 }
710 556  
711 557 void
712   -ArgParser::argKeepFilesOpen(char* parameter)
713   -{
714   - // QXXXQ @TRIVIAL
715   - jc.keepFilesOpen(parameter);
716   -}
717   -
718   -void
719   -ArgParser::argKeepFilesOpenThreshold(char* parameter)
720   -{
721   - // QXXXQ @TRIVIAL
722   - jc.keepFilesOpenThreshold(parameter);
723   -}
724   -
725   -void
726   -ArgParser::argNewlineBeforeEndstream()
727   -{
728   - // QXXXQ @TRIVIAL
729   - jc.newlineBeforeEndstream();
730   -}
731   -
732   -void
733   -ArgParser::argLinearizePass1(char* parameter)
734   -{
735   - // QXXXQ @TRIVIAL
736   - jc.linearizePass1(parameter);
737   -}
738   -
739   -void
740   -ArgParser::argCoalesceContents()
741   -{
742   - // QXXXQ @TRIVIAL
743   - jc.coalesceContents();
744   -}
745   -
746   -void
747   -ArgParser::argFlattenAnnotations(char* parameter)
748   -{
749   - // QXXXQ @TRIVIAL
750   - jc.flattenAnnotations(parameter);
751   -}
752   -
753   -void
754   -ArgParser::argGenerateAppearances()
755   -{
756   - // QXXXQ @TRIVIAL
757   - jc.generateAppearances();
758   -}
759   -
760   -void
761   -ArgParser::argMinVersion(char* parameter)
762   -{
763   - // QXXXQ @TRIVIAL
764   - jc.minVersion(parameter);
765   -}
766   -
767   -void
768   -ArgParser::argForceVersion(char* parameter)
769   -{
770   - // QXXXQ @TRIVIAL
771   - jc.forceVersion(parameter);
772   -}
773   -
774   -void
775   -ArgParser::argSplitPages(char* parameter)
776   -{
777   - // QXXXQ @TRIVIAL
778   - jc.splitPages(parameter);
779   -}
780   -
781   -void
782   -ArgParser::argVerbose()
783   -{
784   - // QXXXQ @TRIVIAL
785   - jc.verbose();
786   -}
787   -
788   -void
789   -ArgParser::argProgress()
790   -{
791   - // QXXXQ @TRIVIAL
792   - jc.progress();
793   -}
794   -
795   -void
796   -ArgParser::argNoWarn()
797   -{
798   - // QXXXQ @TRIVIAL
799   - jc.noWarn();
800   -}
801   -
802   -void
803   -ArgParser::argWarningExit0()
804   -{
805   - // QXXXQ @TRIVIAL
806   - jc.warningExit0();
807   -}
808   -
809   -void
810   -ArgParser::argDeterministicId()
811   -{
812   - // QXXXQ @TRIVIAL
813   - jc.deterministicId();
814   -}
815   -
816   -void
817   -ArgParser::argStaticId()
818   -{
819   - // QXXXQ @TRIVIAL
820   - jc.staticId();
821   -}
822   -
823   -void
824   -ArgParser::argStaticAesIv()
825   -{
826   - // QXXXQ @TRIVIAL
827   - jc.staticAesIv();
828   -}
829   -
830   -void
831   -ArgParser::argNoOriginalObjectIds()
832   -{
833   - // QXXXQ @TRIVIAL
834   - jc.noOriginalObjectIds();
835   -}
836   -
837   -void
838   -ArgParser::argShowEncryption()
839   -{
840   - // QXXXQ @TRIVIAL
841   - jc.showEncryption();
842   -}
843   -
844   -void
845   -ArgParser::argShowEncryptionKey()
846   -{
847   - // QXXXQ @TRIVIAL
848   - jc.showEncryptionKey();
849   -}
850   -
851   -void
852   -ArgParser::argCheckLinearization()
853   -{
854   - // QXXXQ @TRIVIAL
855   - jc.checkLinearization();
856   -}
857   -
858   -void
859   -ArgParser::argShowLinearization()
860   -{
861   - // QXXXQ @TRIVIAL
862   - jc.showLinearization();
863   -}
864   -
865   -void
866   -ArgParser::argShowXref()
867   -{
868   - // QXXXQ @TRIVIAL
869   - jc.showXref();
870   -}
871   -
872   -void
873 558 ArgParser::argShowObject(char* parameter)
874 559 {
875 560 QPDFJob::parse_object_id(parameter, o.show_trailer, o.show_obj, o.show_gen);
... ... @@ -877,125 +562,6 @@ ArgParser::argShowObject(char* parameter)
877 562 }
878 563  
879 564 void
880   -ArgParser::argRawStreamData()
881   -{
882   - // QXXXQ @TRIVIAL
883   - jc.rawStreamData();
884   -}
885   -
886   -void
887   -ArgParser::argFilteredStreamData()
888   -{
889   - // QXXXQ @TRIVIAL
890   - jc.filteredStreamData();
891   -}
892   -
893   -void
894   -ArgParser::argShowNpages()
895   -{
896   - // QXXXQ @TRIVIAL
897   - jc.showNpages();
898   -}
899   -
900   -void
901   -ArgParser::argShowPages()
902   -{
903   - // QXXXQ @TRIVIAL
904   - jc.showPages();
905   -}
906   -
907   -void
908   -ArgParser::argWithImages()
909   -{
910   - // QXXXQ @TRIVIAL
911   - jc.withImages();
912   -}
913   -
914   -void
915   -ArgParser::argJson()
916   -{
917   - // QXXXQ @TRIVIAL
918   - jc.json();
919   -}
920   -
921   -void
922   -ArgParser::argJsonKey(char* parameter)
923   -{
924   - // QXXXQ @TRIVIAL
925   - jc.jsonKey(parameter);
926   -}
927   -
928   -void
929   -ArgParser::argJsonObject(char* parameter)
930   -{
931   - // QXXXQ @TRIVIAL
932   - jc.jsonObject(parameter);
933   -}
934   -
935   -void
936   -ArgParser::argCheck()
937   -{
938   - // QXXXQ @TRIVIAL
939   - jc.check();
940   -}
941   -
942   -void
943   -ArgParser::argOptimizeImages()
944   -{
945   - // QXXXQ @TRIVIAL
946   - jc.optimizeImages();
947   -}
948   -
949   -void
950   -ArgParser::argExternalizeInlineImages()
951   -{
952   - // QXXXQ @TRIVIAL
953   - jc.externalizeInlineImages();
954   -}
955   -
956   -void
957   -ArgParser::argKeepInlineImages()
958   -{
959   - // QXXXQ @TRIVIAL
960   - jc.keepInlineImages();
961   -}
962   -
963   -void
964   -ArgParser::argRemovePageLabels()
965   -{
966   - // QXXXQ @TRIVIAL
967   - jc.removePageLabels();
968   -}
969   -
970   -void
971   -ArgParser::argOiMinWidth(char* parameter)
972   -{
973   - // QXXXQ @TRIVIAL
974   - jc.oiMinWidth(parameter);
975   -}
976   -
977   -void
978   -ArgParser::argOiMinHeight(char* parameter)
979   -{
980   - // QXXXQ @TRIVIAL
981   - jc.oiMinHeight(parameter);
982   -}
983   -
984   -void
985   -ArgParser::argOiMinArea(char* parameter)
986   -{
987   - // QXXXQ @TRIVIAL
988   - jc.oiMinArea(parameter);
989   -}
990   -
991   -void
992   -ArgParser::argIiMinBytes(char* parameter)
993   -{
994   - // QXXXQ @TRIVIAL
995   - jc.iiMinBytes(parameter);
996   -}
997   -
998   -void
999 565 ArgParser::argEnc40Print(char* parameter)
1000 566 {
1001 567 o.r2_print = (strcmp(parameter, "y") == 0);
... ... @@ -1227,27 +793,6 @@ ArgParser::argEndUnderlayOverlay()
1227 793 }
1228 794  
1229 795 void
1230   -ArgParser::argReplaceInput()
1231   -{
1232   - // QXXXQ @TRIVIAL
1233   - jc.replaceInput();
1234   -}
1235   -
1236   -void
1237   -ArgParser::argIsEncrypted()
1238   -{
1239   - // QXXXQ @TRIVIAL
1240   - jc.isEncrypted();
1241   -}
1242   -
1243   -void
1244   -ArgParser::argRequiresPassword()
1245   -{
1246   - // QXXXQ @TRIVIAL
1247   - jc.requiresPassword();
1248   -}
1249   -
1250   -void
1251 796 ArgParser::argAttPositional(char* arg)
1252 797 {
1253 798 o.attachments_to_add.back().path = arg;
... ...
libqpdf/qpdf/auto_job_decl.hh
... ... @@ -19,82 +19,17 @@ void argShowCrypto();
19 19 void argJobJsonHelp();
20 20 void argPositional(char*);
21 21 void argAddAttachment();
22   -void argAllowWeakCrypto();
23   -void argCheck();
24   -void argCheckLinearization();
25   -void argCoalesceContents();
26 22 void argCopyAttachmentsFrom();
27   -void argDecrypt();
28   -void argDeterministicId();
29   -void argEmpty();
30 23 void argEncrypt();
31   -void argExternalizeInlineImages();
32   -void argFilteredStreamData();
33   -void argFlattenRotation();
34   -void argGenerateAppearances();
35   -void argIgnoreXrefStreams();
36   -void argIsEncrypted();
37   -void argJson();
38   -void argKeepInlineImages();
39   -void argLinearize();
40   -void argListAttachments();
41   -void argNewlineBeforeEndstream();
42   -void argNoOriginalObjectIds();
43   -void argNoWarn();
44   -void argOptimizeImages();
45 24 void argOverlay();
46 25 void argPages();
47   -void argPasswordIsHexKey();
48   -void argPreserveUnreferenced();
49   -void argPreserveUnreferencedResources();
50   -void argProgress();
51   -void argQdf();
52   -void argRawStreamData();
53   -void argRecompressFlate();
54   -void argRemovePageLabels();
55   -void argReplaceInput();
56   -void argRequiresPassword();
57   -void argShowEncryption();
58   -void argShowEncryptionKey();
59   -void argShowLinearization();
60   -void argShowNpages();
61   -void argShowPages();
62   -void argShowXref();
63   -void argStaticAesIv();
64   -void argStaticId();
65   -void argSuppressPasswordRecovery();
66   -void argSuppressRecovery();
67 26 void argUnderlay();
68   -void argVerbose();
69   -void argWarningExit0();
70   -void argWithImages();
71   -void argCollate(char *);
72   -void argSplitPages(char *);
73   -void argCompressionLevel(char *);
74   -void argCopyEncryption(char *);
75   -void argEncryptionFilePassword(char *);
76   -void argForceVersion(char *);
77   -void argIiMinBytes(char *);
78 27 void argJobJsonFile(char *);
79   -void argJsonObject(char *);
80   -void argKeepFilesOpenThreshold(char *);
81   -void argLinearizePass1(char *);
82   -void argMinVersion(char *);
83   -void argOiMinArea(char *);
84   -void argOiMinHeight(char *);
85   -void argOiMinWidth(char *);
86 28 void argPassword(char *);
87 29 void argPasswordFile(char *);
88   -void argRemoveAttachment(char *);
89 30 void argRotate(char *);
90   -void argShowAttachment(char *);
91 31 void argShowObject(char *);
92   -void argCompressStreams(char *);
93 32 void argDecodeLevel(char *);
94   -void argFlattenAnnotations(char *);
95   -void argJsonKey(char *);
96   -void argKeepFilesOpen(char *);
97   -void argNormalizeContent(char *);
98 33 void argObjectStreams(char *);
99 34 void argPasswordMode(char *);
100 35 void argRemoveUnreferencedResources(char *);
... ...
libqpdf/qpdf/auto_job_init.hh
... ... @@ -30,82 +30,82 @@ this->ap.addBare("job-json-help", b(&ArgParser::argJobJsonHelp));
30 30 this->ap.selectMainOptionTable();
31 31 this->ap.addPositional(p(&ArgParser::argPositional));
32 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));
  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();});
37 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));
  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();});
41 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));
  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();});
56 56 this->ap.addBare("overlay", b(&ArgParser::argOverlay));
57 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));
  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();});
78 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");
  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");
89 89 this->ap.addRequiredParameter("job-json-file", p(&ArgParser::argJobJsonFile), "file");
90   -this->ap.addRequiredParameter("json-object", p(&ArgParser::argJsonObject), "trailer");
91   -this->ap.addRequiredParameter("keep-files-open-threshold", p(&ArgParser::argKeepFilesOpenThreshold), "count");
92   -this->ap.addRequiredParameter("linearize-pass1", p(&ArgParser::argLinearizePass1), "filename");
93   -this->ap.addRequiredParameter("min-version", p(&ArgParser::argMinVersion), "version");
94   -this->ap.addRequiredParameter("oi-min-area", p(&ArgParser::argOiMinArea), "minimum");
95   -this->ap.addRequiredParameter("oi-min-height", p(&ArgParser::argOiMinHeight), "minimum");
96   -this->ap.addRequiredParameter("oi-min-width", p(&ArgParser::argOiMinWidth), "minimum");
  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");
97 97 this->ap.addRequiredParameter("password", p(&ArgParser::argPassword), "password");
98 98 this->ap.addRequiredParameter("password-file", p(&ArgParser::argPasswordFile), "password");
99   -this->ap.addRequiredParameter("remove-attachment", p(&ArgParser::argRemoveAttachment), "attachment");
  99 +this->ap.addRequiredParameter("remove-attachment", [this](char *x){jc.removeAttachment(x);}, "attachment");
100 100 this->ap.addRequiredParameter("rotate", p(&ArgParser::argRotate), "[+|-]angle");
101   -this->ap.addRequiredParameter("show-attachment", p(&ArgParser::argShowAttachment), "attachment");
  101 +this->ap.addRequiredParameter("show-attachment", [this](char *x){jc.showAttachment(x);}, "attachment");
102 102 this->ap.addRequiredParameter("show-object", p(&ArgParser::argShowObject), "trailer");
103   -this->ap.addChoices("compress-streams", p(&ArgParser::argCompressStreams), true, yn_choices);
  103 +this->ap.addChoices("compress-streams", [this](char *x){jc.compressStreams(x);}, true, yn_choices);
104 104 this->ap.addChoices("decode-level", p(&ArgParser::argDecodeLevel), true, decode_level_choices);
105   -this->ap.addChoices("flatten-annotations", p(&ArgParser::argFlattenAnnotations), true, flatten_choices);
106   -this->ap.addChoices("json-key", p(&ArgParser::argJsonKey), true, json_key_choices);
107   -this->ap.addChoices("keep-files-open", p(&ArgParser::argKeepFilesOpen), true, yn_choices);
108   -this->ap.addChoices("normalize-content", p(&ArgParser::argNormalizeContent), true, yn_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);
109 109 this->ap.addChoices("object-streams", p(&ArgParser::argObjectStreams), true, object_streams_choices);
110 110 this->ap.addChoices("password-mode", p(&ArgParser::argPasswordMode), true, password_mode_choices);
111 111 this->ap.addChoices("remove-unreferenced-resources", p(&ArgParser::argRemoveUnreferencedResources), true, remove_unref_choices);
... ...