Commit 2e4e25a9342b7c938748bc8bb795e406dbcbfc39
1 parent
c62ab2ee
Fix some comments
Showing
4 changed files
with
35 additions
and
18 deletions
README-maintainer
| @@ -124,12 +124,6 @@ CODING RULES | @@ -124,12 +124,6 @@ CODING RULES | ||
| 124 | 124 | ||
| 125 | HOW TO ADD A COMMAND-LINE ARGUMENT | 125 | HOW TO ADD A COMMAND-LINE ARGUMENT |
| 126 | 126 | ||
| 127 | -QXXXQ update this to explain about all the automatic handlers, the | ||
| 128 | -difference between config, json, and argv, option tables, json | ||
| 129 | -dictionaries, etc. Make sure everthing that generate_auto_job does and | ||
| 130 | -its interaction with all the QPDFJob* source/header files is clearly | ||
| 131 | -explained. | ||
| 132 | - | ||
| 133 | Command-line arguments are closely coupled with QPDFJob. To add a new | 127 | Command-line arguments are closely coupled with QPDFJob. To add a new |
| 134 | command-line argument, add the option to the appropriate table in | 128 | command-line argument, add the option to the appropriate table in |
| 135 | job.yml. This will automatically declare a method in the private | 129 | job.yml. This will automatically declare a method in the private |
generate_auto_job
| @@ -348,13 +348,7 @@ class Main: | @@ -348,13 +348,7 @@ class Main: | ||
| 348 | def prepare(self, data): | 348 | def prepare(self, data): |
| 349 | self.decls = [] | 349 | self.decls = [] |
| 350 | self.init = [] | 350 | self.init = [] |
| 351 | - self.jdata = { | ||
| 352 | - # option: { | ||
| 353 | - # tables: set(), | ||
| 354 | - # help: string, | ||
| 355 | - # QXXXQ something for registering handler | ||
| 356 | - # } | ||
| 357 | - } | 351 | + self.jdata = {} |
| 358 | 352 | ||
| 359 | def add_jdata(flag, table): | 353 | def add_jdata(flag, table): |
| 360 | nonlocal self | 354 | nonlocal self |
include/qpdf/QPDFJob.hh
| @@ -106,10 +106,10 @@ class QPDFJob | @@ -106,10 +106,10 @@ class QPDFJob | ||
| 106 | QPDF_DLL | 106 | QPDF_DLL |
| 107 | bool createsOutput() const; | 107 | bool createsOutput() const; |
| 108 | 108 | ||
| 109 | - // CONFIGURATION | ||
| 110 | - // (implemented in QPDFJob_config.cc) | ||
| 111 | - | 109 | + // SEE BELOW FOR MORE PUBLIC METHODS AND CLASSES |
| 112 | private: | 110 | private: |
| 111 | + // These structures are private but we need to define them before | ||
| 112 | + // the public Config classes. | ||
| 113 | struct CopyAttachmentFrom | 113 | struct CopyAttachmentFrom |
| 114 | { | 114 | { |
| 115 | std::string path; | 115 | std::string path; |
| @@ -146,6 +146,34 @@ class QPDFJob | @@ -146,6 +146,34 @@ class QPDFJob | ||
| 146 | }; | 146 | }; |
| 147 | 147 | ||
| 148 | public: | 148 | public: |
| 149 | + // CONFIGURATION | ||
| 150 | + | ||
| 151 | + // Configuration classes are implemented in QPDFJob_config.cc. | ||
| 152 | + | ||
| 153 | + // The config() method returns a shared pointer to a Config | ||
| 154 | + // object. The Config object contains methods that correspond with | ||
| 155 | + // qpdf command-line arguments. You can use a fluent interface to | ||
| 156 | + // configure a QPDFJob object that would do exactly the same thing | ||
| 157 | + // as a specific qpdf command. The example pdf-job.cc contains an | ||
| 158 | + // example of this usage. You can also use initializeFromJson or | ||
| 159 | + // initializeFromArgv to initialize a QPDFJob object. | ||
| 160 | + | ||
| 161 | + // Notes about the Config methods: | ||
| 162 | + // | ||
| 163 | + // * Most of the method declarations are automatically generated | ||
| 164 | + // in header files that are included within the class | ||
| 165 | + // definitions. They correspond in predictable ways to the | ||
| 166 | + // command-line arguments and are generated from the same code | ||
| 167 | + // that generates the command-line argument parsing code. | ||
| 168 | + // | ||
| 169 | + // * Methods return pointers, rather than references, to | ||
| 170 | + // configuration objects. References might feel more familiar to | ||
| 171 | + // users of fluent interfaces, so why do we use pointers? The | ||
| 172 | + // main methods that create them return smart pointers so that | ||
| 173 | + // users can initialize them when needed, which you can't do | ||
| 174 | + // with references. Returning pointers instead of references | ||
| 175 | + // makes for a more uniform interface. | ||
| 176 | + | ||
| 149 | class Config; | 177 | class Config; |
| 150 | 178 | ||
| 151 | class AttConfig | 179 | class AttConfig |
| @@ -247,7 +275,6 @@ class QPDFJob | @@ -247,7 +275,6 @@ class QPDFJob | ||
| 247 | Config* config; | 275 | Config* config; |
| 248 | }; | 276 | }; |
| 249 | 277 | ||
| 250 | - // Configuration is performed by calling methods XXX QXXXQ document | ||
| 251 | class Config | 278 | class Config |
| 252 | { | 279 | { |
| 253 | friend class QPDFJob; | 280 | friend class QPDFJob; |
| @@ -290,6 +317,8 @@ class QPDFJob | @@ -290,6 +317,8 @@ class QPDFJob | ||
| 290 | }; | 317 | }; |
| 291 | friend class Config; | 318 | friend class Config; |
| 292 | 319 | ||
| 320 | + // Return a top-level configuration item. See CONFIGURATION above | ||
| 321 | + // for details. | ||
| 293 | QPDF_DLL | 322 | QPDF_DLL |
| 294 | std::shared_ptr<Config> config(); | 323 | std::shared_ptr<Config> config(); |
| 295 | 324 |
job.sums
| 1 | # Generated by generate_auto_job | 1 | # Generated by generate_auto_job |
| 2 | -generate_auto_job e5c58868f4cb2c3ec1689bf44fb57cc57930f981f52fa4aa21d6b990a83f7163 | 2 | +generate_auto_job bf02a4e1ce64ab413a2ca8812041d50e55fe3c892e7e6010b9c258d71420310e |
| 3 | include/qpdf/auto_job_c_att.hh 7ad43bb374c1370ef32ebdcdcb7b73a61d281f7f4e3f12755585872ab30fb60e | 3 | include/qpdf/auto_job_c_att.hh 7ad43bb374c1370ef32ebdcdcb7b73a61d281f7f4e3f12755585872ab30fb60e |
| 4 | include/qpdf/auto_job_c_copy_att.hh 32275d03cdc69b703dd7e02ba0bbe15756e714e9ad185484773a6178dc09e1ee | 4 | include/qpdf/auto_job_c_copy_att.hh 32275d03cdc69b703dd7e02ba0bbe15756e714e9ad185484773a6178dc09e1ee |
| 5 | include/qpdf/auto_job_c_enc.hh 72e138c7b96ed5aacdce78c1dec04b1c20d361faec4f8faf52f64c1d6be99265 | 5 | include/qpdf/auto_job_c_enc.hh 72e138c7b96ed5aacdce78c1dec04b1c20d361faec4f8faf52f64c1d6be99265 |