Commit c62ab2ee9f153aa623ed5ffab764f453941da4c7

Authored by Jay Berkenbilt
1 parent 03f3369f

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
... ... @@ -315,7 +315,7 @@ class Main:
315 315 arg = ''
316 316 if decl_arg:
317 317 arg = 'char const* parameter'
318   - fn = f'{config_prefix}& {identifier}({arg})'
  318 + fn = f'{config_prefix}* {identifier}({arg})'
319 319 if fn not in self.declared_configs:
320 320 self.declared_configs.add(fn)
321 321 self.config_decls[cfg].append(f'QPDF_DLL {fn};')
... ...
include/qpdf/QPDFJob.hh
... ... @@ -154,17 +154,17 @@ class QPDFJob
154 154 friend class Config;
155 155 public:
156 156 QPDF_DLL
157   - Config& endAddAttachment();
  157 + Config* endAddAttachment();
158 158 QPDF_DLL
159   - AttConfig& path(char const* parameter);
  159 + AttConfig* path(char const* parameter);
160 160  
161 161 # include <qpdf/auto_job_c_att.hh>
162 162  
163 163 private:
164   - AttConfig(Config&);
  164 + AttConfig(Config*);
165 165 AttConfig(AttConfig const&) = delete;
166 166  
167   - Config& config;
  167 + Config* config;
168 168 AddAttachment att;
169 169 };
170 170  
... ... @@ -174,17 +174,17 @@ class QPDFJob
174 174 friend class Config;
175 175 public:
176 176 QPDF_DLL
177   - Config& endCopyAttachmentsFrom();
  177 + Config* endCopyAttachmentsFrom();
178 178 QPDF_DLL
179   - CopyAttConfig& path(char const* parameter);
  179 + CopyAttConfig* path(char const* parameter);
180 180  
181 181 # include <qpdf/auto_job_c_copy_att.hh>
182 182  
183 183 private:
184   - CopyAttConfig(Config&);
  184 + CopyAttConfig(Config*);
185 185 CopyAttConfig(CopyAttConfig const&) = delete;
186 186  
187   - Config& config;
  187 + Config* config;
188 188 CopyAttachmentFrom caf;
189 189 };
190 190  
... ... @@ -194,19 +194,19 @@ class QPDFJob
194 194 friend class Config;
195 195 public:
196 196 QPDF_DLL
197   - Config& endPages();
  197 + Config* endPages();
198 198 QPDF_DLL
199   - PagesConfig& pageSpec(std::string const& filename,
  199 + PagesConfig* pageSpec(std::string const& filename,
200 200 std::string const& range,
201 201 char const* password = nullptr);
202 202  
203 203 # include <qpdf/auto_job_c_pages.hh>
204 204  
205 205 private:
206   - PagesConfig(Config&);
  206 + PagesConfig(Config*);
207 207 PagesConfig(PagesConfig const&) = delete;
208 208  
209   - Config& config;
  209 + Config* config;
210 210 };
211 211  
212 212 class UOConfig
... ... @@ -215,17 +215,17 @@ class QPDFJob
215 215 friend class Config;
216 216 public:
217 217 QPDF_DLL
218   - Config& endUnderlayOverlay();
  218 + Config* endUnderlayOverlay();
219 219 QPDF_DLL
220   - UOConfig& path(char const* parameter);
  220 + UOConfig* path(char const* parameter);
221 221  
222 222 # include <qpdf/auto_job_c_uo.hh>
223 223  
224 224 private:
225   - UOConfig(Config&);
  225 + UOConfig(Config*);
226 226 UOConfig(PagesConfig const&) = delete;
227 227  
228   - Config& config;
  228 + Config* config;
229 229 };
230 230  
231 231 class EncConfig
... ... @@ -234,17 +234,17 @@ class QPDFJob
234 234 friend class Config;
235 235 public:
236 236 QPDF_DLL
237   - Config& endEncrypt();
  237 + Config* endEncrypt();
238 238 QPDF_DLL
239   - EncConfig& path(char const* parameter);
  239 + EncConfig* path(char const* parameter);
240 240  
241 241 # include <qpdf/auto_job_c_enc.hh>
242 242  
243 243 private:
244   - EncConfig(Config&);
  244 + EncConfig(Config*);
245 245 EncConfig(PagesConfig const&) = delete;
246 246  
247   - Config& config;
  247 + Config* config;
248 248 };
249 249  
250 250 // Configuration is performed by calling methods XXX QXXXQ document
... ... @@ -253,13 +253,13 @@ class QPDFJob
253 253 friend class QPDFJob;
254 254 public:
255 255 QPDF_DLL
256   - Config& inputFile(char const* filename);
  256 + Config* inputFile(char const* filename);
257 257 QPDF_DLL
258   - Config& emptyInput();
  258 + Config* emptyInput();
259 259 QPDF_DLL
260   - Config& outputFile(char const* filename);
  260 + Config* outputFile(char const* filename);
261 261 QPDF_DLL
262   - Config& replaceInput();
  262 + Config* replaceInput();
263 263  
264 264 QPDF_DLL
265 265 std::shared_ptr<CopyAttConfig> copyAttachmentsFrom();
... ...
include/qpdf/auto_job_c_att.hh
... ... @@ -3,10 +3,10 @@
3 3 // Edits will be automatically overwritten if the build is
4 4 // run in maintainer mode.
5 5 //
6   -QPDF_DLL AttConfig& replace();
7   -QPDF_DLL AttConfig& key(char const* parameter);
8   -QPDF_DLL AttConfig& filename(char const* parameter);
9   -QPDF_DLL AttConfig& creationdate(char const* parameter);
10   -QPDF_DLL AttConfig& moddate(char const* parameter);
11   -QPDF_DLL AttConfig& mimetype(char const* parameter);
12   -QPDF_DLL AttConfig& description(char const* parameter);
  6 +QPDF_DLL AttConfig* replace();
  7 +QPDF_DLL AttConfig* key(char const* parameter);
  8 +QPDF_DLL AttConfig* filename(char const* parameter);
  9 +QPDF_DLL AttConfig* creationdate(char const* parameter);
  10 +QPDF_DLL AttConfig* moddate(char const* parameter);
  11 +QPDF_DLL AttConfig* mimetype(char const* parameter);
  12 +QPDF_DLL AttConfig* description(char const* parameter);
... ...
include/qpdf/auto_job_c_copy_att.hh
... ... @@ -3,5 +3,5 @@
3 3 // Edits will be automatically overwritten if the build is
4 4 // run in maintainer mode.
5 5 //
6   -QPDF_DLL CopyAttConfig& prefix(char const* parameter);
7   -QPDF_DLL CopyAttConfig& password(char const* parameter);
  6 +QPDF_DLL CopyAttConfig* prefix(char const* parameter);
  7 +QPDF_DLL CopyAttConfig* password(char const* parameter);
... ...
include/qpdf/auto_job_c_enc.hh
... ... @@ -3,16 +3,16 @@
3 3 // Edits will be automatically overwritten if the build is
4 4 // run in maintainer mode.
5 5 //
6   -QPDF_DLL EncConfig& extract(char const* parameter);
7   -QPDF_DLL EncConfig& annotate(char const* parameter);
8   -QPDF_DLL EncConfig& print(char const* parameter);
9   -QPDF_DLL EncConfig& modify(char const* parameter);
10   -QPDF_DLL EncConfig& cleartextMetadata();
11   -QPDF_DLL EncConfig& forceV4();
12   -QPDF_DLL EncConfig& accessibility(char const* parameter);
13   -QPDF_DLL EncConfig& assemble(char const* parameter);
14   -QPDF_DLL EncConfig& form(char const* parameter);
15   -QPDF_DLL EncConfig& modifyOther(char const* parameter);
16   -QPDF_DLL EncConfig& useAes(char const* parameter);
17   -QPDF_DLL EncConfig& forceR5();
18   -QPDF_DLL EncConfig& allowInsecure();
  6 +QPDF_DLL EncConfig* extract(char const* parameter);
  7 +QPDF_DLL EncConfig* annotate(char const* parameter);
  8 +QPDF_DLL EncConfig* print(char const* parameter);
  9 +QPDF_DLL EncConfig* modify(char const* parameter);
  10 +QPDF_DLL EncConfig* cleartextMetadata();
  11 +QPDF_DLL EncConfig* forceV4();
  12 +QPDF_DLL EncConfig* accessibility(char const* parameter);
  13 +QPDF_DLL EncConfig* assemble(char const* parameter);
  14 +QPDF_DLL EncConfig* form(char const* parameter);
  15 +QPDF_DLL EncConfig* modifyOther(char const* parameter);
  16 +QPDF_DLL EncConfig* useAes(char const* parameter);
  17 +QPDF_DLL EncConfig* forceR5();
  18 +QPDF_DLL EncConfig* allowInsecure();
... ...
include/qpdf/auto_job_c_main.hh
... ... @@ -3,76 +3,76 @@
3 3 // Edits will be automatically overwritten if the build is
4 4 // run in maintainer mode.
5 5 //
6   -QPDF_DLL Config& allowWeakCrypto();
7   -QPDF_DLL Config& check();
8   -QPDF_DLL Config& checkLinearization();
9   -QPDF_DLL Config& coalesceContents();
10   -QPDF_DLL Config& decrypt();
11   -QPDF_DLL Config& deterministicId();
12   -QPDF_DLL Config& externalizeInlineImages();
13   -QPDF_DLL Config& filteredStreamData();
14   -QPDF_DLL Config& flattenRotation();
15   -QPDF_DLL Config& generateAppearances();
16   -QPDF_DLL Config& ignoreXrefStreams();
17   -QPDF_DLL Config& isEncrypted();
18   -QPDF_DLL Config& json();
19   -QPDF_DLL Config& keepInlineImages();
20   -QPDF_DLL Config& linearize();
21   -QPDF_DLL Config& listAttachments();
22   -QPDF_DLL Config& newlineBeforeEndstream();
23   -QPDF_DLL Config& noOriginalObjectIds();
24   -QPDF_DLL Config& noWarn();
25   -QPDF_DLL Config& optimizeImages();
26   -QPDF_DLL Config& passwordIsHexKey();
27   -QPDF_DLL Config& preserveUnreferenced();
28   -QPDF_DLL Config& preserveUnreferencedResources();
29   -QPDF_DLL Config& progress();
30   -QPDF_DLL Config& qdf();
31   -QPDF_DLL Config& rawStreamData();
32   -QPDF_DLL Config& recompressFlate();
33   -QPDF_DLL Config& removePageLabels();
34   -QPDF_DLL Config& requiresPassword();
35   -QPDF_DLL Config& showEncryption();
36   -QPDF_DLL Config& showEncryptionKey();
37   -QPDF_DLL Config& showLinearization();
38   -QPDF_DLL Config& showNpages();
39   -QPDF_DLL Config& showPages();
40   -QPDF_DLL Config& showXref();
41   -QPDF_DLL Config& staticAesIv();
42   -QPDF_DLL Config& staticId();
43   -QPDF_DLL Config& suppressPasswordRecovery();
44   -QPDF_DLL Config& suppressRecovery();
45   -QPDF_DLL Config& verbose();
46   -QPDF_DLL Config& warningExit0();
47   -QPDF_DLL Config& withImages();
48   -QPDF_DLL Config& collate(char const* parameter);
49   -QPDF_DLL Config& splitPages(char const* parameter);
50   -QPDF_DLL Config& compressionLevel(char const* parameter);
51   -QPDF_DLL Config& copyEncryption(char const* parameter);
52   -QPDF_DLL Config& encryptionFilePassword(char const* parameter);
53   -QPDF_DLL Config& forceVersion(char const* parameter);
54   -QPDF_DLL Config& iiMinBytes(char const* parameter);
55   -QPDF_DLL Config& jobJsonFile(char const* parameter);
56   -QPDF_DLL Config& jsonObject(char const* parameter);
57   -QPDF_DLL Config& keepFilesOpenThreshold(char const* parameter);
58   -QPDF_DLL Config& linearizePass1(char const* parameter);
59   -QPDF_DLL Config& minVersion(char const* parameter);
60   -QPDF_DLL Config& oiMinArea(char const* parameter);
61   -QPDF_DLL Config& oiMinHeight(char const* parameter);
62   -QPDF_DLL Config& oiMinWidth(char const* parameter);
63   -QPDF_DLL Config& password(char const* parameter);
64   -QPDF_DLL Config& passwordFile(char const* parameter);
65   -QPDF_DLL Config& removeAttachment(char const* parameter);
66   -QPDF_DLL Config& rotate(char const* parameter);
67   -QPDF_DLL Config& showAttachment(char const* parameter);
68   -QPDF_DLL Config& showObject(char const* parameter);
69   -QPDF_DLL Config& compressStreams(char const* parameter);
70   -QPDF_DLL Config& decodeLevel(char const* parameter);
71   -QPDF_DLL Config& flattenAnnotations(char const* parameter);
72   -QPDF_DLL Config& jsonKey(char const* parameter);
73   -QPDF_DLL Config& keepFilesOpen(char const* parameter);
74   -QPDF_DLL Config& normalizeContent(char const* parameter);
75   -QPDF_DLL Config& objectStreams(char const* parameter);
76   -QPDF_DLL Config& passwordMode(char const* parameter);
77   -QPDF_DLL Config& removeUnreferencedResources(char const* parameter);
78   -QPDF_DLL Config& streamData(char const* parameter);
  6 +QPDF_DLL Config* allowWeakCrypto();
  7 +QPDF_DLL Config* check();
  8 +QPDF_DLL Config* checkLinearization();
  9 +QPDF_DLL Config* coalesceContents();
  10 +QPDF_DLL Config* decrypt();
  11 +QPDF_DLL Config* deterministicId();
  12 +QPDF_DLL Config* externalizeInlineImages();
  13 +QPDF_DLL Config* filteredStreamData();
  14 +QPDF_DLL Config* flattenRotation();
  15 +QPDF_DLL Config* generateAppearances();
  16 +QPDF_DLL Config* ignoreXrefStreams();
  17 +QPDF_DLL Config* isEncrypted();
  18 +QPDF_DLL Config* json();
  19 +QPDF_DLL Config* keepInlineImages();
  20 +QPDF_DLL Config* linearize();
  21 +QPDF_DLL Config* listAttachments();
  22 +QPDF_DLL Config* newlineBeforeEndstream();
  23 +QPDF_DLL Config* noOriginalObjectIds();
  24 +QPDF_DLL Config* noWarn();
  25 +QPDF_DLL Config* optimizeImages();
  26 +QPDF_DLL Config* passwordIsHexKey();
  27 +QPDF_DLL Config* preserveUnreferenced();
  28 +QPDF_DLL Config* preserveUnreferencedResources();
  29 +QPDF_DLL Config* progress();
  30 +QPDF_DLL Config* qdf();
  31 +QPDF_DLL Config* rawStreamData();
  32 +QPDF_DLL Config* recompressFlate();
  33 +QPDF_DLL Config* removePageLabels();
  34 +QPDF_DLL Config* requiresPassword();
  35 +QPDF_DLL Config* showEncryption();
  36 +QPDF_DLL Config* showEncryptionKey();
  37 +QPDF_DLL Config* showLinearization();
  38 +QPDF_DLL Config* showNpages();
  39 +QPDF_DLL Config* showPages();
  40 +QPDF_DLL Config* showXref();
  41 +QPDF_DLL Config* staticAesIv();
  42 +QPDF_DLL Config* staticId();
  43 +QPDF_DLL Config* suppressPasswordRecovery();
  44 +QPDF_DLL Config* suppressRecovery();
  45 +QPDF_DLL Config* verbose();
  46 +QPDF_DLL Config* warningExit0();
  47 +QPDF_DLL Config* withImages();
  48 +QPDF_DLL Config* collate(char const* parameter);
  49 +QPDF_DLL Config* splitPages(char const* parameter);
  50 +QPDF_DLL Config* compressionLevel(char const* parameter);
  51 +QPDF_DLL Config* copyEncryption(char const* parameter);
  52 +QPDF_DLL Config* encryptionFilePassword(char const* parameter);
  53 +QPDF_DLL Config* forceVersion(char const* parameter);
  54 +QPDF_DLL Config* iiMinBytes(char const* parameter);
  55 +QPDF_DLL Config* jobJsonFile(char const* parameter);
  56 +QPDF_DLL Config* jsonObject(char const* parameter);
  57 +QPDF_DLL Config* keepFilesOpenThreshold(char const* parameter);
  58 +QPDF_DLL Config* linearizePass1(char const* parameter);
  59 +QPDF_DLL Config* minVersion(char const* parameter);
  60 +QPDF_DLL Config* oiMinArea(char const* parameter);
  61 +QPDF_DLL Config* oiMinHeight(char const* parameter);
  62 +QPDF_DLL Config* oiMinWidth(char const* parameter);
  63 +QPDF_DLL Config* password(char const* parameter);
  64 +QPDF_DLL Config* passwordFile(char const* parameter);
  65 +QPDF_DLL Config* removeAttachment(char const* parameter);
  66 +QPDF_DLL Config* rotate(char const* parameter);
  67 +QPDF_DLL Config* showAttachment(char const* parameter);
  68 +QPDF_DLL Config* showObject(char const* parameter);
  69 +QPDF_DLL Config* compressStreams(char const* parameter);
  70 +QPDF_DLL Config* decodeLevel(char const* parameter);
  71 +QPDF_DLL Config* flattenAnnotations(char const* parameter);
  72 +QPDF_DLL Config* jsonKey(char const* parameter);
  73 +QPDF_DLL Config* keepFilesOpen(char const* parameter);
  74 +QPDF_DLL Config* normalizeContent(char const* parameter);
  75 +QPDF_DLL Config* objectStreams(char const* parameter);
  76 +QPDF_DLL Config* passwordMode(char const* parameter);
  77 +QPDF_DLL Config* removeUnreferencedResources(char const* parameter);
  78 +QPDF_DLL Config* streamData(char const* parameter);
... ...
include/qpdf/auto_job_c_uo.hh
... ... @@ -3,7 +3,7 @@
3 3 // Edits will be automatically overwritten if the build is
4 4 // run in maintainer mode.
5 5 //
6   -QPDF_DLL UOConfig& to(char const* parameter);
7   -QPDF_DLL UOConfig& from(char const* parameter);
8   -QPDF_DLL UOConfig& repeat(char const* parameter);
9   -QPDF_DLL UOConfig& password(char const* parameter);
  6 +QPDF_DLL UOConfig* to(char const* parameter);
  7 +QPDF_DLL UOConfig* from(char const* parameter);
  8 +QPDF_DLL UOConfig* repeat(char const* parameter);
  9 +QPDF_DLL UOConfig* password(char const* parameter);
... ...
job.sums
1 1 # Generated by generate_auto_job
2   -generate_auto_job 3108658e47e17655e761842cd76bab48fdaf5e9792942c8bf1ca03f6f1934809
3   -include/qpdf/auto_job_c_att.hh 9d21a86169938a187c55e56e1ef915cd4211d13745c21d85c5c06306fd8ed023
4   -include/qpdf/auto_job_c_copy_att.hh d954c29ca74ef2e3abf0a0d99446bb974585700750fad8cee31340cbf2304a94
5   -include/qpdf/auto_job_c_enc.hh 7a64974ba970390f38bcea9c2471e620b92329c71eb7fa428ad0e09844007ca8
6   -include/qpdf/auto_job_c_main.hh e7f23e24ddbd16b5e7cb720c7da9ef76b89c2e23b5c4eecc5d8e10f0c0d60f4e
  2 +generate_auto_job e5c58868f4cb2c3ec1689bf44fb57cc57930f981f52fa4aa21d6b990a83f7163
  3 +include/qpdf/auto_job_c_att.hh 7ad43bb374c1370ef32ebdcdcb7b73a61d281f7f4e3f12755585872ab30fb60e
  4 +include/qpdf/auto_job_c_copy_att.hh 32275d03cdc69b703dd7e02ba0bbe15756e714e9ad185484773a6178dc09e1ee
  5 +include/qpdf/auto_job_c_enc.hh 72e138c7b96ed5aacdce78c1dec04b1c20d361faec4f8faf52f64c1d6be99265
  6 +include/qpdf/auto_job_c_main.hh 516adb23cc7e44e614e436880be870d0574e4ebbc706cd855a1360000eed31bb
7 7 include/qpdf/auto_job_c_pages.hh 931840b329a36ca0e41401190e04537b47f2867671a6643bfd8da74014202671
8   -include/qpdf/auto_job_c_uo.hh 0fd370c70a1974197804f62c308ca2ec44727bf2f95a89cde48c4284823b6fbc
  8 +include/qpdf/auto_job_c_uo.hh 0585b7de459fa479d9e51a45fa92de0ff6dee748efc9ec1cedd0dde6cee1ad50
9 9 job.yml 1590fd16fd17ed40db9aa56b6713c844cfd61b3a6d0441a3ccd122b7371c68e9
10 10 libqpdf/qpdf/auto_job_decl.hh 9f79396ec459f191be4c5fe34cf88c265cf47355a1a945fa39169d1c94cf04f6
11 11 libqpdf/qpdf/auto_job_help.hh 383eea80e2c185ef5295fc126246457a7ceeffea759fdb90bb2e6727532ea538
... ...
libqpdf/QPDFJob_config.cc
... ... @@ -8,7 +8,7 @@ static void usage(std::string const&amp; msg)
8 8 throw QPDFJob::ConfigError(msg);
9 9 }
10 10  
11   -QPDFJob::Config&
  11 +QPDFJob::Config*
12 12 QPDFJob::Config::inputFile(char const* filename)
13 13 {
14 14 if (o.m->infilename == 0)
... ... @@ -19,10 +19,10 @@ QPDFJob::Config::inputFile(char const* filename)
19 19 {
20 20 usage("input file has already been given");
21 21 }
22   - return *this;
  22 + return this;
23 23 }
24 24  
25   -QPDFJob::Config&
  25 +QPDFJob::Config*
26 26 QPDFJob::Config::emptyInput()
27 27 {
28 28 if (o.m->infilename == 0)
... ... @@ -42,10 +42,10 @@ QPDFJob::Config::emptyInput()
42 42 usage("empty input can't be used"
43 43 " since input file has already been given");
44 44 }
45   - return *this;
  45 + return this;
46 46 }
47 47  
48   -QPDFJob::Config&
  48 +QPDFJob::Config*
49 49 QPDFJob::Config::outputFile(char const* filename)
50 50 {
51 51 if ((o.m->outfilename == 0) && (! o.m->replace_input))
... ... @@ -56,10 +56,10 @@ QPDFJob::Config::outputFile(char const* filename)
56 56 {
57 57 usage("output file has already been given");
58 58 }
59   - return *this;
  59 + return this;
60 60 }
61 61  
62   -QPDFJob::Config&
  62 +QPDFJob::Config*
63 63 QPDFJob::Config::replaceInput()
64 64 {
65 65 if ((o.m->outfilename == 0) && (! o.m->replace_input))
... ... @@ -71,111 +71,111 @@ QPDFJob::Config::replaceInput()
71 71 usage("replace-input can't be used"
72 72 " since output file has already been given");
73 73 }
74   - return *this;
  74 + return this;
75 75 }
76 76  
77   -QPDFJob::Config&
  77 +QPDFJob::Config*
78 78 QPDFJob::Config::allowWeakCrypto()
79 79 {
80 80 o.m->allow_weak_crypto = true;
81   - return *this;
  81 + return this;
82 82 }
83 83  
84   -QPDFJob::Config&
  84 +QPDFJob::Config*
85 85 QPDFJob::Config::check()
86 86 {
87 87 o.m->check = true;
88 88 o.m->require_outfile = false;
89   - return *this;
  89 + return this;
90 90 }
91 91  
92   -QPDFJob::Config&
  92 +QPDFJob::Config*
93 93 QPDFJob::Config::checkLinearization()
94 94 {
95 95 o.m->check_linearization = true;
96 96 o.m->require_outfile = false;
97   - return *this;
  97 + return this;
98 98 }
99 99  
100   -QPDFJob::Config&
  100 +QPDFJob::Config*
101 101 QPDFJob::Config::coalesceContents()
102 102 {
103 103 o.m->coalesce_contents = true;
104   - return *this;
  104 + return this;
105 105 }
106 106  
107   -QPDFJob::Config&
  107 +QPDFJob::Config*
108 108 QPDFJob::Config::collate(char const* parameter)
109 109 {
110 110 auto n = ((parameter == 0) ? 1 :
111 111 QUtil::string_to_uint(parameter));
112 112 o.m->collate = QIntC::to_size(n);
113   - return *this;
  113 + return this;
114 114 }
115 115  
116   -QPDFJob::Config&
  116 +QPDFJob::Config*
117 117 QPDFJob::Config::compressStreams(char const* parameter)
118 118 {
119 119 o.m->compress_streams_set = true;
120 120 o.m->compress_streams = (strcmp(parameter, "y") == 0);
121   - return *this;
  121 + return this;
122 122 }
123 123  
124   -QPDFJob::Config&
  124 +QPDFJob::Config*
125 125 QPDFJob::Config::compressionLevel(char const* parameter)
126 126 {
127 127 o.m->compression_level = QUtil::string_to_int(parameter);
128   - return *this;
  128 + return this;
129 129 }
130 130  
131   -QPDFJob::Config&
  131 +QPDFJob::Config*
132 132 QPDFJob::Config::copyEncryption(char const* parameter)
133 133 {
134 134 o.m->encryption_file = parameter;
135 135 o.m->copy_encryption = true;
136 136 o.m->encrypt = false;
137 137 o.m->decrypt = false;
138   - return *this;
  138 + return this;
139 139 }
140 140  
141   -QPDFJob::Config&
  141 +QPDFJob::Config*
142 142 QPDFJob::Config::decrypt()
143 143 {
144 144 o.m->decrypt = true;
145 145 o.m->encrypt = false;
146 146 o.m->copy_encryption = false;
147   - return *this;
  147 + return this;
148 148 }
149 149  
150   -QPDFJob::Config&
  150 +QPDFJob::Config*
151 151 QPDFJob::Config::deterministicId()
152 152 {
153 153 o.m->deterministic_id = true;
154   - return *this;
  154 + return this;
155 155 }
156 156  
157   -QPDFJob::Config&
  157 +QPDFJob::Config*
158 158 QPDFJob::Config::encryptionFilePassword(char const* parameter)
159 159 {
160 160 o.m->encryption_file_password = QUtil::make_shared_cstr(parameter);
161   - return *this;
  161 + return this;
162 162 }
163 163  
164   -QPDFJob::Config&
  164 +QPDFJob::Config*
165 165 QPDFJob::Config::externalizeInlineImages()
166 166 {
167 167 o.m->externalize_inline_images = true;
168   - return *this;
  168 + return this;
169 169 }
170 170  
171   -QPDFJob::Config&
  171 +QPDFJob::Config*
172 172 QPDFJob::Config::filteredStreamData()
173 173 {
174 174 o.m->show_filtered_stream_data = true;
175   - return *this;
  175 + return this;
176 176 }
177 177  
178   -QPDFJob::Config&
  178 +QPDFJob::Config*
179 179 QPDFJob::Config::flattenAnnotations(char const* parameter)
180 180 {
181 181 o.m->flatten_annotations = true;
... ... @@ -187,375 +187,375 @@ QPDFJob::Config::flattenAnnotations(char const* parameter)
187 187 {
188 188 o.m->flatten_annotations_required |= an_print;
189 189 }
190   - return *this;
  190 + return this;
191 191 }
192 192  
193   -QPDFJob::Config&
  193 +QPDFJob::Config*
194 194 QPDFJob::Config::flattenRotation()
195 195 {
196 196 o.m->flatten_rotation = true;
197   - return *this;
  197 + return this;
198 198 }
199 199  
200   -QPDFJob::Config&
  200 +QPDFJob::Config*
201 201 QPDFJob::Config::forceVersion(char const* parameter)
202 202 {
203 203 o.m->force_version = parameter;
204   - return *this;
  204 + return this;
205 205 }
206 206  
207   -QPDFJob::Config&
  207 +QPDFJob::Config*
208 208 QPDFJob::Config::generateAppearances()
209 209 {
210 210 o.m->generate_appearances = true;
211   - return *this;
  211 + return this;
212 212 }
213 213  
214   -QPDFJob::Config&
  214 +QPDFJob::Config*
215 215 QPDFJob::Config::ignoreXrefStreams()
216 216 {
217 217 o.m->ignore_xref_streams = true;
218   - return *this;
  218 + return this;
219 219 }
220 220  
221   -QPDFJob::Config&
  221 +QPDFJob::Config*
222 222 QPDFJob::Config::iiMinBytes(char const* parameter)
223 223 {
224 224 o.m->ii_min_bytes = QUtil::string_to_uint(parameter);
225   - return *this;
  225 + return this;
226 226 }
227 227  
228   -QPDFJob::Config&
  228 +QPDFJob::Config*
229 229 QPDFJob::Config::isEncrypted()
230 230 {
231 231 o.m->check_is_encrypted = true;
232 232 o.m->require_outfile = false;
233   - return *this;
  233 + return this;
234 234 }
235 235  
236   -QPDFJob::Config&
  236 +QPDFJob::Config*
237 237 QPDFJob::Config::json()
238 238 {
239 239 o.m->json = true;
240 240 o.m->require_outfile = false;
241   - return *this;
  241 + return this;
242 242 }
243 243  
244   -QPDFJob::Config&
  244 +QPDFJob::Config*
245 245 QPDFJob::Config::jsonKey(char const* parameter)
246 246 {
247 247 o.m->json_keys.insert(parameter);
248   - return *this;
  248 + return this;
249 249 }
250 250  
251   -QPDFJob::Config&
  251 +QPDFJob::Config*
252 252 QPDFJob::Config::jsonObject(char const* parameter)
253 253 {
254 254 o.m->json_objects.insert(parameter);
255   - return *this;
  255 + return this;
256 256 }
257 257  
258   -QPDFJob::Config&
  258 +QPDFJob::Config*
259 259 QPDFJob::Config::keepFilesOpen(char const* parameter)
260 260 {
261 261 o.m->keep_files_open_set = true;
262 262 o.m->keep_files_open = (strcmp(parameter, "y") == 0);
263   - return *this;
  263 + return this;
264 264 }
265 265  
266   -QPDFJob::Config&
  266 +QPDFJob::Config*
267 267 QPDFJob::Config::keepFilesOpenThreshold(char const* parameter)
268 268 {
269 269 o.m->keep_files_open_threshold = QUtil::string_to_uint(parameter);
270   - return *this;
  270 + return this;
271 271 }
272 272  
273   -QPDFJob::Config&
  273 +QPDFJob::Config*
274 274 QPDFJob::Config::keepInlineImages()
275 275 {
276 276 o.m->keep_inline_images = true;
277   - return *this;
  277 + return this;
278 278 }
279 279  
280   -QPDFJob::Config&
  280 +QPDFJob::Config*
281 281 QPDFJob::Config::linearize()
282 282 {
283 283 o.m->linearize = true;
284   - return *this;
  284 + return this;
285 285 }
286 286  
287   -QPDFJob::Config&
  287 +QPDFJob::Config*
288 288 QPDFJob::Config::linearizePass1(char const* parameter)
289 289 {
290 290 o.m->linearize_pass1 = parameter;
291   - return *this;
  291 + return this;
292 292 }
293 293  
294   -QPDFJob::Config&
  294 +QPDFJob::Config*
295 295 QPDFJob::Config::listAttachments()
296 296 {
297 297 o.m->list_attachments = true;
298 298 o.m->require_outfile = false;
299   - return *this;
  299 + return this;
300 300 }
301 301  
302   -QPDFJob::Config&
  302 +QPDFJob::Config*
303 303 QPDFJob::Config::minVersion(char const* parameter)
304 304 {
305 305 o.m->min_version = parameter;
306   - return *this;
  306 + return this;
307 307 }
308 308  
309   -QPDFJob::Config&
  309 +QPDFJob::Config*
310 310 QPDFJob::Config::newlineBeforeEndstream()
311 311 {
312 312 o.m->newline_before_endstream = true;
313   - return *this;
  313 + return this;
314 314 }
315 315  
316   -QPDFJob::Config&
  316 +QPDFJob::Config*
317 317 QPDFJob::Config::noOriginalObjectIds()
318 318 {
319 319 o.m->suppress_original_object_id = true;
320   - return *this;
  320 + return this;
321 321 }
322 322  
323   -QPDFJob::Config&
  323 +QPDFJob::Config*
324 324 QPDFJob::Config::noWarn()
325 325 {
326 326 o.m->suppress_warnings = true;
327   - return *this;
  327 + return this;
328 328 }
329 329  
330   -QPDFJob::Config&
  330 +QPDFJob::Config*
331 331 QPDFJob::Config::normalizeContent(char const* parameter)
332 332 {
333 333 o.m->normalize_set = true;
334 334 o.m->normalize = (strcmp(parameter, "y") == 0);
335   - return *this;
  335 + return this;
336 336 }
337 337  
338   -QPDFJob::Config&
  338 +QPDFJob::Config*
339 339 QPDFJob::Config::oiMinArea(char const* parameter)
340 340 {
341 341 o.m->oi_min_area = QUtil::string_to_uint(parameter);
342   - return *this;
  342 + return this;
343 343 }
344 344  
345   -QPDFJob::Config&
  345 +QPDFJob::Config*
346 346 QPDFJob::Config::oiMinHeight(char const* parameter)
347 347 {
348 348 o.m->oi_min_height = QUtil::string_to_uint(parameter);
349   - return *this;
  349 + return this;
350 350 }
351 351  
352   -QPDFJob::Config&
  352 +QPDFJob::Config*
353 353 QPDFJob::Config::oiMinWidth(char const* parameter)
354 354 {
355 355 o.m->oi_min_width = QUtil::string_to_uint(parameter);
356   - return *this;
  356 + return this;
357 357 }
358 358  
359   -QPDFJob::Config&
  359 +QPDFJob::Config*
360 360 QPDFJob::Config::optimizeImages()
361 361 {
362 362 o.m->optimize_images = true;
363   - return *this;
  363 + return this;
364 364 }
365 365  
366   -QPDFJob::Config&
  366 +QPDFJob::Config*
367 367 QPDFJob::Config::password(char const* parameter)
368 368 {
369 369 o.m->password = QUtil::make_shared_cstr(parameter);
370   - return *this;
  370 + return this;
371 371 }
372 372  
373   -QPDFJob::Config&
  373 +QPDFJob::Config*
374 374 QPDFJob::Config::passwordIsHexKey()
375 375 {
376 376 o.m->password_is_hex_key = true;
377   - return *this;
  377 + return this;
378 378 }
379 379  
380   -QPDFJob::Config&
  380 +QPDFJob::Config*
381 381 QPDFJob::Config::preserveUnreferenced()
382 382 {
383 383 o.m->preserve_unreferenced_objects = true;
384   - return *this;
  384 + return this;
385 385 }
386 386  
387   -QPDFJob::Config&
  387 +QPDFJob::Config*
388 388 QPDFJob::Config::preserveUnreferencedResources()
389 389 {
390 390 o.m->remove_unreferenced_page_resources = QPDFJob::re_no;
391   - return *this;
  391 + return this;
392 392 }
393 393  
394   -QPDFJob::Config&
  394 +QPDFJob::Config*
395 395 QPDFJob::Config::progress()
396 396 {
397 397 o.m->progress = true;
398   - return *this;
  398 + return this;
399 399 }
400 400  
401   -QPDFJob::Config&
  401 +QPDFJob::Config*
402 402 QPDFJob::Config::qdf()
403 403 {
404 404 o.m->qdf_mode = true;
405   - return *this;
  405 + return this;
406 406 }
407 407  
408   -QPDFJob::Config&
  408 +QPDFJob::Config*
409 409 QPDFJob::Config::rawStreamData()
410 410 {
411 411 o.m->show_raw_stream_data = true;
412   - return *this;
  412 + return this;
413 413 }
414 414  
415   -QPDFJob::Config&
  415 +QPDFJob::Config*
416 416 QPDFJob::Config::recompressFlate()
417 417 {
418 418 o.m->recompress_flate_set = true;
419 419 o.m->recompress_flate = true;
420   - return *this;
  420 + return this;
421 421 }
422 422  
423   -QPDFJob::Config&
  423 +QPDFJob::Config*
424 424 QPDFJob::Config::removeAttachment(char const* parameter)
425 425 {
426 426 o.m->attachments_to_remove.push_back(parameter);
427   - return *this;
  427 + return this;
428 428 }
429 429  
430   -QPDFJob::Config&
  430 +QPDFJob::Config*
431 431 QPDFJob::Config::removePageLabels()
432 432 {
433 433 o.m->remove_page_labels = true;
434   - return *this;
  434 + return this;
435 435 }
436 436  
437   -QPDFJob::Config&
  437 +QPDFJob::Config*
438 438 QPDFJob::Config::requiresPassword()
439 439 {
440 440 o.m->check_requires_password = true;
441 441 o.m->require_outfile = false;
442   - return *this;
  442 + return this;
443 443 }
444 444  
445   -QPDFJob::Config&
  445 +QPDFJob::Config*
446 446 QPDFJob::Config::showAttachment(char const* parameter)
447 447 {
448 448 o.m->attachment_to_show = parameter;
449 449 o.m->require_outfile = false;
450   - return *this;
  450 + return this;
451 451 }
452 452  
453   -QPDFJob::Config&
  453 +QPDFJob::Config*
454 454 QPDFJob::Config::showEncryption()
455 455 {
456 456 o.m->show_encryption = true;
457 457 o.m->require_outfile = false;
458   - return *this;
  458 + return this;
459 459 }
460 460  
461   -QPDFJob::Config&
  461 +QPDFJob::Config*
462 462 QPDFJob::Config::showEncryptionKey()
463 463 {
464 464 o.m->show_encryption_key = true;
465   - return *this;
  465 + return this;
466 466 }
467 467  
468   -QPDFJob::Config&
  468 +QPDFJob::Config*
469 469 QPDFJob::Config::showLinearization()
470 470 {
471 471 o.m->show_linearization = true;
472 472 o.m->require_outfile = false;
473   - return *this;
  473 + return this;
474 474 }
475 475  
476   -QPDFJob::Config&
  476 +QPDFJob::Config*
477 477 QPDFJob::Config::showNpages()
478 478 {
479 479 o.m->show_npages = true;
480 480 o.m->require_outfile = false;
481   - return *this;
  481 + return this;
482 482 }
483 483  
484   -QPDFJob::Config&
  484 +QPDFJob::Config*
485 485 QPDFJob::Config::showPages()
486 486 {
487 487 o.m->show_pages = true;
488 488 o.m->require_outfile = false;
489   - return *this;
  489 + return this;
490 490 }
491 491  
492   -QPDFJob::Config&
  492 +QPDFJob::Config*
493 493 QPDFJob::Config::showXref()
494 494 {
495 495 o.m->show_xref = true;
496 496 o.m->require_outfile = false;
497   - return *this;
  497 + return this;
498 498 }
499 499  
500   -QPDFJob::Config&
  500 +QPDFJob::Config*
501 501 QPDFJob::Config::splitPages(char const* parameter)
502 502 {
503 503 int n = ((parameter == 0) ? 1 :
504 504 QUtil::string_to_int(parameter));
505 505 o.m->split_pages = n;
506   - return *this;
  506 + return this;
507 507 }
508 508  
509   -QPDFJob::Config&
  509 +QPDFJob::Config*
510 510 QPDFJob::Config::staticAesIv()
511 511 {
512 512 o.m->static_aes_iv = true;
513   - return *this;
  513 + return this;
514 514 }
515 515  
516   -QPDFJob::Config&
  516 +QPDFJob::Config*
517 517 QPDFJob::Config::staticId()
518 518 {
519 519 o.m->static_id = true;
520   - return *this;
  520 + return this;
521 521 }
522 522  
523   -QPDFJob::Config&
  523 +QPDFJob::Config*
524 524 QPDFJob::Config::suppressPasswordRecovery()
525 525 {
526 526 o.m->suppress_password_recovery = true;
527   - return *this;
  527 + return this;
528 528 }
529 529  
530   -QPDFJob::Config&
  530 +QPDFJob::Config*
531 531 QPDFJob::Config::suppressRecovery()
532 532 {
533 533 o.m->suppress_recovery = true;
534   - return *this;
  534 + return this;
535 535 }
536 536  
537   -QPDFJob::Config&
  537 +QPDFJob::Config*
538 538 QPDFJob::Config::verbose()
539 539 {
540 540 o.m->verbose = true;
541   - return *this;
  541 + return this;
542 542 }
543 543  
544   -QPDFJob::Config&
  544 +QPDFJob::Config*
545 545 QPDFJob::Config::warningExit0()
546 546 {
547 547 o.m->warnings_exit_zero = true;
548   - return *this;
  548 + return this;
549 549 }
550 550  
551   -QPDFJob::Config&
  551 +QPDFJob::Config*
552 552 QPDFJob::Config::withImages()
553 553 {
554 554 o.m->show_page_images = true;
555   - return *this;
  555 + return this;
556 556 }
557 557  
558   -QPDFJob::Config&
  558 +QPDFJob::Config*
559 559 QPDFJob::Config::passwordFile(char const* parameter)
560 560 {
561 561 std::list<std::string> lines;
... ... @@ -580,10 +580,10 @@ QPDFJob::Config::passwordFile(char const* parameter)
580 580 << " the password file are ignored" << std::endl;
581 581 }
582 582 }
583   - return *this;
  583 + return this;
584 584 }
585 585  
586   -QPDFJob::Config&
  586 +QPDFJob::Config*
587 587 QPDFJob::Config::passwordMode(char const* parameter)
588 588 {
589 589 if (strcmp(parameter, "bytes") == 0)
... ... @@ -606,10 +606,10 @@ QPDFJob::Config::passwordMode(char const* parameter)
606 606 {
607 607 usage("invalid password-mode option");
608 608 }
609   - return *this;
  609 + return this;
610 610 }
611 611  
612   -QPDFJob::Config&
  612 +QPDFJob::Config*
613 613 QPDFJob::Config::streamData(char const* parameter)
614 614 {
615 615 o.m->stream_data_set = true;
... ... @@ -631,10 +631,10 @@ QPDFJob::Config::streamData(char const* parameter)
631 631 // ArgParser::initOptionTable is wrong.
632 632 usage("invalid stream-data option");
633 633 }
634   - return *this;
  634 + return this;
635 635 }
636 636  
637   -QPDFJob::Config&
  637 +QPDFJob::Config*
638 638 QPDFJob::Config::decodeLevel(char const* parameter)
639 639 {
640 640 o.m->decode_level_set = true;
... ... @@ -660,10 +660,10 @@ QPDFJob::Config::decodeLevel(char const* parameter)
660 660 // ArgParser::initOptionTable is wrong.
661 661 usage("invalid option");
662 662 }
663   - return *this;
  663 + return this;
664 664 }
665 665  
666   -QPDFJob::Config&
  666 +QPDFJob::Config*
667 667 QPDFJob::Config::objectStreams(char const* parameter)
668 668 {
669 669 o.m->object_stream_set = true;
... ... @@ -685,10 +685,10 @@ QPDFJob::Config::objectStreams(char const* parameter)
685 685 // ArgParser::initOptionTable is wrong.
686 686 usage("invalid object stream mode");
687 687 }
688   - return *this;
  688 + return this;
689 689 }
690 690  
691   -QPDFJob::Config&
  691 +QPDFJob::Config*
692 692 QPDFJob::Config::removeUnreferencedResources(char const* parameter)
693 693 {
694 694 if (strcmp(parameter, "auto") == 0)
... ... @@ -709,19 +709,19 @@ QPDFJob::Config::removeUnreferencedResources(char const* parameter)
709 709 // ArgParser::initOptionTable is wrong.
710 710 usage("invalid value for --remove-unreferenced-page-resources");
711 711 }
712   - return *this;
  712 + return this;
713 713 }
714 714  
715   -QPDFJob::Config&
  715 +QPDFJob::Config*
716 716 QPDFJob::Config::showObject(char const* parameter)
717 717 {
718 718 QPDFJob::parse_object_id(
719 719 parameter, o.m->show_trailer, o.m->show_obj, o.m->show_gen);
720 720 o.m->require_outfile = false;
721   - return *this;
  721 + return this;
722 722 }
723 723  
724   -QPDFJob::Config&
  724 +QPDFJob::Config*
725 725 QPDFJob::Config::jobJsonFile(char const* parameter)
726 726 {
727 727 PointerHolder<char> file_buf;
... ... @@ -738,60 +738,60 @@ QPDFJob::Config::jobJsonFile(char const* parameter)
738 738 e.what() + "\nRun " + this->o.m->message_prefix +
739 739 "--job-json-help for information on the file format.");
740 740 }
741   - return *this;
  741 + return this;
742 742 }
743 743  
744   -QPDFJob::Config&
  744 +QPDFJob::Config*
745 745 QPDFJob::Config::rotate(char const* parameter)
746 746 {
747 747 o.parseRotationParameter(parameter);
748   - return *this;
  748 + return this;
749 749 }
750 750  
751 751 std::shared_ptr<QPDFJob::CopyAttConfig>
752 752 QPDFJob::Config::copyAttachmentsFrom()
753 753 {
754   - return std::shared_ptr<CopyAttConfig>(new CopyAttConfig(*this));
  754 + return std::shared_ptr<CopyAttConfig>(new CopyAttConfig(this));
755 755 }
756 756  
757   -QPDFJob::CopyAttConfig::CopyAttConfig(Config& c) :
  757 +QPDFJob::CopyAttConfig::CopyAttConfig(Config* c) :
758 758 config(c)
759 759 {
760 760 }
761 761  
762   -QPDFJob::CopyAttConfig&
  762 +QPDFJob::CopyAttConfig*
763 763 QPDFJob::CopyAttConfig::path(char const* parameter)
764 764 {
765 765 this->caf.path = parameter;
766   - return *this;
  766 + return this;
767 767 }
768 768  
769   -QPDFJob::CopyAttConfig&
  769 +QPDFJob::CopyAttConfig*
770 770 QPDFJob::CopyAttConfig::prefix(char const* parameter)
771 771 {
772 772 this->caf.prefix = parameter;
773   - return *this;
  773 + return this;
774 774 }
775 775  
776   -QPDFJob::CopyAttConfig&
  776 +QPDFJob::CopyAttConfig*
777 777 QPDFJob::CopyAttConfig::password(char const* parameter)
778 778 {
779 779 this->caf.password = parameter;
780   - return *this;
  780 + return this;
781 781 }
782 782  
783   -QPDFJob::Config&
  783 +QPDFJob::Config*
784 784 QPDFJob::CopyAttConfig::endCopyAttachmentsFrom()
785 785 {
786 786 if (this->caf.path.empty())
787 787 {
788 788 usage("copy attachments: no path specified");
789 789 }
790   - this->config.o.m->attachments_to_copy.push_back(this->caf);
  790 + this->config->o.m->attachments_to_copy.push_back(this->caf);
791 791 return this->config;
792 792 }
793 793  
794   -QPDFJob::AttConfig::AttConfig(Config& c) :
  794 +QPDFJob::AttConfig::AttConfig(Config* c) :
795 795 config(c)
796 796 {
797 797 }
... ... @@ -799,31 +799,31 @@ QPDFJob::AttConfig::AttConfig(Config&amp; c) :
799 799 std::shared_ptr<QPDFJob::AttConfig>
800 800 QPDFJob::Config::addAttachment()
801 801 {
802   - return std::shared_ptr<AttConfig>(new AttConfig(*this));
  802 + return std::shared_ptr<AttConfig>(new AttConfig(this));
803 803 }
804 804  
805   -QPDFJob::AttConfig&
  805 +QPDFJob::AttConfig*
806 806 QPDFJob::AttConfig::path(char const* parameter)
807 807 {
808 808 this->att.path = parameter;
809   - return *this;
  809 + return this;
810 810 }
811 811  
812   -QPDFJob::AttConfig&
  812 +QPDFJob::AttConfig*
813 813 QPDFJob::AttConfig::key(char const* parameter)
814 814 {
815 815 this->att.key = parameter;
816   - return *this;
  816 + return this;
817 817 }
818 818  
819   -QPDFJob::AttConfig&
  819 +QPDFJob::AttConfig*
820 820 QPDFJob::AttConfig::filename(char const* parameter)
821 821 {
822 822 this->att.filename = parameter;
823   - return *this;
  823 + return this;
824 824 }
825 825  
826   -QPDFJob::AttConfig&
  826 +QPDFJob::AttConfig*
827 827 QPDFJob::AttConfig::creationdate(char const* parameter)
828 828 {
829 829 if (! QUtil::pdf_time_to_qpdf_time(parameter))
... ... @@ -831,10 +831,10 @@ QPDFJob::AttConfig::creationdate(char const* parameter)
831 831 usage(std::string(parameter) + " is not a valid PDF timestamp");
832 832 }
833 833 this->att.creationdate = parameter;
834   - return *this;
  834 + return this;
835 835 }
836 836  
837   -QPDFJob::AttConfig&
  837 +QPDFJob::AttConfig*
838 838 QPDFJob::AttConfig::moddate(char const* parameter)
839 839 {
840 840 if (! QUtil::pdf_time_to_qpdf_time(parameter))
... ... @@ -842,10 +842,10 @@ QPDFJob::AttConfig::moddate(char const* parameter)
842 842 usage(std::string(parameter) + " is not a valid PDF timestamp");
843 843 }
844 844 this->att.moddate = parameter;
845   - return *this;
  845 + return this;
846 846 }
847 847  
848   -QPDFJob::AttConfig&
  848 +QPDFJob::AttConfig*
849 849 QPDFJob::AttConfig::mimetype(char const* parameter)
850 850 {
851 851 if (strchr(parameter, '/') == nullptr)
... ... @@ -853,24 +853,24 @@ QPDFJob::AttConfig::mimetype(char const* parameter)
853 853 usage("mime type should be specified as type/subtype");
854 854 }
855 855 this->att.mimetype = parameter;
856   - return *this;
  856 + return this;
857 857 }
858 858  
859   -QPDFJob::AttConfig&
  859 +QPDFJob::AttConfig*
860 860 QPDFJob::AttConfig::description(char const* parameter)
861 861 {
862 862 this->att.description = parameter;
863   - return *this;
  863 + return this;
864 864 }
865 865  
866   -QPDFJob::AttConfig&
  866 +QPDFJob::AttConfig*
867 867 QPDFJob::AttConfig::replace()
868 868 {
869 869 this->att.replace = true;
870   - return *this;
  870 + return this;
871 871 }
872 872  
873   -QPDFJob::Config&
  873 +QPDFJob::Config*
874 874 QPDFJob::AttConfig::endAddAttachment()
875 875 {
876 876 static std::string now = QUtil::qpdf_time_to_pdf_time(
... ... @@ -901,11 +901,11 @@ QPDFJob::AttConfig::endAddAttachment()
901 901 this->att.moddate = now;
902 902 }
903 903  
904   - this->config.o.m->attachments_to_add.push_back(this->att);
  904 + this->config->o.m->attachments_to_add.push_back(this->att);
905 905 return this->config;
906 906 }
907 907  
908   -QPDFJob::PagesConfig::PagesConfig(Config& c) :
  908 +QPDFJob::PagesConfig::PagesConfig(Config* c) :
909 909 config(c)
910 910 {
911 911 }
... ... @@ -917,108 +917,108 @@ QPDFJob::Config::pages()
917 917 {
918 918 usage("--pages may only be specified one time");
919 919 }
920   - return std::shared_ptr<PagesConfig>(new PagesConfig(*this));
  920 + return std::shared_ptr<PagesConfig>(new PagesConfig(this));
921 921 }
922 922  
923   -QPDFJob::Config&
  923 +QPDFJob::Config*
924 924 QPDFJob::PagesConfig::endPages()
925 925 {
926   - if (this->config.o.m->page_specs.empty())
  926 + if (this->config->o.m->page_specs.empty())
927 927 {
928 928 usage("--pages: no page specifications given");
929 929 }
930 930 return this->config;
931 931 }
932 932  
933   -QPDFJob::PagesConfig&
  933 +QPDFJob::PagesConfig*
934 934 QPDFJob::PagesConfig::pageSpec(std::string const& filename,
935 935 std::string const& range,
936 936 char const* password)
937 937 {
938   - this->config.o.m->page_specs.push_back(
  938 + this->config->o.m->page_specs.push_back(
939 939 QPDFJob::PageSpec(filename, password, range));
940   - return *this;
  940 + return this;
941 941 }
942 942  
943 943 std::shared_ptr<QPDFJob::UOConfig>
944 944 QPDFJob::Config::overlay()
945 945 {
946 946 o.m->under_overlay = &o.m->overlay;
947   - return std::shared_ptr<UOConfig>(new UOConfig(*this));
  947 + return std::shared_ptr<UOConfig>(new UOConfig(this));
948 948 }
949 949  
950 950 std::shared_ptr<QPDFJob::UOConfig>
951 951 QPDFJob::Config::underlay()
952 952 {
953 953 o.m->under_overlay = &o.m->underlay;
954   - return std::shared_ptr<UOConfig>(new UOConfig(*this));
  954 + return std::shared_ptr<UOConfig>(new UOConfig(this));
955 955 }
956 956  
957   -QPDFJob::UOConfig::UOConfig(Config& c) :
  957 +QPDFJob::UOConfig::UOConfig(Config* c) :
958 958 config(c)
959 959 {
960 960 }
961 961  
962   -QPDFJob::Config&
  962 +QPDFJob::Config*
963 963 QPDFJob::UOConfig::endUnderlayOverlay()
964 964 {
965   - if (config.o.m->under_overlay->filename.empty())
  965 + if (config->o.m->under_overlay->filename.empty())
966 966 {
967   - usage(config.o.m->under_overlay->which + " file not specified");
  967 + usage(config->o.m->under_overlay->which + " file not specified");
968 968 }
969   - config.o.m->under_overlay = 0;
  969 + config->o.m->under_overlay = 0;
970 970 return this->config;
971 971 }
972 972  
973   -QPDFJob::UOConfig&
  973 +QPDFJob::UOConfig*
974 974 QPDFJob::UOConfig::path(char const* parameter)
975 975 {
976   - if (! config.o.m->under_overlay->filename.empty())
  976 + if (! config->o.m->under_overlay->filename.empty())
977 977 {
978   - usage(config.o.m->under_overlay->which + " file already specified");
  978 + usage(config->o.m->under_overlay->which + " file already specified");
979 979 }
980 980 else
981 981 {
982   - config.o.m->under_overlay->filename = parameter;
  982 + config->o.m->under_overlay->filename = parameter;
983 983 }
984   - return *this;
  984 + return this;
985 985 }
986 986  
987   -QPDFJob::UOConfig&
  987 +QPDFJob::UOConfig*
988 988 QPDFJob::UOConfig::to(char const* parameter)
989 989 {
990   - config.o.parseNumrange(parameter, 0);
991   - config.o.m->under_overlay->to_nr = parameter;
992   - return *this;
  990 + config->o.parseNumrange(parameter, 0);
  991 + config->o.m->under_overlay->to_nr = parameter;
  992 + return this;
993 993 }
994 994  
995   -QPDFJob::UOConfig&
  995 +QPDFJob::UOConfig*
996 996 QPDFJob::UOConfig::from(char const* parameter)
997 997 {
998 998 if (strlen(parameter))
999 999 {
1000   - config.o.parseNumrange(parameter, 0);
  1000 + config->o.parseNumrange(parameter, 0);
1001 1001 }
1002   - config.o.m->under_overlay->from_nr = parameter;
1003   - return *this;
  1002 + config->o.m->under_overlay->from_nr = parameter;
  1003 + return this;
1004 1004 }
1005 1005  
1006   -QPDFJob::UOConfig&
  1006 +QPDFJob::UOConfig*
1007 1007 QPDFJob::UOConfig::repeat(char const* parameter)
1008 1008 {
1009 1009 if (strlen(parameter))
1010 1010 {
1011   - config.o.parseNumrange(parameter, 0);
  1011 + config->o.parseNumrange(parameter, 0);
1012 1012 }
1013   - config.o.m->under_overlay->repeat_nr = parameter;
1014   - return *this;
  1013 + config->o.m->under_overlay->repeat_nr = parameter;
  1014 + return this;
1015 1015 }
1016 1016  
1017   -QPDFJob::UOConfig&
  1017 +QPDFJob::UOConfig*
1018 1018 QPDFJob::UOConfig::password(char const* parameter)
1019 1019 {
1020   - config.o.m->under_overlay->password = QUtil::make_shared_cstr(parameter);
1021   - return *this;
  1020 + config->o.m->under_overlay->password = QUtil::make_shared_cstr(parameter);
  1021 + return this;
1022 1022 }
1023 1023  
1024 1024 std::shared_ptr<QPDFJob::EncConfig>
... ... @@ -1033,185 +1033,185 @@ QPDFJob::Config::encrypt(int keylen,
1033 1033 }
1034 1034 o.m->user_password = user_password;
1035 1035 o.m->owner_password = owner_password;
1036   - return std::shared_ptr<EncConfig>(new EncConfig(*this));
  1036 + return std::shared_ptr<EncConfig>(new EncConfig(this));
1037 1037 }
1038 1038  
1039   -QPDFJob::EncConfig::EncConfig(Config& c) :
  1039 +QPDFJob::EncConfig::EncConfig(Config* c) :
1040 1040 config(c)
1041 1041 {
1042 1042 }
1043 1043  
1044   -QPDFJob::Config&
  1044 +QPDFJob::Config*
1045 1045 QPDFJob::EncConfig::endEncrypt()
1046 1046 {
1047   - config.o.m->encrypt = true;
1048   - config.o.m->decrypt = false;
1049   - config.o.m->copy_encryption = false;
  1047 + config->o.m->encrypt = true;
  1048 + config->o.m->decrypt = false;
  1049 + config->o.m->copy_encryption = false;
1050 1050 return this->config;
1051 1051 }
1052 1052  
1053   -QPDFJob::EncConfig&
  1053 +QPDFJob::EncConfig*
1054 1054 QPDFJob::EncConfig::allowInsecure()
1055 1055 {
1056   - config.o.m->allow_insecure = true;
1057   - return *this;
  1056 + config->o.m->allow_insecure = true;
  1057 + return this;
1058 1058 }
1059 1059  
1060   -QPDFJob::EncConfig&
  1060 +QPDFJob::EncConfig*
1061 1061 QPDFJob::EncConfig::accessibility(char const* parameter)
1062 1062 {
1063   - config.o.m->r3_accessibility = (strcmp(parameter, "y") == 0);
1064   - return *this;
  1063 + config->o.m->r3_accessibility = (strcmp(parameter, "y") == 0);
  1064 + return this;
1065 1065 }
1066 1066  
1067   -QPDFJob::EncConfig&
  1067 +QPDFJob::EncConfig*
1068 1068 QPDFJob::EncConfig::extract(char const* parameter)
1069 1069 {
1070   - if (config.o.m->keylen == 40)
  1070 + if (config->o.m->keylen == 40)
1071 1071 {
1072   - config.o.m->r2_extract = (strcmp(parameter, "y") == 0);
  1072 + config->o.m->r2_extract = (strcmp(parameter, "y") == 0);
1073 1073 }
1074 1074 else
1075 1075 {
1076   - config.o.m->r3_extract = (strcmp(parameter, "y") == 0);
  1076 + config->o.m->r3_extract = (strcmp(parameter, "y") == 0);
1077 1077 }
1078   - return *this;
  1078 + return this;
1079 1079 }
1080 1080  
1081   -QPDFJob::EncConfig&
  1081 +QPDFJob::EncConfig*
1082 1082 QPDFJob::EncConfig::print(char const* parameter)
1083 1083 {
1084   - if (config.o.m->keylen == 40)
  1084 + if (config->o.m->keylen == 40)
1085 1085 {
1086   - config.o.m->r2_print = (strcmp(parameter, "y") == 0);
  1086 + config->o.m->r2_print = (strcmp(parameter, "y") == 0);
1087 1087 }
1088 1088 else if (strcmp(parameter, "full") == 0)
1089 1089 {
1090   - config.o.m->r3_print = qpdf_r3p_full;
  1090 + config->o.m->r3_print = qpdf_r3p_full;
1091 1091 }
1092 1092 else if (strcmp(parameter, "low") == 0)
1093 1093 {
1094   - config.o.m->r3_print = qpdf_r3p_low;
  1094 + config->o.m->r3_print = qpdf_r3p_low;
1095 1095 }
1096 1096 else if (strcmp(parameter, "none") == 0)
1097 1097 {
1098   - config.o.m->r3_print = qpdf_r3p_none;
  1098 + config->o.m->r3_print = qpdf_r3p_none;
1099 1099 }
1100 1100 else
1101 1101 {
1102 1102 usage("invalid print option");
1103 1103 }
1104   - return *this;
  1104 + return this;
1105 1105 }
1106 1106  
1107   -QPDFJob::EncConfig&
  1107 +QPDFJob::EncConfig*
1108 1108 QPDFJob::EncConfig::modify(char const* parameter)
1109 1109 {
1110   - if (config.o.m->keylen == 40)
  1110 + if (config->o.m->keylen == 40)
1111 1111 {
1112   - config.o.m->r2_modify = (strcmp(parameter, "y") == 0);
  1112 + config->o.m->r2_modify = (strcmp(parameter, "y") == 0);
1113 1113 }
1114 1114 else if (strcmp(parameter, "all") == 0)
1115 1115 {
1116   - config.o.m->r3_assemble = true;
1117   - config.o.m->r3_annotate_and_form = true;
1118   - config.o.m->r3_form_filling = true;
1119   - config.o.m->r3_modify_other = true;
  1116 + config->o.m->r3_assemble = true;
  1117 + config->o.m->r3_annotate_and_form = true;
  1118 + config->o.m->r3_form_filling = true;
  1119 + config->o.m->r3_modify_other = true;
1120 1120 }
1121 1121 else if (strcmp(parameter, "annotate") == 0)
1122 1122 {
1123   - config.o.m->r3_assemble = true;
1124   - config.o.m->r3_annotate_and_form = true;
1125   - config.o.m->r3_form_filling = true;
1126   - config.o.m->r3_modify_other = false;
  1123 + config->o.m->r3_assemble = true;
  1124 + config->o.m->r3_annotate_and_form = true;
  1125 + config->o.m->r3_form_filling = true;
  1126 + config->o.m->r3_modify_other = false;
1127 1127 }
1128 1128 else if (strcmp(parameter, "form") == 0)
1129 1129 {
1130   - config.o.m->r3_assemble = true;
1131   - config.o.m->r3_annotate_and_form = false;
1132   - config.o.m->r3_form_filling = true;
1133   - config.o.m->r3_modify_other = false;
  1130 + config->o.m->r3_assemble = true;
  1131 + config->o.m->r3_annotate_and_form = false;
  1132 + config->o.m->r3_form_filling = true;
  1133 + config->o.m->r3_modify_other = false;
1134 1134 }
1135 1135 else if (strcmp(parameter, "assembly") == 0)
1136 1136 {
1137   - config.o.m->r3_assemble = true;
1138   - config.o.m->r3_annotate_and_form = false;
1139   - config.o.m->r3_form_filling = false;
1140   - config.o.m->r3_modify_other = false;
  1137 + config->o.m->r3_assemble = true;
  1138 + config->o.m->r3_annotate_and_form = false;
  1139 + config->o.m->r3_form_filling = false;
  1140 + config->o.m->r3_modify_other = false;
1141 1141 }
1142 1142 else if (strcmp(parameter, "none") == 0)
1143 1143 {
1144   - config.o.m->r3_assemble = false;
1145   - config.o.m->r3_annotate_and_form = false;
1146   - config.o.m->r3_form_filling = false;
1147   - config.o.m->r3_modify_other = false;
  1144 + config->o.m->r3_assemble = false;
  1145 + config->o.m->r3_annotate_and_form = false;
  1146 + config->o.m->r3_form_filling = false;
  1147 + config->o.m->r3_modify_other = false;
1148 1148 }
1149 1149 else
1150 1150 {
1151 1151 usage("invalid modify option");
1152 1152 }
1153   - return *this;
  1153 + return this;
1154 1154 }
1155 1155  
1156   -QPDFJob::EncConfig&
  1156 +QPDFJob::EncConfig*
1157 1157 QPDFJob::EncConfig::cleartextMetadata()
1158 1158 {
1159   - config.o.m->cleartext_metadata = true;
1160   - return *this;
  1159 + config->o.m->cleartext_metadata = true;
  1160 + return this;
1161 1161 }
1162 1162  
1163   -QPDFJob::EncConfig&
  1163 +QPDFJob::EncConfig*
1164 1164 QPDFJob::EncConfig::assemble(char const* parameter)
1165 1165 {
1166   - config.o.m->r3_assemble = (strcmp(parameter, "y") == 0);
1167   - return *this;
  1166 + config->o.m->r3_assemble = (strcmp(parameter, "y") == 0);
  1167 + return this;
1168 1168 }
1169 1169  
1170   -QPDFJob::EncConfig&
  1170 +QPDFJob::EncConfig*
1171 1171 QPDFJob::EncConfig::annotate(char const* parameter)
1172 1172 {
1173   - if (config.o.m->keylen == 40)
  1173 + if (config->o.m->keylen == 40)
1174 1174 {
1175   - config.o.m->r2_annotate = (strcmp(parameter, "y") == 0);
  1175 + config->o.m->r2_annotate = (strcmp(parameter, "y") == 0);
1176 1176 }
1177 1177 else
1178 1178 {
1179   - config.o.m->r3_annotate_and_form = (strcmp(parameter, "y") == 0);
  1179 + config->o.m->r3_annotate_and_form = (strcmp(parameter, "y") == 0);
1180 1180 }
1181   - return *this;
  1181 + return this;
1182 1182 }
1183 1183  
1184   -QPDFJob::EncConfig&
  1184 +QPDFJob::EncConfig*
1185 1185 QPDFJob::EncConfig::form(char const* parameter)
1186 1186 {
1187   - config.o.m->r3_form_filling = (strcmp(parameter, "y") == 0);
1188   - return *this;
  1187 + config->o.m->r3_form_filling = (strcmp(parameter, "y") == 0);
  1188 + return this;
1189 1189 }
1190 1190  
1191   -QPDFJob::EncConfig&
  1191 +QPDFJob::EncConfig*
1192 1192 QPDFJob::EncConfig::modifyOther(char const* parameter)
1193 1193 {
1194   - config.o.m->r3_modify_other = (strcmp(parameter, "y") == 0);
1195   - return *this;
  1194 + config->o.m->r3_modify_other = (strcmp(parameter, "y") == 0);
  1195 + return this;
1196 1196 }
1197 1197  
1198   -QPDFJob::EncConfig&
  1198 +QPDFJob::EncConfig*
1199 1199 QPDFJob::EncConfig::useAes(char const* parameter)
1200 1200 {
1201   - config.o.m->use_aes = (strcmp(parameter, "y") == 0);
1202   - return *this;
  1201 + config->o.m->use_aes = (strcmp(parameter, "y") == 0);
  1202 + return this;
1203 1203 }
1204 1204  
1205   -QPDFJob::EncConfig&
  1205 +QPDFJob::EncConfig*
1206 1206 QPDFJob::EncConfig::forceV4()
1207 1207 {
1208   - config.o.m->force_V4 = true;
1209   - return *this;
  1208 + config->o.m->force_V4 = true;
  1209 + return this;
1210 1210 }
1211 1211  
1212   -QPDFJob::EncConfig&
  1212 +QPDFJob::EncConfig*
1213 1213 QPDFJob::EncConfig::forceR5()
1214 1214 {
1215   - config.o.m->force_R5 = true;
1216   - return *this;
  1215 + config->o.m->force_R5 = true;
  1216 + return this;
1217 1217 }
... ...