Commit b4b0df0df98f44483215c4658f1697282080eebf

Authored by Jay Berkenbilt
1 parent 79187e58

QPDFJob: convert trivial functions to config API

include/qpdf/QPDFJob.hh
... ... @@ -105,8 +105,71 @@ class QPDFJob
105 105 {
106 106 friend class QPDFJob;
107 107 public:
108   - QPDF_DLL
109   - Config& verbose(bool);
  108 + QPDF_DLL Config& allowWeakCrypto();
  109 + QPDF_DLL Config& check();
  110 + QPDF_DLL Config& checkLinearization();
  111 + QPDF_DLL Config& coalesceContents();
  112 + QPDF_DLL Config& collate(char const* parameter);
  113 + QPDF_DLL Config& compressStreams(char const* parameter);
  114 + QPDF_DLL Config& compressionLevel(char const* parameter);
  115 + QPDF_DLL Config& copyEncryption(char const* parameter);
  116 + QPDF_DLL Config& decrypt();
  117 + QPDF_DLL Config& deterministicId();
  118 + QPDF_DLL Config& empty();
  119 + QPDF_DLL Config& encryptionFilePassword(char const* parameter);
  120 + QPDF_DLL Config& externalizeInlineImages();
  121 + QPDF_DLL Config& filteredStreamData();
  122 + QPDF_DLL Config& flattenAnnotations(char const* parameter);
  123 + QPDF_DLL Config& flattenRotation();
  124 + QPDF_DLL Config& forceVersion(char const* parameter);
  125 + QPDF_DLL Config& generateAppearances();
  126 + QPDF_DLL Config& ignoreXrefStreams();
  127 + QPDF_DLL Config& iiMinBytes(char const* parameter);
  128 + QPDF_DLL Config& isEncrypted();
  129 + QPDF_DLL Config& json();
  130 + QPDF_DLL Config& jsonKey(char const* parameter);
  131 + QPDF_DLL Config& jsonObject(char const* parameter);
  132 + QPDF_DLL Config& keepFilesOpen(char const* parameter);
  133 + QPDF_DLL Config& keepFilesOpenThreshold(char const* parameter);
  134 + QPDF_DLL Config& keepInlineImages();
  135 + QPDF_DLL Config& linearize();
  136 + QPDF_DLL Config& linearizePass1(char const* parameter);
  137 + QPDF_DLL Config& listAttachments();
  138 + QPDF_DLL Config& minVersion(char const* parameter);
  139 + QPDF_DLL Config& newlineBeforeEndstream();
  140 + QPDF_DLL Config& noOriginalObjectIds();
  141 + QPDF_DLL Config& noWarn();
  142 + QPDF_DLL Config& normalizeContent(char const* parameter);
  143 + QPDF_DLL Config& oiMinArea(char const* parameter);
  144 + QPDF_DLL Config& oiMinHeight(char const* parameter);
  145 + QPDF_DLL Config& oiMinWidth(char const* parameter);
  146 + QPDF_DLL Config& optimizeImages();
  147 + QPDF_DLL Config& passwordIsHexKey();
  148 + QPDF_DLL Config& preserveUnreferenced();
  149 + QPDF_DLL Config& preserveUnreferencedResources();
  150 + QPDF_DLL Config& progress();
  151 + QPDF_DLL Config& qdf();
  152 + QPDF_DLL Config& rawStreamData();
  153 + QPDF_DLL Config& recompressFlate();
  154 + QPDF_DLL Config& removeAttachment(char const* parameter);
  155 + QPDF_DLL Config& removePageLabels();
  156 + QPDF_DLL Config& replaceInput();
  157 + QPDF_DLL Config& requiresPassword();
  158 + QPDF_DLL Config& showAttachment(char const* parameter);
  159 + QPDF_DLL Config& showEncryption();
  160 + QPDF_DLL Config& showEncryptionKey();
  161 + QPDF_DLL Config& showLinearization();
  162 + QPDF_DLL Config& showNpages();
  163 + QPDF_DLL Config& showPages();
  164 + QPDF_DLL Config& showXref();
  165 + QPDF_DLL Config& splitPages(char const* parameter);
  166 + QPDF_DLL Config& staticAesIv();
  167 + QPDF_DLL Config& staticId();
  168 + QPDF_DLL Config& suppressPasswordRecovery();
  169 + QPDF_DLL Config& suppressRecovery();
  170 + QPDF_DLL Config& verbose();
  171 + QPDF_DLL Config& warningExit0();
  172 + QPDF_DLL Config& withImages();
110 173  
111 174 private:
112 175 Config() = delete;
... ...
libqpdf/QPDFJob_argv.cc
... ... @@ -219,14 +219,14 @@ void
219 219 ArgParser::argEmpty()
220 220 {
221 221 // QXXXQ @TRIVIAL
222   - o.infilename = QUtil::make_shared_cstr("");
  222 + jc.empty();
223 223 }
224 224  
225 225 void
226 226 ArgParser::argLinearize()
227 227 {
228 228 // QXXXQ @TRIVIAL
229   - o.linearize = true;
  229 + jc.linearize();
230 230 }
231 231  
232 232 void
... ... @@ -291,23 +291,21 @@ void
291 291 ArgParser::argDecrypt()
292 292 {
293 293 // QXXXQ @TRIVIAL
294   - o.decrypt = true;
295   - o.encrypt = false;
296   - o.copy_encryption = false;
  294 + jc.decrypt();
297 295 }
298 296  
299 297 void
300 298 ArgParser::argPasswordIsHexKey()
301 299 {
302 300 // QXXXQ @TRIVIAL
303   - o.password_is_hex_key = true;
  301 + jc.passwordIsHexKey();
304 302 }
305 303  
306 304 void
307 305 ArgParser::argSuppressPasswordRecovery()
308 306 {
309 307 // QXXXQ @TRIVIAL
310   - o.suppress_password_recovery = true;
  308 + jc.suppressPasswordRecovery();
311 309 }
312 310  
313 311 void
... ... @@ -345,33 +343,28 @@ void
345 343 ArgParser::argAllowWeakCrypto()
346 344 {
347 345 // QXXXQ @TRIVIAL
348   - o.allow_weak_crypto = true;
  346 + jc.allowWeakCrypto();
349 347 }
350 348  
351 349 void
352 350 ArgParser::argCopyEncryption(char* parameter)
353 351 {
354 352 // QXXXQ @TRIVIAL
355   - o.encryption_file = parameter;
356   - o.copy_encryption = true;
357   - o.encrypt = false;
358   - o.decrypt = false;
  353 + jc.copyEncryption(parameter);
359 354 }
360 355  
361 356 void
362 357 ArgParser::argEncryptionFilePassword(char* parameter)
363 358 {
364 359 // QXXXQ @TRIVIAL
365   - o.encryption_file_password = QUtil::make_shared_cstr(parameter);
  360 + jc.encryptionFilePassword(parameter);
366 361 }
367 362  
368 363 void
369 364 ArgParser::argCollate(char* parameter)
370 365 {
371 366 // QXXXQ @TRIVIAL
372   - auto n = ((parameter == 0) ? 1 :
373   - QUtil::string_to_uint(parameter));
374   - o.collate = QIntC::to_size(n);
  367 + jc.collate(parameter);
375 368 }
376 369  
377 370 void
... ... @@ -515,30 +508,28 @@ void
515 508 ArgParser::argFlattenRotation()
516 509 {
517 510 // QXXXQ @TRIVIAL
518   - o.flatten_rotation = true;
  511 + jc.flattenRotation();
519 512 }
520 513  
521 514 void
522 515 ArgParser::argListAttachments()
523 516 {
524 517 // QXXXQ @TRIVIAL
525   - o.list_attachments = true;
526   - o.require_outfile = false;
  518 + jc.listAttachments();
527 519 }
528 520  
529 521 void
530 522 ArgParser::argShowAttachment(char* parameter)
531 523 {
532 524 // QXXXQ @TRIVIAL
533   - o.attachment_to_show = parameter;
534   - o.require_outfile = false;
  525 + jc.showAttachment(parameter);
535 526 }
536 527  
537 528 void
538 529 ArgParser::argRemoveAttachment(char* parameter)
539 530 {
540 531 // QXXXQ @TRIVIAL
541   - o.attachments_to_remove.push_back(parameter);
  532 + jc.removeAttachment(parameter);
542 533 }
543 534  
544 535 void
... ... @@ -583,23 +574,21 @@ void
583 574 ArgParser::argCompressStreams(char* parameter)
584 575 {
585 576 // QXXXQ @TRIVIAL
586   - o.compress_streams_set = true;
587   - o.compress_streams = (strcmp(parameter, "y") == 0);
  577 + jc.compressStreams(parameter);
588 578 }
589 579  
590 580 void
591 581 ArgParser::argRecompressFlate()
592 582 {
593 583 // QXXXQ @TRIVIAL
594   - o.recompress_flate_set = true;
595   - o.recompress_flate = true;
  584 + jc.recompressFlate();
596 585 }
597 586  
598 587 void
599 588 ArgParser::argCompressionLevel(char* parameter)
600 589 {
601 590 // QXXXQ @TRIVIAL
602   - o.compression_level = QUtil::string_to_int(parameter);
  591 + jc.compressionLevel(parameter);
603 592 }
604 593  
605 594 void
... ... @@ -634,15 +623,14 @@ void
634 623 ArgParser::argNormalizeContent(char* parameter)
635 624 {
636 625 // QXXXQ @TRIVIAL
637   - o.normalize_set = true;
638   - o.normalize = (strcmp(parameter, "y") == 0);
  626 + jc.normalizeContent(parameter);
639 627 }
640 628  
641 629 void
642 630 ArgParser::argSuppressRecovery()
643 631 {
644 632 // QXXXQ @TRIVIAL
645   - o.suppress_recovery = true;
  633 + jc.suppressRecovery();
646 634 }
647 635  
648 636 void
... ... @@ -673,28 +661,28 @@ void
673 661 ArgParser::argIgnoreXrefStreams()
674 662 {
675 663 // QXXXQ @TRIVIAL
676   - o.ignore_xref_streams = true;
  664 + jc.ignoreXrefStreams();
677 665 }
678 666  
679 667 void
680 668 ArgParser::argQdf()
681 669 {
682 670 // QXXXQ @TRIVIAL
683   - o.qdf_mode = true;
  671 + jc.qdf();
684 672 }
685 673  
686 674 void
687 675 ArgParser::argPreserveUnreferenced()
688 676 {
689 677 // QXXXQ @TRIVIAL
690   - o.preserve_unreferenced_objects = true;
  678 + jc.preserveUnreferenced();
691 679 }
692 680  
693 681 void
694 682 ArgParser::argPreserveUnreferencedResources()
695 683 {
696 684 // QXXXQ @TRIVIAL
697   - o.remove_unreferenced_page_resources = QPDFJob::re_no;
  685 + jc.preserveUnreferencedResources();
698 686 }
699 687  
700 688 void
... ... @@ -724,176 +712,161 @@ void
724 712 ArgParser::argKeepFilesOpen(char* parameter)
725 713 {
726 714 // QXXXQ @TRIVIAL
727   - o.keep_files_open_set = true;
728   - o.keep_files_open = (strcmp(parameter, "y") == 0);
  715 + jc.keepFilesOpen(parameter);
729 716 }
730 717  
731 718 void
732 719 ArgParser::argKeepFilesOpenThreshold(char* parameter)
733 720 {
734 721 // QXXXQ @TRIVIAL
735   - o.keep_files_open_threshold = QUtil::string_to_uint(parameter);
  722 + jc.keepFilesOpenThreshold(parameter);
736 723 }
737 724  
738 725 void
739 726 ArgParser::argNewlineBeforeEndstream()
740 727 {
741 728 // QXXXQ @TRIVIAL
742   - o.newline_before_endstream = true;
  729 + jc.newlineBeforeEndstream();
743 730 }
744 731  
745 732 void
746 733 ArgParser::argLinearizePass1(char* parameter)
747 734 {
748 735 // QXXXQ @TRIVIAL
749   - o.linearize_pass1 = parameter;
  736 + jc.linearizePass1(parameter);
750 737 }
751 738  
752 739 void
753 740 ArgParser::argCoalesceContents()
754 741 {
755 742 // QXXXQ @TRIVIAL
756   - o.coalesce_contents = true;
  743 + jc.coalesceContents();
757 744 }
758 745  
759 746 void
760 747 ArgParser::argFlattenAnnotations(char* parameter)
761 748 {
762 749 // QXXXQ @TRIVIAL
763   - o.flatten_annotations = true;
764   - if (strcmp(parameter, "screen") == 0)
765   - {
766   - o.flatten_annotations_forbidden |= an_no_view;
767   - }
768   - else if (strcmp(parameter, "print") == 0)
769   - {
770   - o.flatten_annotations_required |= an_print;
771   - }
  750 + jc.flattenAnnotations(parameter);
772 751 }
773 752  
774 753 void
775 754 ArgParser::argGenerateAppearances()
776 755 {
777 756 // QXXXQ @TRIVIAL
778   - o.generate_appearances = true;
  757 + jc.generateAppearances();
779 758 }
780 759  
781 760 void
782 761 ArgParser::argMinVersion(char* parameter)
783 762 {
784 763 // QXXXQ @TRIVIAL
785   - o.min_version = parameter;
  764 + jc.minVersion(parameter);
786 765 }
787 766  
788 767 void
789 768 ArgParser::argForceVersion(char* parameter)
790 769 {
791 770 // QXXXQ @TRIVIAL
792   - o.force_version = parameter;
  771 + jc.forceVersion(parameter);
793 772 }
794 773  
795 774 void
796 775 ArgParser::argSplitPages(char* parameter)
797 776 {
798 777 // QXXXQ @TRIVIAL
799   - int n = ((parameter == 0) ? 1 :
800   - QUtil::string_to_int(parameter));
801   - o.split_pages = n;
  778 + jc.splitPages(parameter);
802 779 }
803 780  
804 781 void
805 782 ArgParser::argVerbose()
806 783 {
807 784 // QXXXQ @TRIVIAL
808   - jc.verbose(true);
  785 + jc.verbose();
809 786 }
810 787  
811 788 void
812 789 ArgParser::argProgress()
813 790 {
814 791 // QXXXQ @TRIVIAL
815   - o.progress = true;
  792 + jc.progress();
816 793 }
817 794  
818 795 void
819 796 ArgParser::argNoWarn()
820 797 {
821 798 // QXXXQ @TRIVIAL
822   - o.suppress_warnings = true;
  799 + jc.noWarn();
823 800 }
824 801  
825 802 void
826 803 ArgParser::argWarningExit0()
827 804 {
828 805 // QXXXQ @TRIVIAL
829   - o.warnings_exit_zero = true;
  806 + jc.warningExit0();
830 807 }
831 808  
832 809 void
833 810 ArgParser::argDeterministicId()
834 811 {
835 812 // QXXXQ @TRIVIAL
836   - o.deterministic_id = true;
  813 + jc.deterministicId();
837 814 }
838 815  
839 816 void
840 817 ArgParser::argStaticId()
841 818 {
842 819 // QXXXQ @TRIVIAL
843   - o.static_id = true;
  820 + jc.staticId();
844 821 }
845 822  
846 823 void
847 824 ArgParser::argStaticAesIv()
848 825 {
849 826 // QXXXQ @TRIVIAL
850   - o.static_aes_iv = true;
  827 + jc.staticAesIv();
851 828 }
852 829  
853 830 void
854 831 ArgParser::argNoOriginalObjectIds()
855 832 {
856 833 // QXXXQ @TRIVIAL
857   - o.suppress_original_object_id = true;
  834 + jc.noOriginalObjectIds();
858 835 }
859 836  
860 837 void
861 838 ArgParser::argShowEncryption()
862 839 {
863 840 // QXXXQ @TRIVIAL
864   - o.show_encryption = true;
865   - o.require_outfile = false;
  841 + jc.showEncryption();
866 842 }
867 843  
868 844 void
869 845 ArgParser::argShowEncryptionKey()
870 846 {
871 847 // QXXXQ @TRIVIAL
872   - o.show_encryption_key = true;
  848 + jc.showEncryptionKey();
873 849 }
874 850  
875 851 void
876 852 ArgParser::argCheckLinearization()
877 853 {
878 854 // QXXXQ @TRIVIAL
879   - o.check_linearization = true;
880   - o.require_outfile = false;
  855 + jc.checkLinearization();
881 856 }
882 857  
883 858 void
884 859 ArgParser::argShowLinearization()
885 860 {
886 861 // QXXXQ @TRIVIAL
887   - o.show_linearization = true;
888   - o.require_outfile = false;
  862 + jc.showLinearization();
889 863 }
890 864  
891 865 void
892 866 ArgParser::argShowXref()
893 867 {
894 868 // QXXXQ @TRIVIAL
895   - o.show_xref = true;
896   - o.require_outfile = false;
  869 + jc.showXref();
897 870 }
898 871  
899 872 void
... ... @@ -907,123 +880,119 @@ void
907 880 ArgParser::argRawStreamData()
908 881 {
909 882 // QXXXQ @TRIVIAL
910   - o.show_raw_stream_data = true;
  883 + jc.rawStreamData();
911 884 }
912 885  
913 886 void
914 887 ArgParser::argFilteredStreamData()
915 888 {
916 889 // QXXXQ @TRIVIAL
917   - o.show_filtered_stream_data = true;
  890 + jc.filteredStreamData();
918 891 }
919 892  
920 893 void
921 894 ArgParser::argShowNpages()
922 895 {
923 896 // QXXXQ @TRIVIAL
924   - o.show_npages = true;
925   - o.require_outfile = false;
  897 + jc.showNpages();
926 898 }
927 899  
928 900 void
929 901 ArgParser::argShowPages()
930 902 {
931 903 // QXXXQ @TRIVIAL
932   - o.show_pages = true;
933   - o.require_outfile = false;
  904 + jc.showPages();
934 905 }
935 906  
936 907 void
937 908 ArgParser::argWithImages()
938 909 {
939 910 // QXXXQ @TRIVIAL
940   - o.show_page_images = true;
  911 + jc.withImages();
941 912 }
942 913  
943 914 void
944 915 ArgParser::argJson()
945 916 {
946 917 // QXXXQ @TRIVIAL
947   - o.json = true;
948   - o.require_outfile = false;
  918 + jc.json();
949 919 }
950 920  
951 921 void
952 922 ArgParser::argJsonKey(char* parameter)
953 923 {
954 924 // QXXXQ @TRIVIAL
955   - o.json_keys.insert(parameter);
  925 + jc.jsonKey(parameter);
956 926 }
957 927  
958 928 void
959 929 ArgParser::argJsonObject(char* parameter)
960 930 {
961 931 // QXXXQ @TRIVIAL
962   - o.json_objects.insert(parameter);
  932 + jc.jsonObject(parameter);
963 933 }
964 934  
965 935 void
966 936 ArgParser::argCheck()
967 937 {
968 938 // QXXXQ @TRIVIAL
969   - o.check = true;
970   - o.require_outfile = false;
  939 + jc.check();
971 940 }
972 941  
973 942 void
974 943 ArgParser::argOptimizeImages()
975 944 {
976 945 // QXXXQ @TRIVIAL
977   - o.optimize_images = true;
  946 + jc.optimizeImages();
978 947 }
979 948  
980 949 void
981 950 ArgParser::argExternalizeInlineImages()
982 951 {
983 952 // QXXXQ @TRIVIAL
984   - o.externalize_inline_images = true;
  953 + jc.externalizeInlineImages();
985 954 }
986 955  
987 956 void
988 957 ArgParser::argKeepInlineImages()
989 958 {
990 959 // QXXXQ @TRIVIAL
991   - o.keep_inline_images = true;
  960 + jc.keepInlineImages();
992 961 }
993 962  
994 963 void
995 964 ArgParser::argRemovePageLabels()
996 965 {
997 966 // QXXXQ @TRIVIAL
998   - o.remove_page_labels = true;
  967 + jc.removePageLabels();
999 968 }
1000 969  
1001 970 void
1002 971 ArgParser::argOiMinWidth(char* parameter)
1003 972 {
1004 973 // QXXXQ @TRIVIAL
1005   - o.oi_min_width = QUtil::string_to_uint(parameter);
  974 + jc.oiMinWidth(parameter);
1006 975 }
1007 976  
1008 977 void
1009 978 ArgParser::argOiMinHeight(char* parameter)
1010 979 {
1011 980 // QXXXQ @TRIVIAL
1012   - o.oi_min_height = QUtil::string_to_uint(parameter);
  981 + jc.oiMinHeight(parameter);
1013 982 }
1014 983  
1015 984 void
1016 985 ArgParser::argOiMinArea(char* parameter)
1017 986 {
1018 987 // QXXXQ @TRIVIAL
1019   - o.oi_min_area = QUtil::string_to_uint(parameter);
  988 + jc.oiMinArea(parameter);
1020 989 }
1021 990  
1022 991 void
1023 992 ArgParser::argIiMinBytes(char* parameter)
1024 993 {
1025 994 // QXXXQ @TRIVIAL
1026   - o.ii_min_bytes = QUtil::string_to_uint(parameter);
  995 + jc.iiMinBytes(parameter);
1027 996 }
1028 997  
1029 998 void
... ... @@ -1261,23 +1230,21 @@ void
1261 1230 ArgParser::argReplaceInput()
1262 1231 {
1263 1232 // QXXXQ @TRIVIAL
1264   - o.replace_input = true;
  1233 + jc.replaceInput();
1265 1234 }
1266 1235  
1267 1236 void
1268 1237 ArgParser::argIsEncrypted()
1269 1238 {
1270 1239 // QXXXQ @TRIVIAL
1271   - o.check_is_encrypted = true;
1272   - o.require_outfile = false;
  1240 + jc.isEncrypted();
1273 1241 }
1274 1242  
1275 1243 void
1276 1244 ArgParser::argRequiresPassword()
1277 1245 {
1278 1246 // QXXXQ @TRIVIAL
1279   - o.check_requires_password = true;
1280   - o.require_outfile = false;
  1247 + jc.requiresPassword();
1281 1248 }
1282 1249  
1283 1250 void
... ...
libqpdf/QPDFJob_config.cc
1 1 #include <qpdf/QPDFJob.hh>
  2 +#include <qpdf/QUtil.hh>
  3 +#include <cstring>
2 4  
3 5 QPDFJob::Config&
4   -QPDFJob::Config::verbose(bool)
  6 +QPDFJob::Config::allowWeakCrypto()
  7 +{
  8 + o.allow_weak_crypto = true;
  9 + return *this;
  10 +}
  11 +
  12 +QPDFJob::Config&
  13 +QPDFJob::Config::check()
  14 +{
  15 + o.check = true;
  16 + o.require_outfile = false;
  17 + return *this;
  18 +}
  19 +
  20 +QPDFJob::Config&
  21 +QPDFJob::Config::checkLinearization()
  22 +{
  23 + o.check_linearization = true;
  24 + o.require_outfile = false;
  25 + return *this;
  26 +}
  27 +
  28 +QPDFJob::Config&
  29 +QPDFJob::Config::coalesceContents()
  30 +{
  31 + o.coalesce_contents = true;
  32 + return *this;
  33 +}
  34 +
  35 +QPDFJob::Config&
  36 +QPDFJob::Config::collate(char const* parameter)
  37 +{
  38 + auto n = ((parameter == 0) ? 1 :
  39 + QUtil::string_to_uint(parameter));
  40 + o.collate = QIntC::to_size(n);
  41 + return *this;
  42 +}
  43 +
  44 +QPDFJob::Config&
  45 +QPDFJob::Config::compressStreams(char const* parameter)
  46 +{
  47 + o.compress_streams_set = true;
  48 + o.compress_streams = (strcmp(parameter, "y") == 0);
  49 + return *this;
  50 +}
  51 +
  52 +QPDFJob::Config&
  53 +QPDFJob::Config::compressionLevel(char const* parameter)
  54 +{
  55 + o.compression_level = QUtil::string_to_int(parameter);
  56 + return *this;
  57 +}
  58 +
  59 +QPDFJob::Config&
  60 +QPDFJob::Config::copyEncryption(char const* parameter)
  61 +{
  62 + o.encryption_file = parameter;
  63 + o.copy_encryption = true;
  64 + o.encrypt = false;
  65 + o.decrypt = false;
  66 + return *this;
  67 +}
  68 +
  69 +QPDFJob::Config&
  70 +QPDFJob::Config::decrypt()
  71 +{
  72 + o.decrypt = true;
  73 + o.encrypt = false;
  74 + o.copy_encryption = false;
  75 + return *this;
  76 +}
  77 +
  78 +QPDFJob::Config&
  79 +QPDFJob::Config::deterministicId()
  80 +{
  81 + o.deterministic_id = true;
  82 + return *this;
  83 +}
  84 +
  85 +QPDFJob::Config&
  86 +QPDFJob::Config::empty()
  87 +{
  88 + o.infilename = QUtil::make_shared_cstr("");
  89 + return *this;
  90 +}
  91 +
  92 +QPDFJob::Config&
  93 +QPDFJob::Config::encryptionFilePassword(char const* parameter)
  94 +{
  95 + o.encryption_file_password = QUtil::make_shared_cstr(parameter);
  96 + return *this;
  97 +}
  98 +
  99 +QPDFJob::Config&
  100 +QPDFJob::Config::externalizeInlineImages()
  101 +{
  102 + o.externalize_inline_images = true;
  103 + return *this;
  104 +}
  105 +
  106 +QPDFJob::Config&
  107 +QPDFJob::Config::filteredStreamData()
  108 +{
  109 + o.show_filtered_stream_data = true;
  110 + return *this;
  111 +}
  112 +
  113 +QPDFJob::Config&
  114 +QPDFJob::Config::flattenAnnotations(char const* parameter)
  115 +{
  116 + o.flatten_annotations = true;
  117 + if (strcmp(parameter, "screen") == 0)
  118 + {
  119 + o.flatten_annotations_forbidden |= an_no_view;
  120 + }
  121 + else if (strcmp(parameter, "print") == 0)
  122 + {
  123 + o.flatten_annotations_required |= an_print;
  124 + }
  125 + return *this;
  126 +}
  127 +
  128 +QPDFJob::Config&
  129 +QPDFJob::Config::flattenRotation()
  130 +{
  131 + o.flatten_rotation = true;
  132 + return *this;
  133 +}
  134 +
  135 +QPDFJob::Config&
  136 +QPDFJob::Config::forceVersion(char const* parameter)
  137 +{
  138 + o.force_version = parameter;
  139 + return *this;
  140 +}
  141 +
  142 +QPDFJob::Config&
  143 +QPDFJob::Config::generateAppearances()
  144 +{
  145 + o.generate_appearances = true;
  146 + return *this;
  147 +}
  148 +
  149 +QPDFJob::Config&
  150 +QPDFJob::Config::ignoreXrefStreams()
  151 +{
  152 + o.ignore_xref_streams = true;
  153 + return *this;
  154 +}
  155 +
  156 +QPDFJob::Config&
  157 +QPDFJob::Config::iiMinBytes(char const* parameter)
  158 +{
  159 + o.ii_min_bytes = QUtil::string_to_uint(parameter);
  160 + return *this;
  161 +}
  162 +
  163 +QPDFJob::Config&
  164 +QPDFJob::Config::isEncrypted()
  165 +{
  166 + o.check_is_encrypted = true;
  167 + o.require_outfile = false;
  168 + return *this;
  169 +}
  170 +
  171 +QPDFJob::Config&
  172 +QPDFJob::Config::json()
  173 +{
  174 + o.json = true;
  175 + o.require_outfile = false;
  176 + return *this;
  177 +}
  178 +
  179 +QPDFJob::Config&
  180 +QPDFJob::Config::jsonKey(char const* parameter)
  181 +{
  182 + o.json_keys.insert(parameter);
  183 + return *this;
  184 +}
  185 +
  186 +QPDFJob::Config&
  187 +QPDFJob::Config::jsonObject(char const* parameter)
  188 +{
  189 + o.json_objects.insert(parameter);
  190 + return *this;
  191 +}
  192 +
  193 +QPDFJob::Config&
  194 +QPDFJob::Config::keepFilesOpen(char const* parameter)
  195 +{
  196 + o.keep_files_open_set = true;
  197 + o.keep_files_open = (strcmp(parameter, "y") == 0);
  198 + return *this;
  199 +}
  200 +
  201 +QPDFJob::Config&
  202 +QPDFJob::Config::keepFilesOpenThreshold(char const* parameter)
  203 +{
  204 + o.keep_files_open_threshold = QUtil::string_to_uint(parameter);
  205 + return *this;
  206 +}
  207 +
  208 +QPDFJob::Config&
  209 +QPDFJob::Config::keepInlineImages()
  210 +{
  211 + o.keep_inline_images = true;
  212 + return *this;
  213 +}
  214 +
  215 +QPDFJob::Config&
  216 +QPDFJob::Config::linearize()
  217 +{
  218 + o.linearize = true;
  219 + return *this;
  220 +}
  221 +
  222 +QPDFJob::Config&
  223 +QPDFJob::Config::linearizePass1(char const* parameter)
  224 +{
  225 + o.linearize_pass1 = parameter;
  226 + return *this;
  227 +}
  228 +
  229 +QPDFJob::Config&
  230 +QPDFJob::Config::listAttachments()
  231 +{
  232 + o.list_attachments = true;
  233 + o.require_outfile = false;
  234 + return *this;
  235 +}
  236 +
  237 +QPDFJob::Config&
  238 +QPDFJob::Config::minVersion(char const* parameter)
  239 +{
  240 + o.min_version = parameter;
  241 + return *this;
  242 +}
  243 +
  244 +QPDFJob::Config&
  245 +QPDFJob::Config::newlineBeforeEndstream()
  246 +{
  247 + o.newline_before_endstream = true;
  248 + return *this;
  249 +}
  250 +
  251 +QPDFJob::Config&
  252 +QPDFJob::Config::noOriginalObjectIds()
  253 +{
  254 + o.suppress_original_object_id = true;
  255 + return *this;
  256 +}
  257 +
  258 +QPDFJob::Config&
  259 +QPDFJob::Config::noWarn()
  260 +{
  261 + o.suppress_warnings = true;
  262 + return *this;
  263 +}
  264 +
  265 +QPDFJob::Config&
  266 +QPDFJob::Config::normalizeContent(char const* parameter)
  267 +{
  268 + o.normalize_set = true;
  269 + o.normalize = (strcmp(parameter, "y") == 0);
  270 + return *this;
  271 +}
  272 +
  273 +QPDFJob::Config&
  274 +QPDFJob::Config::oiMinArea(char const* parameter)
  275 +{
  276 + o.oi_min_area = QUtil::string_to_uint(parameter);
  277 + return *this;
  278 +}
  279 +
  280 +QPDFJob::Config&
  281 +QPDFJob::Config::oiMinHeight(char const* parameter)
  282 +{
  283 + o.oi_min_height = QUtil::string_to_uint(parameter);
  284 + return *this;
  285 +}
  286 +
  287 +QPDFJob::Config&
  288 +QPDFJob::Config::oiMinWidth(char const* parameter)
  289 +{
  290 + o.oi_min_width = QUtil::string_to_uint(parameter);
  291 + return *this;
  292 +}
  293 +
  294 +QPDFJob::Config&
  295 +QPDFJob::Config::optimizeImages()
  296 +{
  297 + o.optimize_images = true;
  298 + return *this;
  299 +}
  300 +
  301 +QPDFJob::Config&
  302 +QPDFJob::Config::passwordIsHexKey()
  303 +{
  304 + o.password_is_hex_key = true;
  305 + return *this;
  306 +}
  307 +
  308 +QPDFJob::Config&
  309 +QPDFJob::Config::preserveUnreferenced()
  310 +{
  311 + o.preserve_unreferenced_objects = true;
  312 + return *this;
  313 +}
  314 +
  315 +QPDFJob::Config&
  316 +QPDFJob::Config::preserveUnreferencedResources()
  317 +{
  318 + o.remove_unreferenced_page_resources = QPDFJob::re_no;
  319 + return *this;
  320 +}
  321 +
  322 +QPDFJob::Config&
  323 +QPDFJob::Config::progress()
  324 +{
  325 + o.progress = true;
  326 + return *this;
  327 +}
  328 +
  329 +QPDFJob::Config&
  330 +QPDFJob::Config::qdf()
  331 +{
  332 + o.qdf_mode = true;
  333 + return *this;
  334 +}
  335 +
  336 +QPDFJob::Config&
  337 +QPDFJob::Config::rawStreamData()
  338 +{
  339 + o.show_raw_stream_data = true;
  340 + return *this;
  341 +}
  342 +
  343 +QPDFJob::Config&
  344 +QPDFJob::Config::recompressFlate()
  345 +{
  346 + o.recompress_flate_set = true;
  347 + o.recompress_flate = true;
  348 + return *this;
  349 +}
  350 +
  351 +QPDFJob::Config&
  352 +QPDFJob::Config::removeAttachment(char const* parameter)
  353 +{
  354 + o.attachments_to_remove.push_back(parameter);
  355 + return *this;
  356 +}
  357 +
  358 +QPDFJob::Config&
  359 +QPDFJob::Config::removePageLabels()
  360 +{
  361 + o.remove_page_labels = true;
  362 + return *this;
  363 +}
  364 +
  365 +QPDFJob::Config&
  366 +QPDFJob::Config::replaceInput()
  367 +{
  368 + o.replace_input = true;
  369 + return *this;
  370 +}
  371 +
  372 +QPDFJob::Config&
  373 +QPDFJob::Config::requiresPassword()
  374 +{
  375 + o.check_requires_password = true;
  376 + o.require_outfile = false;
  377 + return *this;
  378 +}
  379 +
  380 +QPDFJob::Config&
  381 +QPDFJob::Config::showAttachment(char const* parameter)
  382 +{
  383 + o.attachment_to_show = parameter;
  384 + o.require_outfile = false;
  385 + return *this;
  386 +}
  387 +
  388 +QPDFJob::Config&
  389 +QPDFJob::Config::showEncryption()
  390 +{
  391 + o.show_encryption = true;
  392 + o.require_outfile = false;
  393 + return *this;
  394 +}
  395 +
  396 +QPDFJob::Config&
  397 +QPDFJob::Config::showEncryptionKey()
  398 +{
  399 + o.show_encryption_key = true;
  400 + return *this;
  401 +}
  402 +
  403 +QPDFJob::Config&
  404 +QPDFJob::Config::showLinearization()
  405 +{
  406 + o.show_linearization = true;
  407 + o.require_outfile = false;
  408 + return *this;
  409 +}
  410 +
  411 +QPDFJob::Config&
  412 +QPDFJob::Config::showNpages()
  413 +{
  414 + o.show_npages = true;
  415 + o.require_outfile = false;
  416 + return *this;
  417 +}
  418 +
  419 +QPDFJob::Config&
  420 +QPDFJob::Config::showPages()
  421 +{
  422 + o.show_pages = true;
  423 + o.require_outfile = false;
  424 + return *this;
  425 +}
  426 +
  427 +QPDFJob::Config&
  428 +QPDFJob::Config::showXref()
  429 +{
  430 + o.show_xref = true;
  431 + o.require_outfile = false;
  432 + return *this;
  433 +}
  434 +
  435 +QPDFJob::Config&
  436 +QPDFJob::Config::splitPages(char const* parameter)
  437 +{
  438 + int n = ((parameter == 0) ? 1 :
  439 + QUtil::string_to_int(parameter));
  440 + o.split_pages = n;
  441 + return *this;
  442 +}
  443 +
  444 +QPDFJob::Config&
  445 +QPDFJob::Config::staticAesIv()
  446 +{
  447 + o.static_aes_iv = true;
  448 + return *this;
  449 +}
  450 +
  451 +QPDFJob::Config&
  452 +QPDFJob::Config::staticId()
  453 +{
  454 + o.static_id = true;
  455 + return *this;
  456 +}
  457 +
  458 +QPDFJob::Config&
  459 +QPDFJob::Config::suppressPasswordRecovery()
  460 +{
  461 + o.suppress_password_recovery = true;
  462 + return *this;
  463 +}
  464 +
  465 +QPDFJob::Config&
  466 +QPDFJob::Config::suppressRecovery()
  467 +{
  468 + o.suppress_recovery = true;
  469 + return *this;
  470 +}
  471 +
  472 +QPDFJob::Config&
  473 +QPDFJob::Config::verbose()
5 474 {
6 475 o.m->verbose = true;
7 476 return *this;
8 477 }
  478 +
  479 +QPDFJob::Config&
  480 +QPDFJob::Config::warningExit0()
  481 +{
  482 + o.warnings_exit_zero = true;
  483 + return *this;
  484 +}
  485 +
  486 +QPDFJob::Config&
  487 +QPDFJob::Config::withImages()
  488 +{
  489 + o.show_page_images = true;
  490 + return *this;
  491 +}
... ...