From c62ab2ee9f153aa623ed5ffab764f453941da4c7 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Wed, 26 Jan 2022 17:18:03 -0500 Subject: [PATCH] QPDFJob: use pointers instead of references for Config Why? The main methods that create them return smart pointers so that users can initialize them when needed, which you can't do with references. Returning pointers instead of references makes for a more uniform interface. --- generate_auto_job | 2 +- include/qpdf/QPDFJob.hh | 48 +-- include/qpdf/auto_job_c_att.hh | 14 +- include/qpdf/auto_job_c_copy_att.hh | 4 +- include/qpdf/auto_job_c_enc.hh | 26 +- include/qpdf/auto_job_c_main.hh | 146 +++---- include/qpdf/auto_job_c_uo.hh | 8 +- job.sums | 12 +- libqpdf/QPDFJob_config.cc | 584 ++++++++++++++-------------- 9 files changed, 422 insertions(+), 422 deletions(-) diff --git a/generate_auto_job b/generate_auto_job index 06fb6d25..d2aa2ba4 100755 --- a/generate_auto_job +++ b/generate_auto_job @@ -315,7 +315,7 @@ class Main: arg = '' if decl_arg: arg = 'char const* parameter' - fn = f'{config_prefix}& {identifier}({arg})' + fn = f'{config_prefix}* {identifier}({arg})' if fn not in self.declared_configs: self.declared_configs.add(fn) self.config_decls[cfg].append(f'QPDF_DLL {fn};') diff --git a/include/qpdf/QPDFJob.hh b/include/qpdf/QPDFJob.hh index 99199b89..4a1f205e 100644 --- a/include/qpdf/QPDFJob.hh +++ b/include/qpdf/QPDFJob.hh @@ -154,17 +154,17 @@ class QPDFJob friend class Config; public: QPDF_DLL - Config& endAddAttachment(); + Config* endAddAttachment(); QPDF_DLL - AttConfig& path(char const* parameter); + AttConfig* path(char const* parameter); # include private: - AttConfig(Config&); + AttConfig(Config*); AttConfig(AttConfig const&) = delete; - Config& config; + Config* config; AddAttachment att; }; @@ -174,17 +174,17 @@ class QPDFJob friend class Config; public: QPDF_DLL - Config& endCopyAttachmentsFrom(); + Config* endCopyAttachmentsFrom(); QPDF_DLL - CopyAttConfig& path(char const* parameter); + CopyAttConfig* path(char const* parameter); # include private: - CopyAttConfig(Config&); + CopyAttConfig(Config*); CopyAttConfig(CopyAttConfig const&) = delete; - Config& config; + Config* config; CopyAttachmentFrom caf; }; @@ -194,19 +194,19 @@ class QPDFJob friend class Config; public: QPDF_DLL - Config& endPages(); + Config* endPages(); QPDF_DLL - PagesConfig& pageSpec(std::string const& filename, + PagesConfig* pageSpec(std::string const& filename, std::string const& range, char const* password = nullptr); # include private: - PagesConfig(Config&); + PagesConfig(Config*); PagesConfig(PagesConfig const&) = delete; - Config& config; + Config* config; }; class UOConfig @@ -215,17 +215,17 @@ class QPDFJob friend class Config; public: QPDF_DLL - Config& endUnderlayOverlay(); + Config* endUnderlayOverlay(); QPDF_DLL - UOConfig& path(char const* parameter); + UOConfig* path(char const* parameter); # include private: - UOConfig(Config&); + UOConfig(Config*); UOConfig(PagesConfig const&) = delete; - Config& config; + Config* config; }; class EncConfig @@ -234,17 +234,17 @@ class QPDFJob friend class Config; public: QPDF_DLL - Config& endEncrypt(); + Config* endEncrypt(); QPDF_DLL - EncConfig& path(char const* parameter); + EncConfig* path(char const* parameter); # include private: - EncConfig(Config&); + EncConfig(Config*); EncConfig(PagesConfig const&) = delete; - Config& config; + Config* config; }; // Configuration is performed by calling methods XXX QXXXQ document @@ -253,13 +253,13 @@ class QPDFJob friend class QPDFJob; public: QPDF_DLL - Config& inputFile(char const* filename); + Config* inputFile(char const* filename); QPDF_DLL - Config& emptyInput(); + Config* emptyInput(); QPDF_DLL - Config& outputFile(char const* filename); + Config* outputFile(char const* filename); QPDF_DLL - Config& replaceInput(); + Config* replaceInput(); QPDF_DLL std::shared_ptr copyAttachmentsFrom(); diff --git a/include/qpdf/auto_job_c_att.hh b/include/qpdf/auto_job_c_att.hh index 156964a8..a65d8908 100644 --- a/include/qpdf/auto_job_c_att.hh +++ b/include/qpdf/auto_job_c_att.hh @@ -3,10 +3,10 @@ // Edits will be automatically overwritten if the build is // run in maintainer mode. // -QPDF_DLL AttConfig& replace(); -QPDF_DLL AttConfig& key(char const* parameter); -QPDF_DLL AttConfig& filename(char const* parameter); -QPDF_DLL AttConfig& creationdate(char const* parameter); -QPDF_DLL AttConfig& moddate(char const* parameter); -QPDF_DLL AttConfig& mimetype(char const* parameter); -QPDF_DLL AttConfig& description(char const* parameter); +QPDF_DLL AttConfig* replace(); +QPDF_DLL AttConfig* key(char const* parameter); +QPDF_DLL AttConfig* filename(char const* parameter); +QPDF_DLL AttConfig* creationdate(char const* parameter); +QPDF_DLL AttConfig* moddate(char const* parameter); +QPDF_DLL AttConfig* mimetype(char const* parameter); +QPDF_DLL AttConfig* description(char const* parameter); diff --git a/include/qpdf/auto_job_c_copy_att.hh b/include/qpdf/auto_job_c_copy_att.hh index bae11e9d..8049dc6d 100644 --- a/include/qpdf/auto_job_c_copy_att.hh +++ b/include/qpdf/auto_job_c_copy_att.hh @@ -3,5 +3,5 @@ // Edits will be automatically overwritten if the build is // run in maintainer mode. // -QPDF_DLL CopyAttConfig& prefix(char const* parameter); -QPDF_DLL CopyAttConfig& password(char const* parameter); +QPDF_DLL CopyAttConfig* prefix(char const* parameter); +QPDF_DLL CopyAttConfig* password(char const* parameter); diff --git a/include/qpdf/auto_job_c_enc.hh b/include/qpdf/auto_job_c_enc.hh index 8c84fc81..c5b10c6b 100644 --- a/include/qpdf/auto_job_c_enc.hh +++ b/include/qpdf/auto_job_c_enc.hh @@ -3,16 +3,16 @@ // Edits will be automatically overwritten if the build is // run in maintainer mode. // -QPDF_DLL EncConfig& extract(char const* parameter); -QPDF_DLL EncConfig& annotate(char const* parameter); -QPDF_DLL EncConfig& print(char const* parameter); -QPDF_DLL EncConfig& modify(char const* parameter); -QPDF_DLL EncConfig& cleartextMetadata(); -QPDF_DLL EncConfig& forceV4(); -QPDF_DLL EncConfig& accessibility(char const* parameter); -QPDF_DLL EncConfig& assemble(char const* parameter); -QPDF_DLL EncConfig& form(char const* parameter); -QPDF_DLL EncConfig& modifyOther(char const* parameter); -QPDF_DLL EncConfig& useAes(char const* parameter); -QPDF_DLL EncConfig& forceR5(); -QPDF_DLL EncConfig& allowInsecure(); +QPDF_DLL EncConfig* extract(char const* parameter); +QPDF_DLL EncConfig* annotate(char const* parameter); +QPDF_DLL EncConfig* print(char const* parameter); +QPDF_DLL EncConfig* modify(char const* parameter); +QPDF_DLL EncConfig* cleartextMetadata(); +QPDF_DLL EncConfig* forceV4(); +QPDF_DLL EncConfig* accessibility(char const* parameter); +QPDF_DLL EncConfig* assemble(char const* parameter); +QPDF_DLL EncConfig* form(char const* parameter); +QPDF_DLL EncConfig* modifyOther(char const* parameter); +QPDF_DLL EncConfig* useAes(char const* parameter); +QPDF_DLL EncConfig* forceR5(); +QPDF_DLL EncConfig* allowInsecure(); diff --git a/include/qpdf/auto_job_c_main.hh b/include/qpdf/auto_job_c_main.hh index 3e6bdf69..3ebc8c7e 100644 --- a/include/qpdf/auto_job_c_main.hh +++ b/include/qpdf/auto_job_c_main.hh @@ -3,76 +3,76 @@ // Edits will be automatically overwritten if the build is // run in maintainer mode. // -QPDF_DLL Config& allowWeakCrypto(); -QPDF_DLL Config& check(); -QPDF_DLL Config& checkLinearization(); -QPDF_DLL Config& coalesceContents(); -QPDF_DLL Config& decrypt(); -QPDF_DLL Config& deterministicId(); -QPDF_DLL Config& externalizeInlineImages(); -QPDF_DLL Config& filteredStreamData(); -QPDF_DLL Config& flattenRotation(); -QPDF_DLL Config& generateAppearances(); -QPDF_DLL Config& ignoreXrefStreams(); -QPDF_DLL Config& isEncrypted(); -QPDF_DLL Config& json(); -QPDF_DLL Config& keepInlineImages(); -QPDF_DLL Config& linearize(); -QPDF_DLL Config& listAttachments(); -QPDF_DLL Config& newlineBeforeEndstream(); -QPDF_DLL Config& noOriginalObjectIds(); -QPDF_DLL Config& noWarn(); -QPDF_DLL Config& optimizeImages(); -QPDF_DLL Config& passwordIsHexKey(); -QPDF_DLL Config& preserveUnreferenced(); -QPDF_DLL Config& preserveUnreferencedResources(); -QPDF_DLL Config& progress(); -QPDF_DLL Config& qdf(); -QPDF_DLL Config& rawStreamData(); -QPDF_DLL Config& recompressFlate(); -QPDF_DLL Config& removePageLabels(); -QPDF_DLL Config& requiresPassword(); -QPDF_DLL Config& showEncryption(); -QPDF_DLL Config& showEncryptionKey(); -QPDF_DLL Config& showLinearization(); -QPDF_DLL Config& showNpages(); -QPDF_DLL Config& showPages(); -QPDF_DLL Config& showXref(); -QPDF_DLL Config& staticAesIv(); -QPDF_DLL Config& staticId(); -QPDF_DLL Config& suppressPasswordRecovery(); -QPDF_DLL Config& suppressRecovery(); -QPDF_DLL Config& verbose(); -QPDF_DLL Config& warningExit0(); -QPDF_DLL Config& withImages(); -QPDF_DLL Config& collate(char const* parameter); -QPDF_DLL Config& splitPages(char const* parameter); -QPDF_DLL Config& compressionLevel(char const* parameter); -QPDF_DLL Config& copyEncryption(char const* parameter); -QPDF_DLL Config& encryptionFilePassword(char const* parameter); -QPDF_DLL Config& forceVersion(char const* parameter); -QPDF_DLL Config& iiMinBytes(char const* parameter); -QPDF_DLL Config& jobJsonFile(char const* parameter); -QPDF_DLL Config& jsonObject(char const* parameter); -QPDF_DLL Config& keepFilesOpenThreshold(char const* parameter); -QPDF_DLL Config& linearizePass1(char const* parameter); -QPDF_DLL Config& minVersion(char const* parameter); -QPDF_DLL Config& oiMinArea(char const* parameter); -QPDF_DLL Config& oiMinHeight(char const* parameter); -QPDF_DLL Config& oiMinWidth(char const* parameter); -QPDF_DLL Config& password(char const* parameter); -QPDF_DLL Config& passwordFile(char const* parameter); -QPDF_DLL Config& removeAttachment(char const* parameter); -QPDF_DLL Config& rotate(char const* parameter); -QPDF_DLL Config& showAttachment(char const* parameter); -QPDF_DLL Config& showObject(char const* parameter); -QPDF_DLL Config& compressStreams(char const* parameter); -QPDF_DLL Config& decodeLevel(char const* parameter); -QPDF_DLL Config& flattenAnnotations(char const* parameter); -QPDF_DLL Config& jsonKey(char const* parameter); -QPDF_DLL Config& keepFilesOpen(char const* parameter); -QPDF_DLL Config& normalizeContent(char const* parameter); -QPDF_DLL Config& objectStreams(char const* parameter); -QPDF_DLL Config& passwordMode(char const* parameter); -QPDF_DLL Config& removeUnreferencedResources(char const* parameter); -QPDF_DLL Config& streamData(char const* parameter); +QPDF_DLL Config* allowWeakCrypto(); +QPDF_DLL Config* check(); +QPDF_DLL Config* checkLinearization(); +QPDF_DLL Config* coalesceContents(); +QPDF_DLL Config* decrypt(); +QPDF_DLL Config* deterministicId(); +QPDF_DLL Config* externalizeInlineImages(); +QPDF_DLL Config* filteredStreamData(); +QPDF_DLL Config* flattenRotation(); +QPDF_DLL Config* generateAppearances(); +QPDF_DLL Config* ignoreXrefStreams(); +QPDF_DLL Config* isEncrypted(); +QPDF_DLL Config* json(); +QPDF_DLL Config* keepInlineImages(); +QPDF_DLL Config* linearize(); +QPDF_DLL Config* listAttachments(); +QPDF_DLL Config* newlineBeforeEndstream(); +QPDF_DLL Config* noOriginalObjectIds(); +QPDF_DLL Config* noWarn(); +QPDF_DLL Config* optimizeImages(); +QPDF_DLL Config* passwordIsHexKey(); +QPDF_DLL Config* preserveUnreferenced(); +QPDF_DLL Config* preserveUnreferencedResources(); +QPDF_DLL Config* progress(); +QPDF_DLL Config* qdf(); +QPDF_DLL Config* rawStreamData(); +QPDF_DLL Config* recompressFlate(); +QPDF_DLL Config* removePageLabels(); +QPDF_DLL Config* requiresPassword(); +QPDF_DLL Config* showEncryption(); +QPDF_DLL Config* showEncryptionKey(); +QPDF_DLL Config* showLinearization(); +QPDF_DLL Config* showNpages(); +QPDF_DLL Config* showPages(); +QPDF_DLL Config* showXref(); +QPDF_DLL Config* staticAesIv(); +QPDF_DLL Config* staticId(); +QPDF_DLL Config* suppressPasswordRecovery(); +QPDF_DLL Config* suppressRecovery(); +QPDF_DLL Config* verbose(); +QPDF_DLL Config* warningExit0(); +QPDF_DLL Config* withImages(); +QPDF_DLL Config* collate(char const* parameter); +QPDF_DLL Config* splitPages(char const* parameter); +QPDF_DLL Config* compressionLevel(char const* parameter); +QPDF_DLL Config* copyEncryption(char const* parameter); +QPDF_DLL Config* encryptionFilePassword(char const* parameter); +QPDF_DLL Config* forceVersion(char const* parameter); +QPDF_DLL Config* iiMinBytes(char const* parameter); +QPDF_DLL Config* jobJsonFile(char const* parameter); +QPDF_DLL Config* jsonObject(char const* parameter); +QPDF_DLL Config* keepFilesOpenThreshold(char const* parameter); +QPDF_DLL Config* linearizePass1(char const* parameter); +QPDF_DLL Config* minVersion(char const* parameter); +QPDF_DLL Config* oiMinArea(char const* parameter); +QPDF_DLL Config* oiMinHeight(char const* parameter); +QPDF_DLL Config* oiMinWidth(char const* parameter); +QPDF_DLL Config* password(char const* parameter); +QPDF_DLL Config* passwordFile(char const* parameter); +QPDF_DLL Config* removeAttachment(char const* parameter); +QPDF_DLL Config* rotate(char const* parameter); +QPDF_DLL Config* showAttachment(char const* parameter); +QPDF_DLL Config* showObject(char const* parameter); +QPDF_DLL Config* compressStreams(char const* parameter); +QPDF_DLL Config* decodeLevel(char const* parameter); +QPDF_DLL Config* flattenAnnotations(char const* parameter); +QPDF_DLL Config* jsonKey(char const* parameter); +QPDF_DLL Config* keepFilesOpen(char const* parameter); +QPDF_DLL Config* normalizeContent(char const* parameter); +QPDF_DLL Config* objectStreams(char const* parameter); +QPDF_DLL Config* passwordMode(char const* parameter); +QPDF_DLL Config* removeUnreferencedResources(char const* parameter); +QPDF_DLL Config* streamData(char const* parameter); diff --git a/include/qpdf/auto_job_c_uo.hh b/include/qpdf/auto_job_c_uo.hh index 4e4afd49..a02cd1f8 100644 --- a/include/qpdf/auto_job_c_uo.hh +++ b/include/qpdf/auto_job_c_uo.hh @@ -3,7 +3,7 @@ // Edits will be automatically overwritten if the build is // run in maintainer mode. // -QPDF_DLL UOConfig& to(char const* parameter); -QPDF_DLL UOConfig& from(char const* parameter); -QPDF_DLL UOConfig& repeat(char const* parameter); -QPDF_DLL UOConfig& password(char const* parameter); +QPDF_DLL UOConfig* to(char const* parameter); +QPDF_DLL UOConfig* from(char const* parameter); +QPDF_DLL UOConfig* repeat(char const* parameter); +QPDF_DLL UOConfig* password(char const* parameter); diff --git a/job.sums b/job.sums index 08753eb3..9e2a48c9 100644 --- a/job.sums +++ b/job.sums @@ -1,11 +1,11 @@ # Generated by generate_auto_job -generate_auto_job 3108658e47e17655e761842cd76bab48fdaf5e9792942c8bf1ca03f6f1934809 -include/qpdf/auto_job_c_att.hh 9d21a86169938a187c55e56e1ef915cd4211d13745c21d85c5c06306fd8ed023 -include/qpdf/auto_job_c_copy_att.hh d954c29ca74ef2e3abf0a0d99446bb974585700750fad8cee31340cbf2304a94 -include/qpdf/auto_job_c_enc.hh 7a64974ba970390f38bcea9c2471e620b92329c71eb7fa428ad0e09844007ca8 -include/qpdf/auto_job_c_main.hh e7f23e24ddbd16b5e7cb720c7da9ef76b89c2e23b5c4eecc5d8e10f0c0d60f4e +generate_auto_job e5c58868f4cb2c3ec1689bf44fb57cc57930f981f52fa4aa21d6b990a83f7163 +include/qpdf/auto_job_c_att.hh 7ad43bb374c1370ef32ebdcdcb7b73a61d281f7f4e3f12755585872ab30fb60e +include/qpdf/auto_job_c_copy_att.hh 32275d03cdc69b703dd7e02ba0bbe15756e714e9ad185484773a6178dc09e1ee +include/qpdf/auto_job_c_enc.hh 72e138c7b96ed5aacdce78c1dec04b1c20d361faec4f8faf52f64c1d6be99265 +include/qpdf/auto_job_c_main.hh 516adb23cc7e44e614e436880be870d0574e4ebbc706cd855a1360000eed31bb include/qpdf/auto_job_c_pages.hh 931840b329a36ca0e41401190e04537b47f2867671a6643bfd8da74014202671 -include/qpdf/auto_job_c_uo.hh 0fd370c70a1974197804f62c308ca2ec44727bf2f95a89cde48c4284823b6fbc +include/qpdf/auto_job_c_uo.hh 0585b7de459fa479d9e51a45fa92de0ff6dee748efc9ec1cedd0dde6cee1ad50 job.yml 1590fd16fd17ed40db9aa56b6713c844cfd61b3a6d0441a3ccd122b7371c68e9 libqpdf/qpdf/auto_job_decl.hh 9f79396ec459f191be4c5fe34cf88c265cf47355a1a945fa39169d1c94cf04f6 libqpdf/qpdf/auto_job_help.hh 383eea80e2c185ef5295fc126246457a7ceeffea759fdb90bb2e6727532ea538 diff --git a/libqpdf/QPDFJob_config.cc b/libqpdf/QPDFJob_config.cc index a13dee4b..74fff62d 100644 --- a/libqpdf/QPDFJob_config.cc +++ b/libqpdf/QPDFJob_config.cc @@ -8,7 +8,7 @@ static void usage(std::string const& msg) throw QPDFJob::ConfigError(msg); } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::inputFile(char const* filename) { if (o.m->infilename == 0) @@ -19,10 +19,10 @@ QPDFJob::Config::inputFile(char const* filename) { usage("input file has already been given"); } - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::emptyInput() { if (o.m->infilename == 0) @@ -42,10 +42,10 @@ QPDFJob::Config::emptyInput() usage("empty input can't be used" " since input file has already been given"); } - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::outputFile(char const* filename) { if ((o.m->outfilename == 0) && (! o.m->replace_input)) @@ -56,10 +56,10 @@ QPDFJob::Config::outputFile(char const* filename) { usage("output file has already been given"); } - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::replaceInput() { if ((o.m->outfilename == 0) && (! o.m->replace_input)) @@ -71,111 +71,111 @@ QPDFJob::Config::replaceInput() usage("replace-input can't be used" " since output file has already been given"); } - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::allowWeakCrypto() { o.m->allow_weak_crypto = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::check() { o.m->check = true; o.m->require_outfile = false; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::checkLinearization() { o.m->check_linearization = true; o.m->require_outfile = false; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::coalesceContents() { o.m->coalesce_contents = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::collate(char const* parameter) { auto n = ((parameter == 0) ? 1 : QUtil::string_to_uint(parameter)); o.m->collate = QIntC::to_size(n); - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::compressStreams(char const* parameter) { o.m->compress_streams_set = true; o.m->compress_streams = (strcmp(parameter, "y") == 0); - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::compressionLevel(char const* parameter) { o.m->compression_level = QUtil::string_to_int(parameter); - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::copyEncryption(char const* parameter) { o.m->encryption_file = parameter; o.m->copy_encryption = true; o.m->encrypt = false; o.m->decrypt = false; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::decrypt() { o.m->decrypt = true; o.m->encrypt = false; o.m->copy_encryption = false; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::deterministicId() { o.m->deterministic_id = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::encryptionFilePassword(char const* parameter) { o.m->encryption_file_password = QUtil::make_shared_cstr(parameter); - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::externalizeInlineImages() { o.m->externalize_inline_images = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::filteredStreamData() { o.m->show_filtered_stream_data = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::flattenAnnotations(char const* parameter) { o.m->flatten_annotations = true; @@ -187,375 +187,375 @@ QPDFJob::Config::flattenAnnotations(char const* parameter) { o.m->flatten_annotations_required |= an_print; } - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::flattenRotation() { o.m->flatten_rotation = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::forceVersion(char const* parameter) { o.m->force_version = parameter; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::generateAppearances() { o.m->generate_appearances = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::ignoreXrefStreams() { o.m->ignore_xref_streams = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::iiMinBytes(char const* parameter) { o.m->ii_min_bytes = QUtil::string_to_uint(parameter); - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::isEncrypted() { o.m->check_is_encrypted = true; o.m->require_outfile = false; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::json() { o.m->json = true; o.m->require_outfile = false; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::jsonKey(char const* parameter) { o.m->json_keys.insert(parameter); - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::jsonObject(char const* parameter) { o.m->json_objects.insert(parameter); - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::keepFilesOpen(char const* parameter) { o.m->keep_files_open_set = true; o.m->keep_files_open = (strcmp(parameter, "y") == 0); - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::keepFilesOpenThreshold(char const* parameter) { o.m->keep_files_open_threshold = QUtil::string_to_uint(parameter); - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::keepInlineImages() { o.m->keep_inline_images = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::linearize() { o.m->linearize = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::linearizePass1(char const* parameter) { o.m->linearize_pass1 = parameter; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::listAttachments() { o.m->list_attachments = true; o.m->require_outfile = false; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::minVersion(char const* parameter) { o.m->min_version = parameter; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::newlineBeforeEndstream() { o.m->newline_before_endstream = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::noOriginalObjectIds() { o.m->suppress_original_object_id = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::noWarn() { o.m->suppress_warnings = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::normalizeContent(char const* parameter) { o.m->normalize_set = true; o.m->normalize = (strcmp(parameter, "y") == 0); - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::oiMinArea(char const* parameter) { o.m->oi_min_area = QUtil::string_to_uint(parameter); - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::oiMinHeight(char const* parameter) { o.m->oi_min_height = QUtil::string_to_uint(parameter); - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::oiMinWidth(char const* parameter) { o.m->oi_min_width = QUtil::string_to_uint(parameter); - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::optimizeImages() { o.m->optimize_images = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::password(char const* parameter) { o.m->password = QUtil::make_shared_cstr(parameter); - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::passwordIsHexKey() { o.m->password_is_hex_key = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::preserveUnreferenced() { o.m->preserve_unreferenced_objects = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::preserveUnreferencedResources() { o.m->remove_unreferenced_page_resources = QPDFJob::re_no; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::progress() { o.m->progress = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::qdf() { o.m->qdf_mode = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::rawStreamData() { o.m->show_raw_stream_data = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::recompressFlate() { o.m->recompress_flate_set = true; o.m->recompress_flate = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::removeAttachment(char const* parameter) { o.m->attachments_to_remove.push_back(parameter); - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::removePageLabels() { o.m->remove_page_labels = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::requiresPassword() { o.m->check_requires_password = true; o.m->require_outfile = false; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::showAttachment(char const* parameter) { o.m->attachment_to_show = parameter; o.m->require_outfile = false; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::showEncryption() { o.m->show_encryption = true; o.m->require_outfile = false; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::showEncryptionKey() { o.m->show_encryption_key = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::showLinearization() { o.m->show_linearization = true; o.m->require_outfile = false; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::showNpages() { o.m->show_npages = true; o.m->require_outfile = false; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::showPages() { o.m->show_pages = true; o.m->require_outfile = false; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::showXref() { o.m->show_xref = true; o.m->require_outfile = false; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::splitPages(char const* parameter) { int n = ((parameter == 0) ? 1 : QUtil::string_to_int(parameter)); o.m->split_pages = n; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::staticAesIv() { o.m->static_aes_iv = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::staticId() { o.m->static_id = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::suppressPasswordRecovery() { o.m->suppress_password_recovery = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::suppressRecovery() { o.m->suppress_recovery = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::verbose() { o.m->verbose = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::warningExit0() { o.m->warnings_exit_zero = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::withImages() { o.m->show_page_images = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::passwordFile(char const* parameter) { std::list lines; @@ -580,10 +580,10 @@ QPDFJob::Config::passwordFile(char const* parameter) << " the password file are ignored" << std::endl; } } - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::passwordMode(char const* parameter) { if (strcmp(parameter, "bytes") == 0) @@ -606,10 +606,10 @@ QPDFJob::Config::passwordMode(char const* parameter) { usage("invalid password-mode option"); } - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::streamData(char const* parameter) { o.m->stream_data_set = true; @@ -631,10 +631,10 @@ QPDFJob::Config::streamData(char const* parameter) // ArgParser::initOptionTable is wrong. usage("invalid stream-data option"); } - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::decodeLevel(char const* parameter) { o.m->decode_level_set = true; @@ -660,10 +660,10 @@ QPDFJob::Config::decodeLevel(char const* parameter) // ArgParser::initOptionTable is wrong. usage("invalid option"); } - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::objectStreams(char const* parameter) { o.m->object_stream_set = true; @@ -685,10 +685,10 @@ QPDFJob::Config::objectStreams(char const* parameter) // ArgParser::initOptionTable is wrong. usage("invalid object stream mode"); } - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::removeUnreferencedResources(char const* parameter) { if (strcmp(parameter, "auto") == 0) @@ -709,19 +709,19 @@ QPDFJob::Config::removeUnreferencedResources(char const* parameter) // ArgParser::initOptionTable is wrong. usage("invalid value for --remove-unreferenced-page-resources"); } - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::showObject(char const* parameter) { QPDFJob::parse_object_id( parameter, o.m->show_trailer, o.m->show_obj, o.m->show_gen); o.m->require_outfile = false; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::jobJsonFile(char const* parameter) { PointerHolder file_buf; @@ -738,60 +738,60 @@ QPDFJob::Config::jobJsonFile(char const* parameter) e.what() + "\nRun " + this->o.m->message_prefix + "--job-json-help for information on the file format."); } - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::Config::rotate(char const* parameter) { o.parseRotationParameter(parameter); - return *this; + return this; } std::shared_ptr QPDFJob::Config::copyAttachmentsFrom() { - return std::shared_ptr(new CopyAttConfig(*this)); + return std::shared_ptr(new CopyAttConfig(this)); } -QPDFJob::CopyAttConfig::CopyAttConfig(Config& c) : +QPDFJob::CopyAttConfig::CopyAttConfig(Config* c) : config(c) { } -QPDFJob::CopyAttConfig& +QPDFJob::CopyAttConfig* QPDFJob::CopyAttConfig::path(char const* parameter) { this->caf.path = parameter; - return *this; + return this; } -QPDFJob::CopyAttConfig& +QPDFJob::CopyAttConfig* QPDFJob::CopyAttConfig::prefix(char const* parameter) { this->caf.prefix = parameter; - return *this; + return this; } -QPDFJob::CopyAttConfig& +QPDFJob::CopyAttConfig* QPDFJob::CopyAttConfig::password(char const* parameter) { this->caf.password = parameter; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::CopyAttConfig::endCopyAttachmentsFrom() { if (this->caf.path.empty()) { usage("copy attachments: no path specified"); } - this->config.o.m->attachments_to_copy.push_back(this->caf); + this->config->o.m->attachments_to_copy.push_back(this->caf); return this->config; } -QPDFJob::AttConfig::AttConfig(Config& c) : +QPDFJob::AttConfig::AttConfig(Config* c) : config(c) { } @@ -799,31 +799,31 @@ QPDFJob::AttConfig::AttConfig(Config& c) : std::shared_ptr QPDFJob::Config::addAttachment() { - return std::shared_ptr(new AttConfig(*this)); + return std::shared_ptr(new AttConfig(this)); } -QPDFJob::AttConfig& +QPDFJob::AttConfig* QPDFJob::AttConfig::path(char const* parameter) { this->att.path = parameter; - return *this; + return this; } -QPDFJob::AttConfig& +QPDFJob::AttConfig* QPDFJob::AttConfig::key(char const* parameter) { this->att.key = parameter; - return *this; + return this; } -QPDFJob::AttConfig& +QPDFJob::AttConfig* QPDFJob::AttConfig::filename(char const* parameter) { this->att.filename = parameter; - return *this; + return this; } -QPDFJob::AttConfig& +QPDFJob::AttConfig* QPDFJob::AttConfig::creationdate(char const* parameter) { if (! QUtil::pdf_time_to_qpdf_time(parameter)) @@ -831,10 +831,10 @@ QPDFJob::AttConfig::creationdate(char const* parameter) usage(std::string(parameter) + " is not a valid PDF timestamp"); } this->att.creationdate = parameter; - return *this; + return this; } -QPDFJob::AttConfig& +QPDFJob::AttConfig* QPDFJob::AttConfig::moddate(char const* parameter) { if (! QUtil::pdf_time_to_qpdf_time(parameter)) @@ -842,10 +842,10 @@ QPDFJob::AttConfig::moddate(char const* parameter) usage(std::string(parameter) + " is not a valid PDF timestamp"); } this->att.moddate = parameter; - return *this; + return this; } -QPDFJob::AttConfig& +QPDFJob::AttConfig* QPDFJob::AttConfig::mimetype(char const* parameter) { if (strchr(parameter, '/') == nullptr) @@ -853,24 +853,24 @@ QPDFJob::AttConfig::mimetype(char const* parameter) usage("mime type should be specified as type/subtype"); } this->att.mimetype = parameter; - return *this; + return this; } -QPDFJob::AttConfig& +QPDFJob::AttConfig* QPDFJob::AttConfig::description(char const* parameter) { this->att.description = parameter; - return *this; + return this; } -QPDFJob::AttConfig& +QPDFJob::AttConfig* QPDFJob::AttConfig::replace() { this->att.replace = true; - return *this; + return this; } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::AttConfig::endAddAttachment() { static std::string now = QUtil::qpdf_time_to_pdf_time( @@ -901,11 +901,11 @@ QPDFJob::AttConfig::endAddAttachment() this->att.moddate = now; } - this->config.o.m->attachments_to_add.push_back(this->att); + this->config->o.m->attachments_to_add.push_back(this->att); return this->config; } -QPDFJob::PagesConfig::PagesConfig(Config& c) : +QPDFJob::PagesConfig::PagesConfig(Config* c) : config(c) { } @@ -917,108 +917,108 @@ QPDFJob::Config::pages() { usage("--pages may only be specified one time"); } - return std::shared_ptr(new PagesConfig(*this)); + return std::shared_ptr(new PagesConfig(this)); } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::PagesConfig::endPages() { - if (this->config.o.m->page_specs.empty()) + if (this->config->o.m->page_specs.empty()) { usage("--pages: no page specifications given"); } return this->config; } -QPDFJob::PagesConfig& +QPDFJob::PagesConfig* QPDFJob::PagesConfig::pageSpec(std::string const& filename, std::string const& range, char const* password) { - this->config.o.m->page_specs.push_back( + this->config->o.m->page_specs.push_back( QPDFJob::PageSpec(filename, password, range)); - return *this; + return this; } std::shared_ptr QPDFJob::Config::overlay() { o.m->under_overlay = &o.m->overlay; - return std::shared_ptr(new UOConfig(*this)); + return std::shared_ptr(new UOConfig(this)); } std::shared_ptr QPDFJob::Config::underlay() { o.m->under_overlay = &o.m->underlay; - return std::shared_ptr(new UOConfig(*this)); + return std::shared_ptr(new UOConfig(this)); } -QPDFJob::UOConfig::UOConfig(Config& c) : +QPDFJob::UOConfig::UOConfig(Config* c) : config(c) { } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::UOConfig::endUnderlayOverlay() { - if (config.o.m->under_overlay->filename.empty()) + if (config->o.m->under_overlay->filename.empty()) { - usage(config.o.m->under_overlay->which + " file not specified"); + usage(config->o.m->under_overlay->which + " file not specified"); } - config.o.m->under_overlay = 0; + config->o.m->under_overlay = 0; return this->config; } -QPDFJob::UOConfig& +QPDFJob::UOConfig* QPDFJob::UOConfig::path(char const* parameter) { - if (! config.o.m->under_overlay->filename.empty()) + if (! config->o.m->under_overlay->filename.empty()) { - usage(config.o.m->under_overlay->which + " file already specified"); + usage(config->o.m->under_overlay->which + " file already specified"); } else { - config.o.m->under_overlay->filename = parameter; + config->o.m->under_overlay->filename = parameter; } - return *this; + return this; } -QPDFJob::UOConfig& +QPDFJob::UOConfig* QPDFJob::UOConfig::to(char const* parameter) { - config.o.parseNumrange(parameter, 0); - config.o.m->under_overlay->to_nr = parameter; - return *this; + config->o.parseNumrange(parameter, 0); + config->o.m->under_overlay->to_nr = parameter; + return this; } -QPDFJob::UOConfig& +QPDFJob::UOConfig* QPDFJob::UOConfig::from(char const* parameter) { if (strlen(parameter)) { - config.o.parseNumrange(parameter, 0); + config->o.parseNumrange(parameter, 0); } - config.o.m->under_overlay->from_nr = parameter; - return *this; + config->o.m->under_overlay->from_nr = parameter; + return this; } -QPDFJob::UOConfig& +QPDFJob::UOConfig* QPDFJob::UOConfig::repeat(char const* parameter) { if (strlen(parameter)) { - config.o.parseNumrange(parameter, 0); + config->o.parseNumrange(parameter, 0); } - config.o.m->under_overlay->repeat_nr = parameter; - return *this; + config->o.m->under_overlay->repeat_nr = parameter; + return this; } -QPDFJob::UOConfig& +QPDFJob::UOConfig* QPDFJob::UOConfig::password(char const* parameter) { - config.o.m->under_overlay->password = QUtil::make_shared_cstr(parameter); - return *this; + config->o.m->under_overlay->password = QUtil::make_shared_cstr(parameter); + return this; } std::shared_ptr @@ -1033,185 +1033,185 @@ QPDFJob::Config::encrypt(int keylen, } o.m->user_password = user_password; o.m->owner_password = owner_password; - return std::shared_ptr(new EncConfig(*this)); + return std::shared_ptr(new EncConfig(this)); } -QPDFJob::EncConfig::EncConfig(Config& c) : +QPDFJob::EncConfig::EncConfig(Config* c) : config(c) { } -QPDFJob::Config& +QPDFJob::Config* QPDFJob::EncConfig::endEncrypt() { - config.o.m->encrypt = true; - config.o.m->decrypt = false; - config.o.m->copy_encryption = false; + config->o.m->encrypt = true; + config->o.m->decrypt = false; + config->o.m->copy_encryption = false; return this->config; } -QPDFJob::EncConfig& +QPDFJob::EncConfig* QPDFJob::EncConfig::allowInsecure() { - config.o.m->allow_insecure = true; - return *this; + config->o.m->allow_insecure = true; + return this; } -QPDFJob::EncConfig& +QPDFJob::EncConfig* QPDFJob::EncConfig::accessibility(char const* parameter) { - config.o.m->r3_accessibility = (strcmp(parameter, "y") == 0); - return *this; + config->o.m->r3_accessibility = (strcmp(parameter, "y") == 0); + return this; } -QPDFJob::EncConfig& +QPDFJob::EncConfig* QPDFJob::EncConfig::extract(char const* parameter) { - if (config.o.m->keylen == 40) + if (config->o.m->keylen == 40) { - config.o.m->r2_extract = (strcmp(parameter, "y") == 0); + config->o.m->r2_extract = (strcmp(parameter, "y") == 0); } else { - config.o.m->r3_extract = (strcmp(parameter, "y") == 0); + config->o.m->r3_extract = (strcmp(parameter, "y") == 0); } - return *this; + return this; } -QPDFJob::EncConfig& +QPDFJob::EncConfig* QPDFJob::EncConfig::print(char const* parameter) { - if (config.o.m->keylen == 40) + if (config->o.m->keylen == 40) { - config.o.m->r2_print = (strcmp(parameter, "y") == 0); + config->o.m->r2_print = (strcmp(parameter, "y") == 0); } else if (strcmp(parameter, "full") == 0) { - config.o.m->r3_print = qpdf_r3p_full; + config->o.m->r3_print = qpdf_r3p_full; } else if (strcmp(parameter, "low") == 0) { - config.o.m->r3_print = qpdf_r3p_low; + config->o.m->r3_print = qpdf_r3p_low; } else if (strcmp(parameter, "none") == 0) { - config.o.m->r3_print = qpdf_r3p_none; + config->o.m->r3_print = qpdf_r3p_none; } else { usage("invalid print option"); } - return *this; + return this; } -QPDFJob::EncConfig& +QPDFJob::EncConfig* QPDFJob::EncConfig::modify(char const* parameter) { - if (config.o.m->keylen == 40) + if (config->o.m->keylen == 40) { - config.o.m->r2_modify = (strcmp(parameter, "y") == 0); + config->o.m->r2_modify = (strcmp(parameter, "y") == 0); } else if (strcmp(parameter, "all") == 0) { - config.o.m->r3_assemble = true; - config.o.m->r3_annotate_and_form = true; - config.o.m->r3_form_filling = true; - config.o.m->r3_modify_other = true; + config->o.m->r3_assemble = true; + config->o.m->r3_annotate_and_form = true; + config->o.m->r3_form_filling = true; + config->o.m->r3_modify_other = true; } else if (strcmp(parameter, "annotate") == 0) { - config.o.m->r3_assemble = true; - config.o.m->r3_annotate_and_form = true; - config.o.m->r3_form_filling = true; - config.o.m->r3_modify_other = false; + config->o.m->r3_assemble = true; + config->o.m->r3_annotate_and_form = true; + config->o.m->r3_form_filling = true; + config->o.m->r3_modify_other = false; } else if (strcmp(parameter, "form") == 0) { - config.o.m->r3_assemble = true; - config.o.m->r3_annotate_and_form = false; - config.o.m->r3_form_filling = true; - config.o.m->r3_modify_other = false; + config->o.m->r3_assemble = true; + config->o.m->r3_annotate_and_form = false; + config->o.m->r3_form_filling = true; + config->o.m->r3_modify_other = false; } else if (strcmp(parameter, "assembly") == 0) { - config.o.m->r3_assemble = true; - config.o.m->r3_annotate_and_form = false; - config.o.m->r3_form_filling = false; - config.o.m->r3_modify_other = false; + config->o.m->r3_assemble = true; + config->o.m->r3_annotate_and_form = false; + config->o.m->r3_form_filling = false; + config->o.m->r3_modify_other = false; } else if (strcmp(parameter, "none") == 0) { - config.o.m->r3_assemble = false; - config.o.m->r3_annotate_and_form = false; - config.o.m->r3_form_filling = false; - config.o.m->r3_modify_other = false; + config->o.m->r3_assemble = false; + config->o.m->r3_annotate_and_form = false; + config->o.m->r3_form_filling = false; + config->o.m->r3_modify_other = false; } else { usage("invalid modify option"); } - return *this; + return this; } -QPDFJob::EncConfig& +QPDFJob::EncConfig* QPDFJob::EncConfig::cleartextMetadata() { - config.o.m->cleartext_metadata = true; - return *this; + config->o.m->cleartext_metadata = true; + return this; } -QPDFJob::EncConfig& +QPDFJob::EncConfig* QPDFJob::EncConfig::assemble(char const* parameter) { - config.o.m->r3_assemble = (strcmp(parameter, "y") == 0); - return *this; + config->o.m->r3_assemble = (strcmp(parameter, "y") == 0); + return this; } -QPDFJob::EncConfig& +QPDFJob::EncConfig* QPDFJob::EncConfig::annotate(char const* parameter) { - if (config.o.m->keylen == 40) + if (config->o.m->keylen == 40) { - config.o.m->r2_annotate = (strcmp(parameter, "y") == 0); + config->o.m->r2_annotate = (strcmp(parameter, "y") == 0); } else { - config.o.m->r3_annotate_and_form = (strcmp(parameter, "y") == 0); + config->o.m->r3_annotate_and_form = (strcmp(parameter, "y") == 0); } - return *this; + return this; } -QPDFJob::EncConfig& +QPDFJob::EncConfig* QPDFJob::EncConfig::form(char const* parameter) { - config.o.m->r3_form_filling = (strcmp(parameter, "y") == 0); - return *this; + config->o.m->r3_form_filling = (strcmp(parameter, "y") == 0); + return this; } -QPDFJob::EncConfig& +QPDFJob::EncConfig* QPDFJob::EncConfig::modifyOther(char const* parameter) { - config.o.m->r3_modify_other = (strcmp(parameter, "y") == 0); - return *this; + config->o.m->r3_modify_other = (strcmp(parameter, "y") == 0); + return this; } -QPDFJob::EncConfig& +QPDFJob::EncConfig* QPDFJob::EncConfig::useAes(char const* parameter) { - config.o.m->use_aes = (strcmp(parameter, "y") == 0); - return *this; + config->o.m->use_aes = (strcmp(parameter, "y") == 0); + return this; } -QPDFJob::EncConfig& +QPDFJob::EncConfig* QPDFJob::EncConfig::forceV4() { - config.o.m->force_V4 = true; - return *this; + config->o.m->force_V4 = true; + return this; } -QPDFJob::EncConfig& +QPDFJob::EncConfig* QPDFJob::EncConfig::forceR5() { - config.o.m->force_R5 = true; - return *this; + config->o.m->force_R5 = true; + return this; }