Commit a9d8b9767921e9818423121d75f141e92de5c0fe
1 parent
c54837e2
Refactor `Writer`: move into `qpdf::impl` namespace, update inheritance from `Do…
…c::Common`, and adjust related `QPDFWriter` logic for improved encapsulation.
Showing
2 changed files
with
16 additions
and
14 deletions
libqpdf/QPDFWriter.cc
| ... | ... | @@ -261,21 +261,24 @@ Pl_stack::Popper::pop() |
| 261 | 261 | stack = nullptr; |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | -// Writer class is restricted to QPDFWriter so that only it can call certain methods. | |
| 265 | -class impl::Doc::Writer: impl::Doc::Common | |
| 264 | +namespace qpdf::impl | |
| 266 | 265 | { |
| 267 | - friend class QPDFWriter; | |
| 268 | - Writer(QPDF& qpdf) : | |
| 269 | - Common(qpdf, qpdf.doc().m), | |
| 270 | - lin(m->lin) | |
| 266 | + // Writer class is restricted to QPDFWriter so that only it can call certain methods. | |
| 267 | + class Writer: protected Doc::Common | |
| 271 | 268 | { |
| 272 | - } | |
| 269 | + public: | |
| 270 | + Writer(QPDF& qpdf) : | |
| 271 | + Common(qpdf.doc()), | |
| 272 | + lin(qpdf.doc().linearization()) | |
| 273 | + { | |
| 274 | + } | |
| 273 | 275 | |
| 274 | - protected: | |
| 275 | - impl::Doc::Linearization& lin; | |
| 276 | -}; | |
| 276 | + protected: | |
| 277 | + Doc::Linearization& lin; | |
| 278 | + }; | |
| 279 | +} // namespace qpdf::impl | |
| 277 | 280 | |
| 278 | -class QPDFWriter::Members: QPDF::Doc::Writer | |
| 281 | +class QPDFWriter::Members: impl::Writer | |
| 279 | 282 | { |
| 280 | 283 | friend class QPDFWriter; |
| 281 | 284 | |
| ... | ... | @@ -289,8 +292,8 @@ class QPDFWriter::Members: QPDF::Doc::Writer |
| 289 | 292 | |
| 290 | 293 | enum trailer_e { t_normal, t_lin_first, t_lin_second }; |
| 291 | 294 | |
| 292 | - Members(QPDFWriter& w, QPDF& pdf) : | |
| 293 | - QPDF::Doc::Writer(pdf), | |
| 295 | + Members(QPDFWriter& w, QPDF& qpdf) : | |
| 296 | + impl::Writer(qpdf), | |
| 294 | 297 | w(w), |
| 295 | 298 | root_og( |
| 296 | 299 | qpdf.getRoot().getObjGen().isIndirect() ? qpdf.getRoot().getObjGen() | ... | ... |
libqpdf/qpdf/QPDF_private.hh
| ... | ... | @@ -276,7 +276,6 @@ class QPDF::Doc |
| 276 | 276 | class Pages; |
| 277 | 277 | class ParseGuard; |
| 278 | 278 | class Resolver; |
| 279 | - class Writer; | |
| 280 | 279 | |
| 281 | 280 | // This is the common base-class for all document components. It is used by the other document |
| 282 | 281 | // components to access common functionality. It is not meant to be used directly by the user. | ... | ... |